"go stack" doesn't "go"

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

"go stack" doesn't "go"

Post by jawall » Thu Aug 29, 2013 5:53 pm

Hi,

I have a main stack and a substack. A handler in my main stack does some things and finally has a "go stack" message to my substack. It goes there alright, but immediately returns to the main stack, where it stays. To me it seems the problem is the "focus on" command.

The complete code is very long and complex but here is the relevant portion

Code: Select all

 go stack "Sitzplan"
 focus on fld w of stack "Sitzplan"
The only way I can keep the stack I navigated to frontmost is inserting an "answer"-line like this (which is not practical):

Code: Select all

go stack "Sitzplan"
answer "Hurliburli"
focus on fld w of stack "Sitzplan"
or

Code: Select all

answer "Hurliburli"
go stack "Sitzplan"
focus on fld w of stack "Sitzplan"
but not

Code: Select all

go stack "Sitzplan"
focus on fld w of stack "Sitzplan"
answer "Hurliburli"


Any ideas?

Thanks
Jawall

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: "go stack" doesn't "go"

Post by dunbarx » Fri Aug 30, 2013 4:54 am

Hi.

Well, no way this should be an issue. Are you sure there is no handler lurking somewhere that insinuates itself into the mix? If that really does not seem to be the case, can you comment out all but the "go" and "focus" commands, and see if the mainstack comes back to the front? If it does not, can you then uncomment blocks of code until it does? This is tedious, and sometimes difficult to do without compromising dependent parts of the handler.

Because the commands you are using are as plain and simple as they get. They work as advertised.

Craig Newman

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: "go stack" doesn't "go"

Post by jawall » Fri Aug 30, 2013 7:33 am

Thanks dunbarx,

you're absolutely right, this is really plain stuff and should definately work as expected. Following your suggestion:

Code: Select all

go stack "Sitzplan"
-- focus on fld w of stack "Sitzplan"
works as expected, i.e. brings up substack "Sitzplan"

Code: Select all

--go stack "Sitzplan"
focus on fld w of stack "Sitzplan"
has a strange behavior:
the message watcher gives me a sequence of focusin, focusout,focusin,focusout, the last two messages on the field I am aiming at.
The result is that the desired field is not focused as I wanted and expected it.

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: "go stack" doesn't "go"

Post by [-hh] » Fri Aug 30, 2013 8:13 am

..........
Last edited by [-hh] on Wed Aug 13, 2014 12:19 pm, edited 1 time in total.
shiftLock happens

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: "go stack" doesn't "go"

Post by jawall » Fri Aug 30, 2013 9:50 am

Thanx [-hh]

tried your solutions in my environment - to no avail. substack comes up, field is focused, mainstack goes to front. Only way I can keep the substack frontmost is still by inserting an "answer dialog" - which I don't understand at all.

In a totally fresh environment of a main and a substack my initial, as well as all your solutions work.

The question narrows down to 2 things
a) why does "go stack theSubstack" keep theSubstack frontmost but "go stack theSubstack;focus on fld theField" focus the correct field but afterwards returns to the mainstack
b) why does an inserted "answer dialog" prevent from returning to the mainstack

I swear there is no go mainstack handler anywhere near. I do have focusin and focusout handlers in my destination fields though:

Code: Select all

on focusIn
  set the backcolor of me to red
end focusIn

on focusOut
  set the backcolor of me to empty
end focusOut

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: "go stack" doesn't "go"

Post by jawall » Fri Aug 30, 2013 10:04 am

I think I got it!

As I said in my opening post, the complete code is quite correct. Some hundred lines up the code I found a "go theMainstack". Before that I had locked the screen but never unlocked it manually. After taking out the "lock screen" all worked fine. This might also explain why throwing in an answer dialog also gave me the right solution, it unlocked the screen automatically at a point when the handler was still at my substack.

Does that make sense to you?

Thank you again for your input
Jawall

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: "go stack" doesn't "go"

Post by [-hh] » Fri Aug 30, 2013 2:36 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 12:18 pm, edited 1 time in total.
shiftLock happens

jawall
Posts: 31
Joined: Wed Sep 12, 2012 1:43 pm

Re: "go stack" doesn't "go"

Post by jawall » Fri Aug 30, 2013 6:31 pm

Thank you [-hh]

Your hint is very helpful, indeed!

I remember back in the days when I learned HyperTalk, I used to do all unlocking manually, because I was taught to. Somewhere down the line I dropped some of those waterproof techniques I have learnt. I did so, I have to admit, out of laziness. The past few days of beating my head against the wall when stepping through the many lines of code I've written for my project during the last 3 months over and over again,the hours of testing and trying to work around a thing I could not explain to myself maybe will get me back to neater programming again :oops:

Again, thank you all for your input and discussion.

Jawall

Post Reply

Return to “Talking LiveCode”