XForms: hide and show form

Joel Weiner (weiner@mcci-arl-va.com)
Tue, 12 Aug 1997 15:32:34 -0400

To subscribers of the xforms list from weiner@mcci-arl-va.com (Joel Weiner) :

Hi all,

In reply to:
>> Each time, the form reappears shifted by one pel toward the
>> right and one pel toward the bottom from where it was before
>> (i.e. it slowly drifts...).

I had a similar problem, causing my forms to "walk" down and to the left.
It was somewhat different in that I was swapping two forms, trying to get them
in the exact same place. It seems that XForms was not allowing for or
getting the window decoration info from my server.

The fix that worked for me was to get the window attributes of the current
window using

XGetWindowAttributes( fl_get_display(), fl_winget(), &win_attribs );

and then calling fl_set_form_position with the following arguments
( Pointer to form I want to open,
X value of current form - win_attribs.x,
Y value of current form - win_attribs.y )

What I think happens is that Xforms says "place my window at x,y" and the server
places the window's decoration at x,y offsetting the actual form by the width
of the decoration's border (x) and title bar (y).

win_attribs.x and win_attribs.y carry the position of the actual window's
upper left corner in relation to the upper left corner of the server's
decoration. In my case it was always 5 and 26. So if I always allowed for
this offset by subtracting these values from my current window's position,
the two forms always stayed in sync.

I'm not an XWindow expert by any means so I may be all wet, however the fix works for me even if it is a bit kludgy. I found that the set geometry command did not work to soleve my problem.

Good luck
Joel

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/