Path: utzoo!utgpu!news-server.csri.toronto.edu!orasis.vis.toronto.edu!tjhorton Newsgroups: comp.windows.x.motif From: tjhorton@vis.toronto.edu ("Timothy J. Horton") Subject: Re: Cursors and buttons...... Message-ID: <91Jan27.011852est.8705@orasis.vis.toronto.edu> Organization: Department of Computer Science, University of Toronto References: Distribution: inet Date: 27 Jan 91 06:19:08 GMT Lines: 38 About how to use different cursors for different areas of a screen... dow@PRESTO.IG.COM (Christopher Dow) writes: >When the mouse is over the editing area, I set the cursor to be an >i-beam. When it's not I set the cursor to be an arrow. The only >problem is, that I don't get informed when the mouse moves over the >scroll bars or the button, so if it moves from the editing area to the >scroll bars, it stays an i-beam, which looks kind of silly. Is there >any way to set the cursor for the button & scroll bar widgets? From >reading the documentation, it doesn't look like XmNarmCallback, >XmNactivate Callback, or XmNdisarmCallback will do this for me. Also, I >can't see where there is a resource for a PushButton or ScrollBar widget >that sets the cursor. Way way down in Xlib, where widgets never go and only windows live, you can specify a cursor for each window. Whenever the cursor is in the window, the cursor pixmap is swapped to the specific window's cursor without any interaction with your program (unless you solicit such interaction, but that's another matter). If you override the cursor for a widget's window, you are doing something that is not strictly proper, but if the widget provides no facilities to set the cursor, you have no other option. (In the case of your widgetless "text window", though, you wouldn't be doing anything improper anyways, seeing as widgets are uninvolved). The code (as near as I remember -- not near books now) is something like #include XDefineCursor(display, window, cursor); Where cursor is something like XC_watch (as defined in cursorfont.h) or something of your own invention. To do this to a widget's window, window can be acquired from a widget by XtWindow(widget), after the widget has been realized (or else the window id is zero, since it has not been created yet!).