In the past I've called the "ask" dialog to request info from the user and, if the "OK" button was pressed, the requested info was now in "it". No problems.
Now, however, I am requesting the user provide much more detailed information that needs to remain structured so I've created a substack with fields, called it with "as sheet", then populated those fields in the substack with certain info from the main stack.
Before I get too far down this rabbit-hole, I wanted to post my process for this for comment by those more experienced in these matters.
What I've found is that I need to pass the information by splitting the process between the button that fills a global variable with the info from the main stack and then calls the modal, followed by an Open Stack handler in the sub-(modal)-stack that fills in the fields using the data that I placed into the global var.
Coming back from the modal (assuming the user clicked the button approving the change or addition), I have to fill the global again (with the data from the fields in the modal) and close the modal; then I'm back in the original button's script that called the modal in the first place where I finish processing the data the user approved in the modal.
I am assuming this "division of work" is necessary because calling the sub-stack as a modal prevents any further processing of the calling handler until the modal is dismissed. Additionally, I need to use globals because I am moving from one handler to another then back again. Am I understanding this correctly?
Thanks for your comments.
Barry
Global vars needed for modals I create?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
-
- VIP Livecode Opensource Backer
- Posts: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Global vars needed for modals I create?
There are many ways to get data in and out of dialogs, and globals can be a good one. In fact, there's one global built into the language for this purpose: see the Dictionary for DialogData.
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
-
- Posts: 222
- Joined: Wed Jun 21, 2006 7:33 pm
- Location: West of the Pecos
- Contact:
Re: Global vars needed for modals I create?
Ahh! "DialogData" will do it and will, as the dictionary states, permit me to simplify my code.FourthWorld wrote: ↑Sun Apr 08, 2018 5:48 pmThere are many ways to get data in and out of dialogs, and globals can be a good one. In fact, there's one global built into the language for this purpose: see the Dictionary for DialogData.
Many thanks!
Barry