Advice as to how to create a dialog

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Jul 27 15:45:42 EDT 2014


Hi Mike,

You could lock messages before opening the dialog. That should keep the 
engine from firing the openField message. A better way probably is to 
not only lock messages but also select the text of the next field before 
unlocking the messages.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 7/27/2014 20:21, Michael Doub wrote:
> 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
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list