[futurebasic] Re: refresh vs activate

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1998 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sun, 18 Jan 1998 21:23:51 -0600
Jeff Schwartz wrote:
>It occurs to me that I don't fully understand the differences between a
>refresh and an activate event and what should be taken care of with 
>each.  Doesn't clicking on a window cause both events?

No.  Clicking on a window causes (with exceptions noted below) only a
_wndClick event.  Your program would (normally) respond to such an event
by bringing the window to the front, which you do via the WINDOW
statement.  Bringing the window to the front always causes a
_wndActivate event.  If bringing the window to the front _also_ happens
to cause some previously-covered part of the window to become visible,
then a _wndRefresh event is generated.

So a _wndActivate event is often, but not necessarily, followed shortly
thereafter by a _wndRefresh event.  You could bring the window from the
"back" to the "front" even if nothing was in front of it.  In this case,
the window's highlighting changes to indicate that it's now active, but
no refresh event occurs (a change in the highlighting doesn't count as a

By the same token, a _wndRefresh event can occur without a _wndActivate
event.  Suppose window "A" is active (frontmost) and is partially
covering window "B".  If you drag "A" off to the side, you have not
changed the active window ("A" is still active) so there's no
_wndActivate event.  But you've now uncovered some more of "B", so "B"
needs to be refreshed.  This causes a _wndRefresh event to be generated
for window "B".

Now, about those "exceptions" I mentioned above:  Clicking on a
(non-active) window's _title_ bar (or, in OS 8, clicking anywhere on the
window's _border_) will _not_ generate a _wndClick event.  In this case,
FB just activates the window automatically (at the next HANDLEEVENTS),
without waiting for you to execute the WINDOW statement.  The only way
you can tell that FB has switched you to a new window, in that case, is
to watch for the resulting _wndActivate event.

To summarize:

* Clicking in a non-active window (except in its title bar or (in OS 8)
its border) generates a _wndClick event.

* Activating a non-active window (generally this means "bringing it to
the front") generates a _wndActivate event.  There are two ways to
activate a window: (1) the program can activate it explicitly, by
executing the WINDOW statement; or (2) FB can activate it independently,
in response to a click in the window's title bar (or border).  (A
_wndActivate event is also generated for any window which has just
become _inactive_.  In this case the "id" for the event is the
_negative_ of the inactivated window's ID

* Revealing any part of (any) window that was previously covered or
hidden generates a _wndRefresh event.  (Resizing a window--even if you
only make it smaller--also generates a _wndRefresh event.)

- Rick