Using stacks as Dialogs
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Using stacks as Dialogs
I'd like to use a stack as a sort of input dialog box.
There would be various fields and radio buttons in the "dialog" stack.
I'd like my script to pause for input, show the "dialog" window and allow the user to input data.
When the user hits an "OK" button, or the return key, I would like the calling script to resume from where it paused and make use of the input data.
How would I set this up in Revolution? Is it possible?
(To be honest, my calling script will itself have been called through AppleTalk from Excel VBA, and my Excel macro, which treats it as a function, will be waiting for a reply from the calling script, detailing the results of this RunRev "dialog box." I find I am able to shunt the called and returned parameters back and forth easily enough between the two applications. But the Excel macro will only pause whilst the called script is running - which is why I want the Rev script to pause until the user hits "OK", then resume in order to return the newly entered params to Excel.)
There would be various fields and radio buttons in the "dialog" stack.
I'd like my script to pause for input, show the "dialog" window and allow the user to input data.
When the user hits an "OK" button, or the return key, I would like the calling script to resume from where it paused and make use of the input data.
How would I set this up in Revolution? Is it possible?
(To be honest, my calling script will itself have been called through AppleTalk from Excel VBA, and my Excel macro, which treats it as a function, will be waiting for a reply from the calling script, detailing the results of this RunRev "dialog box." I find I am able to shunt the called and returned parameters back and forth easily enough between the two applications. But the Excel macro will only pause whilst the called script is running - which is why I want the Rev script to pause until the user hits "OK", then resume in order to return the newly entered params to Excel.)
Re: Using stacks as Dialogs
Does go "yourStack" as modal solve this?
Cheers,
Malte
Cheers,
Malte
Re: Using stacks as Dialogs
I think it is dicey to set up some sort of wait or repeat loop and then poll whether the returnKey is pressed. You are asking that the returnKey sort of interrupt the handler.
Is a single calling handler really required? Could you use two? If so, it sounds like you do not need to have the script "wait" for the input. You simply open the dialog when you need to and stop. The user can enter data, hit the return button, and another script could take over from there.
Is a single calling handler really required? Could you use two? If so, it sounds like you do not need to have the script "wait" for the input. You simply open the dialog when you need to and stop. The user can enter data, hit the return button, and another script could take over from there.
Re: Using stacks as Dialogs
Thank you so much. I think that was exactly what I was after.
I had to set up OK and Cancel buttons along the following lines:
on mouseUp
global Clicked
put "OK" into Clicked
close this stack
end mouseUp
Once closed, the calling script resumes, and can glean information from the altered card (since a "closed" stack is not actually purged from memory - merely from sight).
Big help.
Cheers, Malte.
(I take your point dunbarx but, in this instance, it was necessary to pause the calling script and wait for input - because an outside application was waiting for returned parameters - and would itself resume as soon as the calling script was cancelled. The alternative - sending messages back and forth via Appletalk - would have been less wieldy, more complicated to plan out, and pose problems when users changed their minds and cancelled)
I had to set up OK and Cancel buttons along the following lines:
on mouseUp
global Clicked
put "OK" into Clicked
close this stack
end mouseUp
Once closed, the calling script resumes, and can glean information from the altered card (since a "closed" stack is not actually purged from memory - merely from sight).
Big help.
Cheers, Malte.
(I take your point dunbarx but, in this instance, it was necessary to pause the calling script and wait for input - because an outside application was waiting for returned parameters - and would itself resume as soon as the calling script was cancelled. The alternative - sending messages back and forth via Appletalk - would have been less wieldy, more complicated to plan out, and pose problems when users changed their minds and cancelled)
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Using stacks as Dialogs
It may be worth looking up the dialogData global property in the Dictionary as an alternative to using a global. There's nothing wrong with using globals for that, but I'm lazy and enjoy not having to declare them when I can avoid it.
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
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
Re: Using stacks as Dialogs
There is a lesson on the RunRev site that shows how to use the dialogData with modal stacks. It might be useful as well.
How Can I Pass Data To and Get Data From a Dialog Window?
How Can I Pass Data To and Get Data From a Dialog Window?
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
Re: Using stacks as Dialogs
Thank you all. I will look up dialogData.