responding to 'inactive - what's the catch?
[1/6] 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
[2/6] 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
<<quoted lines omitted: 4>>
> quite work. Without a console open, the deactivated window doesn't
> hide until you move the mouse over it.
Hi Gregg,
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?
> Thanks!
<<quoted lines omitted: 29>>
> ]
> view/offset main-lay 0x0
--
Carl Read
[3/6] from: g:santilli:tiscalinet:it at: 23-May-2002 12:13
Hi Gregg,
On Thursday, May 23, 2002, 4:51:46 AM, you wrote:
GI> Here's a question for the VID/View gurus on the list.
It looks like the window is not actually updated until the REBOL
process gets some event from Windows. When you have the console
opened, it is getting timer events (cursor flashing, etc), and it
works. Adding a timer to the layout like:
main-lay: layout [
button "Quit" 0:0:1 [shutdown]
]
makes it work as expected too. I didn't test it on the new beta or
IOS, so I don't know if it goes better there, but I think it
doesn't because it looks like a Windows issue.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[4/6] from: greggirwin:mindspring at: 23-May-2002 15:20
Thanks Gabriele!
Don't know why I didn't think to try that myself. Doh! :)
Yes, Carl, the idea is just to make it slide off to the edge so only a tiny
little bit is exposed, like an application desktop bar in Windows.
--Gregg
[5/6] from: g:santilli:tiscalinet:it at: 24-May-2002 12:06
Hi Gregg,
On Thursday, May 23, 2002, 11:20:55 PM, you wrote:
GI> Don't know why I didn't think to try that myself. Doh! :)
I thought of it because I had a similar problem with reading from
the serial port, where the application didn't receive data until
the user moved the mouse or something. I just put a timer and it
worked; now I'm wondering if the timer needs to be "fast enough"
or if it is sufficient to have it set...
GI> Yes, Carl, the idea is just to make it slide off to the edge so only a tiny
GI> little bit is exposed, like an application desktop bar in Windows.
He couldn't see that, because on the AmigaOS windows cannot go out
of the screen.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[6/6] from: greggirwin:mindspring at: 24-May-2002 10:18
<< now I'm wondering if the timer needs to be "fast enough"
or if it is sufficient to have it set...>>
I'm not sure because I think there's a bug that causes them to trigger
immeidately upon creation. Once that one message comes in, you're OK, so
setting it to a very long interval should be fine.
--Gregg
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted