🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #38009

Highlighting under Motif widgets

#38009
From: Chris Sherman
Date: Tue, 13 Mar 1990 05:59
67 lines
2470 bytes
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();
}
Technical Details
Message-ID: <1607@sas.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!mcnc!rti!sas!sherman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!mcnc!rti!sas!sherman
From: sherman@sas.UUCP (Chris Sherman)
Newsgroups: comp.windows.x
Subject: Highlighting under Motif widgets
Summary: Toggle button highlighting has a problem
Message-ID: <1607@sas.UUCP>
Date: 13 Mar 90 05:59:36 GMT
Reply-To: sherman@sas.UUCP (Chris Sherman)
Organization: SAS Institute Inc, Cary NC
Lines: 67