tjhorton@vis.toronto.edu ("Timothy J. Horton") (05/16/91)
When the user hits a XmPushButton in my application, I put some text in a XmText window, warp the pointer to it, set the focus on it, and call: XmTextSetSelection(widget, (XmTextPosition)0, (XmTextPosition)strlen(newString), pushButtonEvent->time); ie. I want to start with everything selected. This is so that if the user starts typing, they'll just replace what is there. For this, I have XmNpendingDelete true. I am also careful to set the cursor to the edge of the selection. It doesn't work. But I've seen applications do this (or something like it). The text does get highlighted in the expected "selection" way, but if the user starts typing the selection is NOT replaced as it should be. But if I then select everything with the mouse, on the other hand, any typing does replace everything selected. Even more interesting, I am using XGrabKey to make certain keys "hotkeys" at the root window. When the user hits a hotkey, I do the same thing, putting text into a XmText widget and moving the pointer and focus to it, but sometimes the XmTextSetSelection causes a selection to appear, and sometimes it does not. Namely, it shows the selection with the usual highlight every second time if I hit the grabbed key fast enough, but the rest of the time it doesn't show the selection (and XmTextGetSelection returns NULL in these cases). I'm hoping this second problem has something to do with the "time" field in XmTextSetSelection call. The OSF documentation is useless for this. Thanks for any help. Tim