Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!gatech!utkcs2!alphard!battle From: battle@alphard.cs.utk.edu (David Battle) Newsgroups: comp.windows.x Subject: Re: Automatic relayout/resize of Athena Form Widget Summary: try this program Keywords: athena form widget Message-ID: <889@utkcs2.cs.utk.edu> Date: 19 May 89 17:50:29 GMT References: <885@utkcs2.cs.utk.edu> Sender: sysmgr@utkcs2.cs.utk.edu Reply-To: battle@utkcs2.cs.utk.edu (David Battle) Organization: CS Dept -- University of TN, Knoxville Lines: 84 In article <885@utkcs2.cs.utk.edu> I wrote: >Now comes the problem. When I delete one of the subordinate ... widgets >with XtDestroyWidget, the parent form widget resizes itself smaller. This >is to be expected, I suppose, except that it seems to over do it. It then >proceeds to reduce the ... size of each of the remaining subordinate >... widgets. This continues happening each time I destroy a subordinate >... widget until some minimum ... size for each sub[widget] is aparently >reached. At this point, it is impossible to read the text inside the ... >widgets because they are so [small]. (Some adjectives which don't apply in the general case were removed. ) Here is a program which illustrates the problem I described in my previous article. Just compile with the command: cc -o resize resize.c -lXaw -lXmu -lXt -lX11 I can't imagine the behavior this program exhibits being "correct". (The viewport widget and it's contents shrink away to nothing.) Try it, I think you will find it very frustrating. You will get different results by pressing the buttons in a different order. Once again, can anyone shed any light on this problem? -David L. Battle battle@utkcs2.cs.utk.edu battle@esddlb.esd.ornl.gov #include #include #include #include #include #include #include #define TEN 10 void DeleteMe(w, client_data, call_data) Widget w; caddr_t client_data, call_data; { static int count = 0; XtDestroyWidget(w); count++; if(count >= TEN) exit(1); } main(argc,argv) char **argv; { Widget toplevel, box, view, form, commands[TEN]; int i; static Arg view_args[] = { { XtNallowVert, (XtArgVal) True }, { XtNheight, (XtArgVal)50 }, { XtNwidth, (XtArgVal)150 }, }; static XtCallbackRec callbacks[] = { { DeleteMe, NULL }, { NULL, NULL }, }; static Arg command_args[] = { { XtNfromVert, (XtArgVal) NULL }, { XtNcallback, (XtArgVal)callbacks }, }; toplevel=XtInitialize("resize","Resize", 0, 0, &argc, argv); box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, 0, 0); view = XtCreateManagedWidget("view", viewportWidgetClass, box, view_args, XtNumber(view_args)); form = XtCreateManagedWidget("form", formWidgetClass, view, 0, 0); for(i = 0; i < TEN; i++) { commands[i] = XtCreateManagedWidget("Delete",commandWidgetClass,form, command_args, XtNumber(command_args)); command_args[0].value = (XtArgVal)commands[i]; } XtRealizeWidget(toplevel); XtMainLoop(); }