sherman@sas.UUCP (Chris Sherman) (03/13/90)
I'm using motif widgets and I have a problem with the toggle button widget.
I use highlighting to show when the pointer enters the widget, and it works
for every widget (that I have checked) except for the toggle button widget.
Below, I have sample code that demonstrates the problem. You can compile it
with something that looks like the following:
cc -o test test.c -lXm -lXt -lX11
Am I doing something wrong? Do toggle buttons have a different behavior
than push buttons with relation to highlighting? Is this a bug?
Thanx,
Chris
Cut here:
----------------------------------------------------------------------
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <X11/Shell.h>
#include <Xm/RowColumn.h>
#include <Xm/PushB.h>
#include <Xm/ToggleB.h>
main(argc,argv)
int argc;
char **argv;
{
Widget toplevel, layout, button1, button2;
static char * buttonNames[] = {"push", "toggle"};
Arg wargs[10];
int n;
XtInitialize(argv[0], "Test", NULL, 0, &argc, argv);
/* use the shell widget so I can define keyboard focus policy */
n = 0;
XtSetArg(wargs[n], XmNkeyboardFocusPolicy, XmPOINTER); n++;
toplevel = XtCreateApplicationShell("toplevel",
applicationShellWidgetClass, wargs, n);
layout = XtCreateManagedWidget("layout",xmRowColumnWidgetClass,
toplevel, wargs, n);
/* setup for highlights */
n = 0;
XtSetArg(wargs[n], XmNhighlightOnEnter, True); n++;
XtSetArg(wargs[n], XmNhighlightThickness, (short) 5); n++;
XtSetArg(wargs[n], XmNindicatorOn, False); n++;
XtSetArg(wargs[n], XmNshadowThickness, 2); n++;
XtSetArg(wargs[n], XmNtraversalOn, True); n++;
button1 = XtCreateManagedWidget(buttonNames[0], xmPushButtonWidgetClass,
layout, wargs, n);
button2 = XtCreateManagedWidget(buttonNames[1], xmToggleButtonWidgetClass,
layout, wargs, n);
XtRealizeWidget(toplevel);
XtMainLoop();
}