I am not sure if this is the correct place to try to report a bug with this particular piece of software. If it is not maybe you could point me in the right direction. It seems that there is a bug with Motif that causes the Drawn Button widgets to lock up after a random number of buttons have been generated. Using the attached quick and dirty code fragment I can get the list of 100 Drawn Buttons in the button_rowcol widget to stop accepting/handling events after about 2 redraws. This is just a simple mock up to mimic what is going on in a real application that locks all Drawn Buttons after a seemingly random amount of time. Most annoying from a users perspective. The specific version of Motif is 2.1.10 from RedHat. Thankyou for your help. Regards, James Oliver #include <X11/Xlib.h> #include <X11/Xutil.h> #include <Xm/Xm.h> #include <Xm/MainW.h> #include <Xm/DrawnB.h> #include <Xm/RowColumn.h> #include <stdio.h> #define TABSPERWINDOW 10 #define NUM_BUTTONS 100 #define NUM_ROWS 10 // Global variables. Widget toplevel, top_rowcol, exit_rowcol, button_rowcol; Widget rowcols[NUM_ROWS]; Widget shell; Widget buttons[NUM_BUTTONS]; void my_callback(void *arg) { printf("Callback!\n"); } void exit_callback(void *arg) { printf("Exit!\n"); exit(0); } void create_buttons() { XmString str; int i,j; char name[100]; char buf[100]; for(j = 0; j < NUM_ROWS; j++) { sprintf(buf, "_rowcol%d", j); rowcols[j] = XtVaCreateManagedWidget(buf, xmRowColumnWidgetClass, button_rowcol, NULL); for(i = 0; i < NUM_BUTTONS/NUM_ROWS; i++) { sprintf(name, "Button %d", (i+j*10)); str = XmStringCreateLtoR(name, XmSTRING_DEFAULT_CHARSET); buttons[i+j*10] = XtVaCreateManagedWidget(name, xmDrawnButtonWidgetClass, rowcols[j], XmNmarginWidth, 0, XmNmarginHeight, 0, XmNlabelString, str, NULL); XtAddCallback(buttons[i+j*10], XmNactivateCallback, my_callback, NULL); } } } void next_callback(void *arg) { int i; for(i = 0; i < NUM_BUTTONS/NUM_ROWS; i++) XtDestroyWidget(button_rowcol); button_rowcol = XtVaCreateManagedWidget("button_rowcol", xmRowColumnWidgetClass, top_rowcol, XmNorientation, XmHORIZONTAL, NULL); create_buttons(); } int main(int argc, char **argv) { XtAppContext app; char name[100]; XmString str; XmString str1; Widget exit_button, next_button; toplevel = XtVaAppInitialize(&app, "DrawnButtonTest", NULL, 0, &argc, argv, NULL, NULL); top_rowcol = XtVaCreateManagedWidget("top_rowcol", xmRowColumnWidgetClass, toplevel, XmNorientation, XmHORIZONTAL, NULL); button_rowcol = XtVaCreateManagedWidget("button_rowcol", xmRowColumnWidgetClass, top_rowcol, XmNorientation, XmHORIZONTAL, NULL); exit_rowcol = XtVaCreateManagedWidget("exit_rowcol", xmRowColumnWidgetClass, top_rowcol, NULL); create_buttons(); sprintf(name, "Next.."); str1 = XmStringCreateLtoR(name, XmSTRING_DEFAULT_CHARSET); next_button = XtVaCreateManagedWidget(name, xmDrawnButtonWidgetClass, exit_rowcol, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNlabelString, str1, NULL); XtAddCallback(next_button, XmNactivateCallback, next_callback, NULL); sprintf(name, "Exit"); str = XmStringCreateLtoR(name, XmSTRING_DEFAULT_CHARSET); exit_button = XtVaCreateManagedWidget(name, xmDrawnButtonWidgetClass, exit_rowcol, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNlabelString, str, NULL); XtAddCallback(exit_button, XmNactivateCallback, exit_callback, NULL); XtRealizeWidget(toplevel); XtAppMainLoop(app); return 0; }
The Motif product from Red Hat is discontinued. In fact, in looking for evidence of it, I think we only shipped 2.0 and 2.0.1 - I don't see a 2.1.10 from Red Hat. For Motif information, I'd suggest http://www.lesstif.org/ http://www.opengroup.org/motif/