Page 1 of 2
browse tool from openstack script not working
Posted: Thu Dec 15, 2011 2:49 pm
by joeMich
Hi there!
Just upgradet to LC 5.0.2
Suddenly the openStack script of my stacks don't work as intended:
This has been working for years:
Code: Select all
on openStack
if the tool is not "browse tool" then
choose browse tool
end if
end openStack
But suddenly I discovered that the "choose browse tool" is not performed on startup of the stack.
Why?
best regards
Johan
Re: browse tool from openstack script not working
Posted: Thu Dec 15, 2011 5:49 pm
by Mark
Joe,
There are many possible reasons for this. Are you sure that the openStack handler runs at all?
Best,
Mark
Re: browse tool from openstack script not working
Posted: Thu Dec 15, 2011 6:12 pm
by joeMich
Yes, I think that the handler runs, because if I put a "beep" command just after the first it beeps
Code: Select all
on openStack
if the tool is not "browse tool" then
choose browse tool
beep
end if
end openStack
best regards
Johan
Re: browse tool from openstack script not working
Posted: Thu Dec 15, 2011 6:20 pm
by Mark
Hi Johan,
I did a test in LC 5.0.2 and all works fine. What exactly are the steps you perform to run this script? Do you have any code, any code at all, in your stack, besides this script? You should probably do a test with an otherwise empty stack and set the stack script to the handler you just posted.
Best,
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 12:24 am
by joeMich
Funny...
I did what you suggested:
Made a new stack from scratch
and the only script in stack was this openStack script mentioned
but the "choose browse tool" command doesn't execute
I also put the "Beep" thing in so I would find out if the bolean statement was true or false
- and it beeps
Has any syntax been changed since 5.0.1?
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 12:37 am
by Mark
Can you describe all steps *in detail*?
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 11:14 am
by joeMich
I still can't get it working
the command works fine from the message-window
I always have used the (and it has always worked fine)
if the tool is not "browse tool" then...
but it doesn't seem to be right now, so I changed it to
if the tool is not browse then...
The whole stack script:
Code: Select all
on openStack
put "" into fld "trapField"
--if the tool is not "browse tool" then
if the tool is not browse then
put "the tool is NOT browse tool" into fld "trapField"
choose the browse tool
if the tool is not browse then
repeat 3 times
beep
wait 1000 milliseconds
end repeat
put return & return & "the tool is STILL NOT browse tool" after fld "trapField"
else
put return & return & "the tool is now browse tool" after fld "trapField"
end if
else
put "the tool is browse tool" into fld "trapField"
end if
end openStack
on closeStack
put "" into fld "trapField"
save this stack
end closeStack
I've attached a test stack with 2 cards, where I put the command in the openCard handler of the 2. card
- and here it works ok... (at least on my machine)
Card script of card 2:
Code: Select all
on openCard
if the tool is not browse then
choose browse tool
end if
end openCard
best regards
Johan
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 12:49 pm
by Mark
Johan,
Can you change your script to
Code: Select all
on openStack
put "" into fld "trapField"
--if the tool is not "browse tool" then
if the tool is not browse then
put "the tool is NOT browse tool" into fld "trapField"
choose the browse tool
if the tool is not browse then
repeat 3 times
beep
wait 1000 milliseconds
end repeat
put return & return & "the tool is STILL NOT browse tool" after fld "trapField"
else
put return & return & "the tool is now browse tool" after fld "trapField"
end if
else
put "the tool is browse tool" into fld "trapField"
end if
breakpoint // <--- this line is new!
end openStack
on closeStack
put "" into fld "trapField"
save this stack
end closeStack
and tell me whether the actual tool is the browse tool when the script editor opens?
Best,
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 1:40 pm
by joeMich
I did as you suggested
but the same result
no change of tool at startup
Can it be because I haven't deleted the old versions of liveCode?
best regards
Johan
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 2:44 pm
by Mark
Johan,
Do I understand correctly that it works in a very simple otherwise empty stack but not in the stack in which you want to use it?
Can you tell a little more about your set-up? Operating system, any plug-ins, third-party externals, other open stacks?
It can't be because you haven't deleted old version of LC.
Kind regards,
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 3:37 pm
by joeMich
Do I understand correctly that it works in a very simple otherwise empty stack but not in the stack in which you want to use it?
No it doesn't work, neither in the simple otherwise empty stack (like the one I attached - I created that as a test...)
-nor in the stack(s) that I have created and used for a long time.
I started out with HyperCard in the 90-ties and bought the Revolution Runtime Studio when HyperCard didn't work natively on Mac osx anymore.
So the most of my stacks are originally created in HC - but later I re-created them in Revolution/liveCode.
They are stacks that I use for my work (as an organ player in a church) like databases with sheet-music, hymn-lists, payroll for singers, calendar generating.
And I use it because of the ability to automatize a lot of functions.
Right now I use it on an iMac 2011 with osx 10.6.8.
I don't have any externals or plugins beside the ones that came with the installer.
What puzzle's me is that the behavior suddenly changed when I did the upgrade to 5.0.2
- nothing else has been changed in my setup.
best regards
Johan
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 4:51 pm
by Mark
Hi Johan,
I have good hope that the problem is solved if you check the options Purge Stack on Close and Purge Window in Close in the property inspector of your stack (this sets the properties destroyStack and destroyWindow to true).
It seems that this has someting to do with the front scripts of the IDE, but I haven't investigated it in detail.
Btw if you want to save your stack, it is better to use the closeStackRequest message than the closeStack message. Also, if you try to avoid the "Do you want to save..." dialog: you can't without hacking your way in the IDE.
Kind regards,
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 7:13 pm
by mwieder
Johan-
Your syntax is incorrect.
should be
Code: Select all
if the tool is not "browse tool" then
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 7:26 pm
by Mark
Mark,
I know, the tool is "browse tool", but this is NOT the problem. The line
in the simple test stack always returns true, which means that the choose tool command always runs, but it never works.
Kind regards,
Mark
Re: browse tool from openstack script not working
Posted: Fri Dec 16, 2011 7:33 pm
by Randy Hengst
Johan
I don't have an answer for you... but I'll confirm what you're seeing. In LC5.0.1 your code works to select the browse tool, but does not in 5.0.2.
I did notice that when 5.0.2 is already open and then I open your test stack, the browse tool is selected when I open your test stack.
I also noticed that the tool palette in 5.0.1 is displayed earlier in the startup sequence than it is in 5.0.2 ... maybe there is a connection.
be well,
randy hengst