Interrupting "Wait"

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Dec 31 10:02:25 EST 2018


Its more complicated then that.

I have struggled with this before, it’s about "running a show" of events where there is wait time and lock screen involved and the user want to quit in the middle of a repeat loop

The following the repeat loop takes over the CPU, so a mouse down on a button which triggers "StopShow". Which toggle the flag... Only fires at the end... 

Year ago I remember someone mention that we need to "enter a little idle time" into let messages "through the repeat".... but the method escapes me today.


global sConfigA,sHomeImageFile,sNarrativePlayFlag,sMainImage,sNextImage

command startNarrative
   put path_Assets()& "img/siva-darshan/who-is-siva_1200x800.jpg" into sHomeImageFile
   put "true" into sNarrativePlayFlag
   put the long id of img "homeStoryMainImage" of me into sMainImage
   put randomDietyPhotos() into tPhotoList
   repeat for each line pPath in tPhotoList
      if sNarrativePlayFlag then
         dispatch "loadNewImage" to me with pPath 
         --send "loadNewImage pPath" to me
         wait for 1 seconds
      else
         put pendingMessages()
         --loadNewImage sHomeImageFile
         -- screen with visual effect "dissolve" 
         exit repeat
      end if
   end repeat
end startNarrative

command loadNewImage pPath
   hide sMainImage with effect "dissolve" to black
   lock screen
   set the filename of sMainImage to pPath
   setRectOfCurrentGrc sMainImage
   put the loc of this card into tLoc
   subtract 27 from item 2 of tLoc
   resizeToHeight sMainImage,(the height of this card -58)
   set the loc sMainImage to tLoc
   unlock screen --with visual effect "dissolve" 
   show sMainImage with visual effect "dissolve" 
end loadNewImage

command stopShow
   loadNewImage sHomeImageFile
   put "false" into sNarrativePlayFlag
end stopShow

Brahmanathaswami
 

 Tore wrote:

    Depending on the action the user might take, have you tried:
    
    wait until the mouse is down
    
    
    Best regards
    Tore Nilsen
    
    
    
    > 31. des. 2018 kl. 14:39 skrev Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com>:
    > 
    > If you issue a
    > 
    > Wait for 3 seconds with messages
    > 
    > And, after 1 second, the users want to continue.
    > 
    > Is that a way to interrupt "wait" ?
    > 
    > Ah… yes, I know…setting a flag and issuing a send in time command will do it.
    > 
    > But  "wait" in so easy.
    > 
    > BR
    > 
    > 
    > 
    > 
    > 
    > 
    > _______________________________________________
    > 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
    
    _______________________________________________
    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