browse tool from openstack script not working

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

browse tool from openstack script not working

Post by joeMich » Thu Dec 15, 2011 2:49 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Thu Dec 15, 2011 5:49 pm

Joe,

There are many possible reasons for this. Are you sure that the openStack handler runs at all?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Re: browse tool from openstack script not working

Post by joeMich » Thu Dec 15, 2011 6:12 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Thu Dec 15, 2011 6:20 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Re: browse tool from openstack script not working

Post by joeMich » Fri Dec 16, 2011 12:24 am

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?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Fri Dec 16, 2011 12:37 am

Can you describe all steps *in detail*?

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Re: browse tool from openstack script not working

Post by joeMich » Fri Dec 16, 2011 11:14 am

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
Attachments
testStak.livecode.zip
(951 Bytes) Downloaded 266 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Fri Dec 16, 2011 12:49 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Re: browse tool from openstack script not working

Post by joeMich » Fri Dec 16, 2011 1:40 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Fri Dec 16, 2011 2:44 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Re: browse tool from openstack script not working

Post by joeMich » Fri Dec 16, 2011 3:37 pm

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Fri Dec 16, 2011 4:51 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: browse tool from openstack script not working

Post by mwieder » Fri Dec 16, 2011 7:13 pm

Johan-

Your syntax is incorrect.

Code: Select all

if the tool is not browse then
should be

Code: Select all

if the tool is not "browse tool" then

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: browse tool from openstack script not working

Post by Mark » Fri Dec 16, 2011 7:26 pm

Mark,

I know, the tool is "browse tool", but this is NOT the problem. The line

Code: Select all

if the tool is not "browse" 
in the simple test stack always returns true, which means that the choose tool command always runs, but it never works.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 154
Joined: Thu Jun 29, 2006 4:16 pm

Re: browse tool from openstack script not working

Post by Randy Hengst » Fri Dec 16, 2011 7:33 pm

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

Post Reply

Return to “Off-Topic”