@begin(header)
author: ackerman@ics.uci.edu
show_author: ShowNone
author_organization: MIT
expiration_date: 07/03/93
last_modifier: ackerman@ics.uci.edu
last_mod_date: 07/03/91
mod_num: 1
@end(header)
@begin(Q)
Subject: Command Widget: changing the cursor

How do I change the cursor of a Command (or other) Widget?
WidgetSet (w, XtNcursor, cursor, ...) doesn't seem to work.
Is it possible at all?
@end(Q)

@begin(A)
From: Donna Converse
Subject: Re: Command Widget: changing the cursor 
Organization: X Consortium, MIT Laboratory for Computer Science
Date: Sat, 29 Jul 89 18:41:29 -0400

> How do I change the cursor of a Command (or other) Widget?

In order to allow the user to override your choice of cursor, specify
the cursor in an application defaults file.  For example, to set all
command widgets in the application class of Demo to use the gumby cursor,
put this in your app defaults file:

Demo*Command.cursor:	gumby

If you want to set the cursor in your code, you will insure that the
particular cursor you chose can never be changed by a user.
For an individual widget, such as a Command widget, 
the cursor can be set at creation time or later, using the resource
XtNcursor.  Here's some excerpted code as an example:

#include <X11/cursorfont.h>

	cursor = XCreateFontCursor(XtDisplay(widget), XC_gumby);
	XtSetArg(args[0], XtNcursor, cursor);
	XtCreateManagedWidget("button", commandWidgetClass, parent, args, ONE);
	
or, after the widget has been realized ...
	cursor = XCreateFontCursor(XtDisplay(widget), XC_gumby);
	XtSetArg(args[0], XtNcursor, cursor);
	XtSetValues(button, args, ONE);

In case you want to set the cursor of a popup window, use the Xlib
function XDefineCursor after the popup has been realized.


> WidgetSet (w, XtNcursor, cursor, ...) doesn't seem to work.

I don't know where this interface is defined, or what it is.
@end(A)

@begin(A)
Subject: Re: Command Widget: changing the cursor 
Date: Mon, 31 Jul 89 11:38:34 -0400
From: Chris D. Peterson 


Donna's reply on the semantics of setting the cursor is correct.  It should
be noted, however, that the widget must support the XtNcursor resource (or 
something like it) in order for the XtSetValues call to work.  You should
check the documentation on the widget set that you are using to see if the
widget that you are interested in has this particular resource.

If the widget does not have a cursor resource you can always use
XDefineCursor(), as Donna mentioned, but be sure that your widget is
realized or you will get an X protocol error.
@end(A)

@begin(M)
Date: Wed, 2 Aug 89 16:54:11 +0200
Subject: Re: Command Widget: changing the cursor (your help)


	"WidgetSet (widget, resource1, value1, resource2, value2, ..., NULL);" 
is from some long-ago posting of a toolset called XWidgetWrap.
This is a very neat replacement for XtSetArg etc., which I find rather
cumbersome.  
@end(M)

@begin(Q)
How does one change the cursor with a widget set that does not have an
XtNcursor field in any of the widgets?
@end(Q)

@begin(A)
You can use the X library call XDefineCursor(display, window, cursor)
to alter the cursor for a specific window associated with a widget.
@end(A)








