Go Command Does not Execute OpenCard on Destination Card
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Go Command Does not Execute OpenCard on Destination Card
Hi all,
I have had an issue in a couple of apps where the first card of a stack does not have its OpenCard handler automatically execute when I get there using the Go command to get to the stack. Is this an intentional behavior of LiveCode?
At the moment, it is hurting me, because I am trying to populate a DG on that card, but without hitting the OpenCard handler, old data is still displayed, and I have not yet made some sort of workaround to force the OpenCard handler.
Thanks!
Phil E.
I have had an issue in a couple of apps where the first card of a stack does not have its OpenCard handler automatically execute when I get there using the Go command to get to the stack. Is this an intentional behavior of LiveCode?
At the moment, it is hurting me, because I am trying to populate a DG on that card, but without hitting the OpenCard handler, old data is still displayed, and I have not yet made some sort of workaround to force the OpenCard handler.
Thanks!
Phil E.
Re: Go Command Does not Execute OpenCard on Destination Card
Hi.
If the card is already open, no opencard message will be sent. If the stack that the card of interest is open, but you are on another card in that stack, then it will. If the stack is not open, it certainly should.
Any of this help?
Craig Newman
If the card is already open, no opencard message will be sent. If the stack that the card of interest is open, but you are on another card in that stack, then it will. If the stack is not open, it certainly should.
Any of this help?
Craig Newman
Re: Go Command Does not Execute OpenCard on Destination Card
Craig, I think so...
So, in HandlerA, I have this line to initialize the destination stack:
start using stack "My Stack"
A short while later, in HandlerB, I have a line that says:
go to card "My Card" of stack "My Stack"
By initializing it thus, have I opened the stack in the background and prevented myself from being able to execute the OpenCard handler when I do bring stack "My Stack" to the forefront?
Thanks for your reply!
Phil E.
So, in HandlerA, I have this line to initialize the destination stack:
start using stack "My Stack"
A short while later, in HandlerB, I have a line that says:
go to card "My Card" of stack "My Stack"
By initializing it thus, have I opened the stack in the background and prevented myself from being able to execute the OpenCard handler when I do bring stack "My Stack" to the forefront?
Thanks for your reply!
Phil E.
Re: Go Command Does not Execute OpenCard on Destination Card
Sounds like it.
Have you played with the "resumeStack" message"? Placed in the stack script, it will fire whenever you return to an open stack. A handler that traps that message can do whatever you need. Another way, though a kluge, would be to go to a different card in your target stack than the one of interest, and then go to the target card. Hiding the screen is a good idea here.
Anyway, this is normal behavior in LC. But there are simple ways around it.
Craig
Have you played with the "resumeStack" message"? Placed in the stack script, it will fire whenever you return to an open stack. A handler that traps that message can do whatever you need. Another way, though a kluge, would be to go to a different card in your target stack than the one of interest, and then go to the target card. Hiding the screen is a good idea here.
Anyway, this is normal behavior in LC. But there are simple ways around it.
Craig
Re: Go Command Does not Execute OpenCard on Destination Card
Craig,
Alright, thanks so much for the insight. I have a good grasp on it now.
I also found out that, while my OpenCard script was not running because of this, my actual real issue was not resolved even when I force the OpenCard.
For some reason, my DataGrid is not refreshing when I set its dgData, yet the data array has been created properly, and the script even continues past the "set the dgData of ..." line. Strange.
It's kind of an enigma, but I'll keep hammering away at it. Maybe the workaround you suggested will miraculously make that work too, in the case that the way I come to the card prevents the DG from being recognized or regrettable...
In any case, thanks again!
Phil E.
Alright, thanks so much for the insight. I have a good grasp on it now.
I also found out that, while my OpenCard script was not running because of this, my actual real issue was not resolved even when I force the OpenCard.
For some reason, my DataGrid is not refreshing when I set its dgData, yet the data array has been created properly, and the script even continues past the "set the dgData of ..." line. Strange.
It's kind of an enigma, but I'll keep hammering away at it. Maybe the workaround you suggested will miraculously make that work too, in the case that the way I come to the card prevents the DG from being recognized or regrettable...
In any case, thanks again!
Phil E.
Re: Go Command Does not Execute OpenCard on Destination Card
Perhaps try emptying the datagrid before setting the new data. Then you might be able to determine whether the problem is in the data array or with the reference to the datagrid being populated, depending on the grid being empty or retaining the old data.
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Go Command Does not Execute OpenCard on Destination Card
It may be helpful to check the state of the lockMessages property at the moment the event you're looking for isn't being fired.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn