Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] responding to 'inactive - what's the catch?

From: greggirwin:mindspring at: 22-May-2002 20:51

Here's a question for the VID/View gurus on the list. I want to hide my window when it becomes inactive. Catching the event is no problem, but there's some little trick I'm missing to make it work. The following code works great if you paste it into a View console session, and it also works correctly if you uncomment the print statements in slide-on/off but, as it is below, it doesn't quite work. Without a console open, the deactivated window doesn't hide until you move the mouse over it. What does the console cause to happen to make it work? Thanks! --Gregg REBOL [] evt-func: func [face event][ switch event/type [ inactive [slide-off] active [slide-on] ] event ] if not find system/view/screen-face/feel/event-funcs :evt-func [ insert-event-func :evt-func ] shutdown: does [ remove-event-func :evt-func quit ] slide-off: does [ ;print ["sliding off" main-lay/offset] main-lay/offset: to-pair reduce [negate subtract main-lay/size/x 4 -22] show main-lay ] slide-on: does [ ;print ["sliding on" main-lay/offset] main-lay/offset: 0x-22 show main-lay ] main-lay: layout [ button "Quit" [shutdown] ] view/offset main-lay 0x0