` Printed Icetips Article

Icetips Article



Par2: Snappier window repaints
1999-06-12 -- Jerry Norman
 
1. My overall approach is to hide a window during the time that Clarion is
painting it, then unhide it so that it appears to "snap" onto the window.  I
learned it is necessary to hide (or close) the last child window after
opening a new child window. Otherwise, the underlying window can be seen
during resize activity and  when you close your application, and it needs to
be closed anyway before it can be reselected. This is because when Clarion
opens a new window it doesn't go straight to the maximized state - it first
paints in a normal size and then expands to the maximized state. BTW, for
this application I am limiting my child windows to a single thread each.

2.  To accomplish the hiding on initial load I put

Self{PROP:Hide} = True

in the ThisWindow.Init embed directly after Open the window. Note this does
not work for an existing window that you are reselecting. I take care of
that in 4 below.

3. Then, in ThisWindow.TakeSelected embed I put

POST(Event:GainFocus,,,)

after the parent call.

4. In the WindowEvents GainFocus embed (priority 5000) I put the following:

Self{PROP:Maximize} = True
IF glo:Thread:BrwNte
  SETTARGET(,glo:Thread:BrwNte)
  TARGET{PROP:Hide} = True
END
IF glo:Thread:BrwBus
  SETTARGET(,glo:Thread:BrwBus)
  TARGET{PROP:Hide} = True
END
SETTARGET(,glo:Thread:BrwPrj)

Elsewhere, when I open a child window I assign the thread() to the
appropriate glo:Thread variable, or if it is already open I post a GainFocus
event to the thread. The above code hides whichever window is being overlaid
by this newly selected window. I orginally thought I could just hide a
window when it lost focus but this creates interesting results when the user
selects another window outside your application .

Note that there is no Self{PROP:Hide} = False. This is because PROP:Maximize
does an implicit unhide (not sure why). I had to use PROP:Maximize because
even though the child windows had the MAX attribute set, Clarion doesn't
always maintain that state when you are resizing the window. I also found
that some of the events I tried seemed inconsistent in there implementation.
For example, I expected Maximized to fire anytime the window changed to the
Maximized state but sometimes it doesn't.



Printed May 11, 2024, 4:00 pm
This article has been viewed/printed 35118 times.