Tricky Problem

Dave dave at looktowindward.com
Tue May 22 17:01:39 EDT 2007






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
   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 mouseUp





More information about the use-livecode mailing list