Submitted by Anonymous on Sat, 04/05/2003 - 00:12.
Hi,
I have a parent form with three other child forms laying on top of it.
the gui is set up so that form1 is at the very top and attached to the bottom of the title bar. form2 is attached to the bottom of form1. form3 is attached to the bottom of form2.
I want to hide form2 and then resize the window so that form1 and form3 are displayed. My problem is that when i reposition form3 so that is is attached to form1 it doesn`t stay. form3 will move it`s position so that it`s bordering form1 but then go back to it`s original position!
thanks in advance
Mon, 04/07/2003 - 19:21#1
ICS_support
Dynamically resizing window and repositioning widgets
That sounds reasonable. Are you unmanaging form2 and resetting two side attachments of form3 to form1 (primary and secondary)?
Mon, 04/07/2003 - 20:02#2
Anonymous
Dynamically resizing window and repositioning widgets
no i did not try that.
I did this-
XResizeWindow then
XtUnmanageChild form 2
then called XtMoveWidget on form 3.
i will try your way now
Mon, 04/07/2003 - 21:29#3
Anonymous
Dynamically resizing window and repositioning widgets
how do you set the attachments for a form?
Wed, 04/09/2003 - 19:58#4
ICS_support
Dynamically resizing window and repositioning widgets
1) you shouldn`t be using XResizeWindow directly. If you are using widgets, use the Xt interfaces set XtNwidth and XtNheight.
2) you shouldn`t be using XtMoveWidget directly. Set XtNx and XtNy.
There are many levels of interface in the whole Motif/X/Xt ball. You get problems if you use the wrong ones. Generally, use the highest-level interface available. That way, the software keeps in sync with lower-level libraries.
Wed, 04/09/2003 - 20:00#5
ICS_support
Dynamically resizing window and repositioning widgets
Sorry if I wasn`t clear. I meant that you should set the appropriate constraint resources on the children of the form in question (the parent form you wrote about in your first message).
Thu, 04/10/2003 - 13:21#6
Anonymous
Dynamically resizing window and repositioning widgets
I`ve taken out XResizeWindow and XtMoveWidget from my code.
But i`m still having problems. Nothing is resizing and nothing is moving.
i have a window with one main form(FO_lm) and two other child forms and then some pushbutton and labels(children to the forms).
In my application i have the following code
PB_xxx_XB()
{
XtUnmanagechild(FO_lm); //this is the main form on the window
XtUnmanagechild(FO_b);
XtUnmanagechild(FO_c);
XtVaSetValues(FO_lm,
XtNheight, 500,
NULL); //trying to resize window
XtVaSetValues(FO_c,
Thu, 04/10/2003 - 13:40#7
Anonymous
disregard previous message
I`ve taken out XResizeWindow and XtMoveWidget from my code.
But i`m still having problems. Nothing is resizing and nothing is moving.
i have a window with one main form(FO_lm) and two other child forms and then some pushbutton and labels(children to the forms).
Basically i`m trying to hide a form, get rid of it`s size and resize the window to it`s new size.
In my application i have the following code
PB_xxx_CB()
{
XtUnmanagechild(FO_lm); //this is the main form on the window
XtUnmanagechild(FO_b);
XtUnmanagechild(FO_c);
XtVaSetValues(FO_lm,
XtNheight, 500,
NULL); //trying to resize window
XtVaSetValues(FO_c,
XtNy, 470,
NULL); // trying to move up form
//remanage
XtManageChild(FO_lm);
//FO_b should not be seen //XtManageChild(FO_b);
XtManageChild(FO_c);
}
Fri, 04/11/2003 - 07:43#8
ICS_support
disregard previous message
Moving the children will have an effect only if their attachment type is XmATTACH_POSITION or XmATTACH_SELF.
But you typically wouldn`t use such direct-position attachments. Rather, it is better to use attachments that link widgets to widgets. In that way, the interface automatically adjusts as the children of the form change size -- or, more importantly, the initial display of the parent form is "correct" based on the preferred sizes of its children.
One other problem that you are running into here is a "catch-22" -- the managers depend on the size of their children to set their own size. One common problem is to have a series of forms with nothing inside that sets its own size -- and the entire stack collapses into a small area.
So I would expect to see that the children all, and always, have an XmNleftAttachment and XmNrightAttachment set to XmATTACH_FORM. Then, whatever widget you want to be displayed first would have an XmNtopAttachment of XmATTACH_FORM. And whatever is displayed last has an XmNbottomAttachment of XmATTACH_FORM. The others would have an XmtopAttachment of XmATTACH_WIDGET, naming the previous widget sibling. (This should solve getting them displayed -- getting them to resize exactly as you want is a different problem.)
Hi ,
My problem is similar to the one described here. I have a form1 with a form2, scroll window and row column inside form 1. form 2 has 5 sub forms aligned vertically. As a requirement in my application I am hiding last subform of form2 . So the form 2 is now visible with only 4 subforms without blank space after the 4th subform. The issue is the main form is still of same width as it is when form 2 has 5 subforms. I want the form 1 width to be reduced without the blank space when the 5th subform is hidden.
To be specific, say if width of form 2 and form 1 with 5 subforms is say 1200. when the 5th subform is hidden width of form 2 is 1010 but width of form1 is still 1200.
I am using a ,uil file generated from .xd file in Xdesigner. Please help like to shrink form1 in width based on the non availability of 5th subform .
Form1's size will depend on what knid of widget its parent is, and whether that parent will resize form1 based on form1's desired size..