Home   Archive   Permalink

wait until LMB pressed

Sorry for such a simple request - I have never used REBOL but have a complex programme I am looking at for a friend.
I need to wait until the left mouse button has been pressed down and released ANYWHERE before continuing with the rest of the programme.
I have looked on countless sites but all seem to need the mouse lick to be on an object.
Many thanks

posted by:   Doc       16-Jun-2014/7:23:56-7:00

Not knowing what follows the press, but you could make a button the size of the complete screen in R3.
Does that qualify as "ANYWHERE", and not an object?

posted by:   yoffset       16-Jun-2014/10:53:29-7:00

Insert-event-func allows you to detect high-level/system-wide events.

posted by:   Minim       16-Jun-2014/12:12-7:00

Thanks yoffset - a screen size button would cover the very full set of objects on the guy's screen - the guy's programme is over 7000 lines long so I'm trying not compromise anything that he has already done!
Thanks minim - I have no knowledge of REBOL - I want the equivalent to
until (z=1) {onmousedown==true z=1;}
where onmousedown becomes true when the Left-hand mousebutton is pressed - so until the LMB is pressed the programme remains at this point.
Your time is appreciated guys

posted by:   Doc       16-Jun-2014/19:29:58-7:00

I think then you want something like below. Note that the buttons do not activate until a RIGHT click has happened.
     R E B O L []
     view/new layout [
         button "press me" [print "I was pressed"]
         rotary "Won't" "Change" "until" "Mouse" "Clicked"
     my-ef: insert-event-func [
         if event/type = 'alt-down [print "Activating application" remove-event-func :my-ef]
         none     ;; Throw away all events

posted by:   Minim       17-Jun-2014/10:50:33-7:00

Thanks Minim, I'll give that a try. Much appreciated.

posted by:   Doc       18-Jun-2014/3:54:02-7:00