[REBOL] Re: responding to 'inactive - what's the catch?
From: carl::cybercraft::co::nz at: 23-May-2002 22:11
On 23-May-02, Gregg Irwin wrote:
> 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.
By "hide" do you mean move in your example? (You're using /offset and
not 'unview in your code, so I'm assuming yes.) As when I deactivate
the window it jumps left a little way, but is still open. (On
Amiga.) I get this behaviour with or without the console open and I
didn't have to move the mouse over the window before it'd happen.
So, unless you really mean the window's supposed to disapear, it
seems to be working as you intend for me.
> What does the console cause to happen to make it work?
> REBOL 
> evt-func: func [face event][
> switch event/type [
> inactive [slide-off]
> active [slide-on]
> if not find system/view/screen-face/feel/event-funcs :evt-func [
> insert-event-func :evt-func
> shutdown: does [
> remove-event-func :evt-func
> 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