[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1717.0. "Callbacks on resizing windows" by NRMACS::FRANCIS (A wife and an hernia to support.) Fri Nov 10 1989 06:23

    Hi folkes!
    
    I want to know if it is possible to invoke a callback routine when a
    window, in particular a scroll window, is resized.
    
    If it is possible I would like to know how to achieve it.
    
    Thanks in anticipation of any replies.
    
    
    Best regards,
    
    Pete Francis @BIO
    
T.RTitleUserPersonal
Name
DateLines
1717.1Yes and no...MELTIN::dickGvriel::SchoellerFri Nov 10 1989 09:475
You can establish an event handler or a translation table on one or more
of the widgets in your hierarchy to handle ConfigureNotify events.  These
are the events that you will get when the window is resized.

Dick
1717.2Callbacks on resize.NRMACS::FRANCISA wife and an hernia to support.Fri Nov 10 1989 11:526
	Thanks very much Dick, I'll try it out and get back to you in this topic 
with the result.

Best regards,

Pete.
1717.3Callbacks on resize NRMACI::FRANCISA wife and an hernia to support.Tue Nov 14 1989 07:1933
Hi Dick,
	Yes it worked ok. There were however a few learnings if your interested:

1) I created an event handler with a call to the toolkit routine
   XtAddEventHandler. The most appropriate event mask seemed to be
   StructureNotifyMask which notifies the user of more events than just
   resizing the window. (See Xlib Programming: MIT C Binding)

2) To determine the type of event I used the Xlib routine XPeekEvent to get
   the event structure. Once I had this I could examine the "type" member
   to ascertain the cause of the event. ConfigureNotify, (22 in decimal)
   appears to be the type that indicates a window resize.

3) Because the window in question was a scroll window, any routines that removed
   the event from the input queue, for example XCheckIfEvent or XNextEvent,
   prevented the window from being redisplayed correctly after
   a resize operation. i.e. scroll bars didn't move to the edge of the window,
   the window appeared transparent, only the boarder was resized. Hence
   XPeekEvent was used.

4) Also note, that because it is a scroll window, when it is resized several
   other events are generated and captured by the event handler as a result
   of the resize. Only look at the first one that XPeekEvent returns if you
   want to determine the original cause of the event.


I hope this may be useful to others, my reservation is that because it is a 
reply it may be passed over. Anyway it was good of you to point me in the
right direction. Thanks again!

Regards,

Pete Francis @BIO