Best way to ask the user to wait?
Trevor DeVore
lists at mangomultimedia.com
Thu Mar 31 15:10:06 EST 2005
On Mar 31, 2005, at 1:14 AM, graham samuel wrote:
> I'd like to put up a kind of advisory note to the user saying
> something like
>
> "Please wait while we process your request"
>
> I don't want any reaction from the user, such as clicking on "OK" or
> "Cancel" - I just want to warn her/him that it may take some time to
> complete the next task. During this period, I have a nice animation
> for the person to look at, but I don't really want to add my note to
> the animated display. I suppose the usual thing is to put the cursor
> into 'hourglass' or 'pizza' mode (according to platform) and of course
> I can do this, but I just want to show my message first.
>
> What's the best way to implement this, do you think?
Graham,
Do you want to keep the user from clicking on other areas of your app
while this happens? For some tasks I have a "progress" stack that I
display as modal (but doesn't block current script execution). This
displays a progress bar (or animation) and keeps the user from clicking
on anything else until the process has completed.
If this would work in your case you can do the following:
1) Create a stack. For this example I will name it "myProgress".
2) Attach the script I've included below.
3) To give a name to the progress stack: set the uTitle of stack
"myProgress" to "I'm doing something. Hold on."
3) To show the stack: set the uShow of stack "myProgress" to true
4) To hide the stack: set the uShow of stack "myProgress" to false
In my script I have additional properties such as uProgress (updates a
progress bar) and uFeedback (updates text displayed to the user). This
script just has the basics included.
Note that if you make a mistake during development and forget to close
the progress dialog you can hold down the command/control key and click
on the window to make it disappear (see the mousedown handler).
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
=====
== BEGIN SCRIPT
=====
local sCenterOnScreen = "true"
setProp uTitle pValue
set title of me to pValue
end uTitle
setProp uCenter pValue
if pValue <> false then put true into pValue
put pValue into sCenterOnScreen
end uCenter
setProp uShow pValue
local tTarget = ""
if pValue = true then
put line 1 of openStacks() into tTarget
if sCenterOnScreen = false AND tTarget <> empty then
put loc of stack tTarget into tLoc
else
put screenLoc() into tLoc
end if
go invisible stack (short name of me) as modal
set loc of me to tLoc
set visible of me to true
--> GIVE IT TIME TO DISPLAY
wait 100 milliseconds
else
put true into sCenterOnScreen
put 100 into sEndValue
close me
wait 0 milliseconds
end if
end uShow
getProp uShow
if short name of me is among lines of openStacks() then
return true
else
return false
end if
end uShow
--> FOR TESTING
on mousedown
if environment() = "development" AND commandKey() is down then close
stack (short name of me)
end mousedown
=====
== END SCRIPT
=====
More information about the use-livecode
mailing list