XForms: how do I programatically resize correctly ?

Mark Edward Johnston (M.E.Johnston@damtp.cam.ac.uk)
Wed, 20 Aug 1997 12:38:06 +0100 (BST)

To subscribers of the xforms list from Mark Edward Johnston <M.E.Johnston@damtp.cam.ac.uk> :

Hi,

I want to remove some "panels" from a form, so I basically
resize the form then hide/delete the panel.

My code is something like this:

cerr << "About to resize. ";

FL_Coord oldwidth = pform->w, oldheight = pform->h;

cerr << "I have oldwidth = " << oldwidth << "; oldheight = " <<
oldheight << ".\n";

FL_Coord desired_newheight = oldheight - panelheight;
if (desired_newheight <= 0) desired_newheight = 1;
fl_winresize(form_window, oldwidth, desired_newheight);

cerr << "Just did fl_winresize(). I now have:\n";
cerr << "pform->w = " << pform->w << "; pform->h = " << pform->h <<
".\n";

fl_set_form_size(pform, oldwidth, desired_newheight);

cerr << "Just did fl_set_form_size(). I now have:\n";
cerr << "pform->w = " << pform->w << "; pform->h = " << pform->h <<
".\n";
cerr << "desired_newheight was: " << desired_newheight << "\n";

Thing is, I do this a couple of times in a row, and the form hasn't
resized by the time I next come to it, so that on the second resize,
it starts from the old value of pform->h and thus I am left with a form
with a big gap at the bottom (extra size with nothing in it).

Is this the correct way to programatically resize ?
(I don't imagine it is correct to do both fl_winresize() and
fl_set_form_size(), but I tried both just in case)

Would it be acceptable for me to set the value of pform->h directly
so that it is up to date the next time I come around ?

Example output is below.

Mark J.

About to resize. I have oldwidth = 316; oldheight = 436.
Just did fl_winresize(). I now have:
pform->w = 316; pform->h = 436.
Just did fl_set_form_size(). I now have:
pform->w = 316; pform->h = 436.
desired_newheight was: 248

About to resize. I have oldwidth = 316; oldheight = 436.
Just did fl_winresize(). I now have:
pform->w = 316; pform->h = 436.
Just did fl_set_form_size(). I now have:
pform->w = 316; pform->h = 436.
desired_newheight was: 356

(the second desired_newheight should be (436-188)-80=168, but as on the
second call pform->h is still 436, I end up with a window of
size 436-80=356).

_________________________________________________
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/