30 Mar 2005 00:05
Re: Bug(?) in archive-as-xml
idevx <idevx <at> yahoo.com.ar>
2005-03-29 22:05:33 GMT
2005-03-29 22:05:33 GMT
You're right - it was Applescript's fault: I'm using
Apple's Accessibility API to send the values from my
Applescript-based GUI to a breve, NIB interface
consisting of textboxes. The breve NIB has textboxes
that I fill in with my values (number of legs, sizes,
other stuff and filename of the config when saving)
but breve doesn't "see" the changes in the contents of
the textboxes until I manually set & change focus to
each textbox.
I solved this previously by sending fake "tab"
keystrokes, but forgot to do this when I added the
filename.
This brings another thing I'm not sure if it could be
solved or is simply "the way textboxes work". If I
make a simple breve app with a NIB containing:
1 textbox (Tag: 101)
1 button (Tag: 102)
and this script:
---------------------------------------------------
<at> nib_file "test".
<at> use Control.
Controller myController.
Control : myController {
+ variables:
myText (string).
+ to init:
print "simulation started".
+ to iterate:
super iterate.
+ to catch-interface-id-101 with-string s
(string):
myText = s.
print "textbox modified - new value:", myText.
+ to catch-interface-id-102 with-string s
(string):
print "button clicked - textbox value:",
myText.
}
--------------------------------------------------
The textbox isn't updated unless I press tab or enter.
If I simply click the button (let's say the button
title is "Apply"), the textbox doesn't lose focus and
so the last value I entered is ignored. Is there any
alternative way I can get the value of controls? I
don't really need to know when every control value
changes, but I would like to be able to poll their
value at a later time (for instance, I let the user
change all the values and only after he presses
"Apply" I read them)
So far my solution works but is pretty shaky: I have a
separate Applescript GUI that only sends all the
values when the user clicks "Apply", but in order to
make breve "see" the changes I have to send n tabs
(for n values) to cause focus changes and make sure
that the breve-based NIB has a closed key loop so that
the focus returns to the first item.
In breve, every change triggers a corresponding
catch-interface-id-xxx that updates each specific
value, stored in an temporary struct (an abstract
object).
Then, my Applescript sends a fake click event to a
hidden button in the breve-based NIB to copy the
temporary struct to the current simulation struct.
As you can see, this is fairly complex so if there is
an easier way I would definitely like to know :)
The applescript GUI (the one with sliders) and the
custom breve NIB GUI (top right) can be seen in this
screenshot:
http://i2.photobucket.com/albums/y22/powermacx/simrobot.jpg
--- jon klein <jk <at> artificial.com> wrote:
>
> On Mar 29, 2005, at 3:41 PM, idevx wrote:
>
> > Hi, I haven't been able to test the 2.2b version
> yet
> > (waiting for the mac version ;) ), but I found a
> bug
> > or limitation in Object's archive-as-xml method.
> > Apparently, the "file" parameter only accepts file
> > names, but not full paths.
> >
> > I'm using an Applescript GUI to control my
> simulation
> > (1), and something that is very important to me is
> > saving and loading simulation configurations. To
> that
> > effect, I implemented save & load dialogs, and I
> send
> > breve the full paths, but this limitation of not
> being
> > able to use the entire path makes those dialogs
> > useless. Is there any chance that this may be
> changed
> > in the 2.2 release?
>
> Hi Ignacio,
> archive-as-xml should work with full pathnames --
> anything beginning with a "/" should be treated as a
> full path. I've tested this with 2.1 and 2.2 and it
> seems to work.
>
> What is the actual string filename that is getting
> passed to archive-as-xml?
>
> - jon klein
>
> _______________________________________________
> breve mailing list
> breve <at> spiderland.org
> http://lists.spiderland.org/mailman/listinfo/breve
>
__________________________________
Do you Yahoo!?
Yahoo! Sports - Sign up for Fantasy Baseball.
http://baseball.fantasysports.yahoo.com/
_______________________________________________
breve mailing list
breve <at> spiderland.org
http://lists.spiderland.org/mailman/listinfo/breve
RSS Feed