lindholm@greve.ucs.ubc.ca (George Lindholm) (07/20/90)
I have a form widget that contains two viewport widgets side-by-side. Below the viewport I have 3 command widgets that control the viewports. My question is, how do I position the the first one command widget so that its right edge is aligned with the right border of the first viewport, the second command widget so that it is centered in the form, and the third command widget so that its left side is aligned with the left side of the second viewport? I have tried adjusting both XtNx and XtNhorizDistance with no success. lindholm@staff.ucs.ubc.ca George_Lindholm@mtsg.ubc.ca USERGNL@UBCMTSG.BITNET University of British Columbia Computing Services (604) 228-4375
converse@EXPO.LCS.MIT.EDU (07/21/90)
> I have a form widget that contains two viewport widgets side-by-side. Below the > viewport I have 3 command widgets that control the viewports. My question is, > how do I position the the first one command widget so that its right edge is > aligned with the right border of the first viewport, the second command > widget so that it is centered in the form, and the third command widget so > that its left side is aligned with the left side of the second viewport? > > I have tried adjusting both XtNx and XtNhorizDistance with no success. It seems to me that you should be able to do this using the Constraint Resources documented in section 6.3.2. You need to use more of these constraint resources, such as fromHoriz, fromVert, left, right, as well as possibly horizDistance. The buttons of xcalc are all placed using constraint resources; it might be helpful to take a look at that. Donna Converse converse@expo.lcs.mit.edu
scott@graft.Berkeley.EDU (Scott Silvey) (07/21/90)
lindholm@greve.ucs.ubc.ca (George Lindholm) writes: |> I have a form widget that contains two viewport widgets side-by-side. Below the |> viewport I have 3 command widgets that control the viewports. My question is, |> how do I position the the first one command widget so that its right edge is |> aligned with the right border of the first viewport, the second command |> widget so that it is centered in the form, and the third command widget so |> that its left side is aligned with the left side of the second viewport? |> |> I have tried adjusting both XtNx and XtNhorizDistance with no success. |> |> |> lindholm@staff.ucs.ubc.ca George_Lindholm@mtsg.ubc.ca USERGNL@UBCMTSG.BITNET |> University of British Columbia Computing Services |> (604) 228-4375 #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Form.h> #include <X11/Xaw/Label.h> XtAppContext app_context; main(argc, argv) int argc; char *argv[]; { int n; Arg args[8]; Widget toplevel, form, view1, view2, but1, but2, but3; toplevel = XtAppInitialize(&app_context, "test", NULL, 0, &argc, argv, NULL, NULL, 0); form = XtCreateManagedWidget("form", formWidgetClass, toplevel, NULL, 0); n=0; XtSetArg(args[n], XtNtop, XtChainTop); n++; XtSetArg(args[n], XtNbottom, XtChainBottom);n++; XtSetArg(args[n], XtNheight, 100); n++; XtSetArg(args[n], XtNwidth, 100); n++; view1 = XtCreateManagedWidget("view1", labelWidgetClass, form, args, n); n=0; XtSetArg(args[n], XtNfromHoriz, view1); n++; XtSetArg(args[n], XtNtop, XtChainTop); n++; XtSetArg(args[n], XtNbottom, XtChainBottom);n++; XtSetArg(args[n], XtNheight, 100); n++; XtSetArg(args[n], XtNwidth, 100); n++; view2 = XtCreateManagedWidget("view2", labelWidgetClass, form, args, n); n=0; XtSetArg(args[n], XtNfromVert, view1); n++; XtSetArg(args[n], XtNtop, XtChainBottom); n++; XtSetArg(args[n], XtNbottom, XtChainBottom);n++; XtSetArg(args[n], XtNwidth, 65); n++; but1 = XtCreateManagedWidget("but1", labelWidgetClass, form, args, n); n=0; XtSetArg(args[n], XtNfromVert, view1); n++; XtSetArg(args[n], XtNfromHoriz, but1); n++; XtSetArg(args[n], XtNtop, XtChainBottom); n++; XtSetArg(args[n], XtNbottom, XtChainBottom);n++; XtSetArg(args[n], XtNwidth, 64); n++; but2 = XtCreateManagedWidget("but2", labelWidgetClass, form, args, n); n=0; XtSetArg(args[n], XtNfromVert, view1); n++; XtSetArg(args[n], XtNfromHoriz, but2); n++; XtSetArg(args[n], XtNtop, XtChainBottom); n++; XtSetArg(args[n], XtNbottom, XtChainBottom);n++; XtSetArg(args[n], XtNwidth, 65); n++; but2 = XtCreateManagedWidget("but2", labelWidgetClass, form, args, n); XtRealizeWidget(toplevel); XtAppMainLoop(app_context); }
lindholm@greve.ucs.ubc.ca (George Lindholm) (07/23/90)
In article <26394@pasteur.Berkeley.EDU>, scott@graft.Berkeley.EDU (Scott Silvey) writes: |> lindholm@greve.ucs.ubc.ca (George Lindholm) writes: |> |> I have a form widget that contains two viewport widgets side-by-side. |> Below the . . . (deleted) |> #include <X11/Intrinsic.h> |> #include <X11/StringDefs.h> |> #include <X11/Xaw/Form.h> |> #include <X11/Xaw/Label.h> . . . (deleted) Let me try again (I know I shouldn't have tried simplifying it). Given the following layout: +---------------------------------form---------------------------------+ | +------+ +------+ | | |Menu 1| |Menu 2| | | +------+ +------+ | | +----------viewport----------+-+ +-+ +-+---------viewport----------+ | | | |S| |S| |S| | | | | |c| |c| |c| | | | | |r| |r| |r| | | | | |o| |o| |o| | | | | |l| |l| |l| | | | | |l| |l| |l| | | | | |b| |b| |b| | | | | |a| |a| |a| | | | | |r| |r| |r| | | | | |1| |2| |3| | | | +----------------------------+-+ +-+ +-+---------------------------+ | | |viewport scrollbar | | viewport scrollbar | | | +----------------------------+ +---------------------------+ | | +-------++-------++-------+ | | |Button1||Button2||Button3| | | +-------++-------++-------+ | +----------------------------------------------------------------------+ How do I put the following constraints on the widgets during resizing?: 1) Keep the vertical scrollbars from changing their width while still allowing them to become taller or shorter? 2) Keep the menu widgets and button (command) widgets in their relative positions without changing their size? I can do most of it by using three form widgets inside the outer form widget (plus XtMoveWidget). This would take care of the menus and Button1 and Button3 but I still can't prevent scrollbar2 and button2 from growing/shrinking as the window is resized. If I use XtResizeWidget on scrollbar2, is there any way to get the form widget to move the other widgets around based on the new size without changing scrollbar2 behind my back? lindholm@staff.ucs.ubc.ca George_Lindholm@mtsg.ubc.ca USERGNL@UBCMTSG.BITNET University of British Columbia Computing Services (604) 228-4375