Tricky Problem
Jim Ault
JimAultWins at yahoo.com
Tue May 22 18:16:16 EDT 2007
Here is one way, amoung others
send " doTheMouseupThing fromMseUp" to me in 1 tick
> on mouseUp
doTheMouseupThing
> end mouseUp
on doTheMouseupThing msgg
if msgg is empty then --the user did the click
> local myMessageID
> local myMessageKind
>
> set the destroyStack of this stack to true
> put the cpControlMID_TimeOutControl of me into myMessageID
> put the cpControlMK_TimeOutCompleteCommand of me into myMessageKind
> get ISMAppUtilsEncodeAndPutMessage
> (myMessageID,myMessageKind,"volatile","String",empty)
>
> save this stack
> close this stack
end doTheMouseupThing
On 5/22/07 2:01 PM, "Dave" <dave at looktowindward.com> wrote:
>
>
>
>
>
> HI All,
>
> I have a problem and it's either tricky or I have been sitting in
> front of this keyboard for far too long!
>
> I have a time-out value, it it fires it calls
> "HandleMessageTimeOutControl" (as well as other handlers). If the
> user clicks in the button, then I want to cancel the timeout (by
> sending a "HandleMessageTimeOutControl"). The code in Case 1 below
> works ok, except if contained in a Modal stack, if it is, then the
> modal fails to work after the first call. I'm guessing it's because
> the "OK" button did not get pressed. In case 2, the message gets sent
> twice which causes the dialog to skip on multiple calls.
>
> What I really want is a way of tell if the mouseUp handler has been
> called by the user pressing the mouse or if it's via the "send" command.
>
> Any ideas?
>
> All the Best
> Dave
>
> Case 1:
>
> on HandleMessageTimeOutControl
> theMessageID,theMessageKind,theMessageData
> local myMessageData
>
> put ISMAppUtilsDecodeMessage(theMessageData,"String,") into
> myMessageData
>
> switch theMessageKind
> case "LTW_TimeOutComplete"
> save this stack
> close this stack
>
> break
> end switch
> end HandleMessageTimeOutControl
>
>
> on mouseUp
> local myMessageID
> local myMessageKind
>
> set the destroyStack of this stack to true
> put the cpControlMID_TimeOutControl of me into myMessageID
> put the cpControlMK_TimeOutCompleteCommand of me into myMessageKind
> get ISMAppUtilsEncodeAndPutMessage
> (myMessageID,myMessageKind,"volatile","String",empty)
> end mouseUp
>
>
>
> Case 2:
>
> on HandleMessageTimeOutControl
> theMessageID,theMessageKind,theMessageData
> local myMessageData
>
> put ISMAppUtilsDecodeMessage(theMessageData,"String,") into
> myMessageData
>
> switch theMessageKind
> case "LTW_TimeOutComplete"
> send "mouseUp" to me in 1 tick
> break
> end switch
> end HandleMessageTimeOutControl
>
>
> on mouseUp
doTheMouseupThing
> end mouseUp
on doTheMouseupThing msgg
if msgg is empty then --the user did the click
> local myMessageID
> local myMessageKind
>
> set the destroyStack of this stack to true
> put the cpControlMID_TimeOutControl of me into myMessageID
> put the cpControlMK_TimeOutCompleteCommand of me into myMessageKind
> get ISMAppUtilsEncodeAndPutMessage
> (myMessageID,myMessageKind,"volatile","String",empty)
>
> save this stack
> close this stack
end doTheMouseupThing
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list