"wait until" or "repeat until" (with a wait) for modal dialog wait?

Mark Schonewille m.schonewille at economy-x-talk.com
Sat Jun 13 14:00:18 EDT 2015


Hi Richard,

You don't want to use the wait command here. You want to use a callback 
message. If your stacks are real modal windows, you don't even need that.

With a real modal window:

on scriptWithDialog
	// do something here
	go stack "My Dialog" as modal
	// the script will continue when "My Dialog" closes
end scriptWidthDialog

If you are using a palette or modeless window, you'd better use a 
callback message:

on scriptWithDialog
	// do something here
	showDialogWindow "callbackMessage",the long ID of me
end scriptWithDialog

on callbackMessage
	// this script runs after the dialog closes
end callbackMessage

on showDialogWindow theCallbackMessage,theCaller
	set the cCallbackMessage of stack "My Dialog" to theCallbackMessage
	set the cCaller of stack "My Dialog" to theCaller
	go stack "My Dialog" as modeless
end showDialogWindow

// put this into the stack script of stack "My Dialog"
on closeStack
	put the cCallbackMessage of me into myMessage
	put the cCaller of me into myCaller
	send myMessage to myCaller in 0 millisecs
end closeStack

This should do it.

--
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 6/13/2015 19:03, Dr. Hawkins wrote:
> I am writing my own modal replacement for answer for a variety of reasons
>
> Once I have a modal stack/card set up, there isn't anything to do but wait
> for it.
>
> I could use either
>
> repeat until the retVal of me is not empty
>     wait 10 milliseconds with messages
> next repeat
>
>
> or I could use
>
> wait until the retVal of me is not empty
>
>
> But is the wait until going to spike the cpu?   the dictionary states that
> to evaluates "continuously"--but how continuously is continuously?
>
> And will this be system dependent?
>




More information about the Use-livecode mailing list