Advice as to how to create a dialog
Michael Doub
mikedoub at gmail.com
Sun Jul 27 14:21:02 EDT 2014
I am trying to figure out how to create a dialog for data entry into a Date field. I want to use a date picker if the control key is not down, but allow normal entry if the control key is down. I thought that I would use the open field handler and I thought I would pass data to and from the dialog stack thru the dialog data. Sounds simple enough...
on openfield
put the short name of the target into jump
put the datefields of this card into Date_Fields
if jump is not among the lines of Date_Fields then exit openfield
if (the controlkey is up) then
put fld jump into contents
if contents is not empty then
set the dialogdata to contents
else
put the date into contents
set the itemdel to "/"
set the dialogdata to "20" & item 3 of contents & "-" & item 1 of contents & "-" & item 2 of contents
end if
go to stack "calendarWidget" as modal
put the dialogdata into fld jump
end if
end open field
Well, it seems like the openfield handler is getting called even when the user is actually clicking in the field as if there is a state being maintained and it is called whenever the stack becomes active.
Let em try and be more clear..
First time thru, the user clicks the field. As expected the openfield is called
calendarWidget pops up as expected
then openfield gets called again as the calendarWidget goes way and we are back on the stack with the field. Now I am in a loop.
This has me wondering if using the openfield handler is the correct approach? Am I correct in assuming that I will be able to pick up the results of the calendarWidget after the go command? Is the calling stack blocked waiting for the modal stack to complete?
How are other folks working with dialogs?
Thanks
Mike
More information about the use-livecode
mailing list