Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 4 of 9)
Section - 98) How can I select all of the text in a widget programmatically?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Property taxes ]


Top Document: Motif FAQ (Part 4 of 9)
Previous Document: 97) How can I highlight text in the Text widget?
Next Document: 99) Can I customize the pointer cursor or insert position indicator
See reader questions & answers on this topic! - Help others by sharing your knowledge
So that some initial text is displayed, but anything typed replaces it.
[Last modified: July 95]

Answer: XmTextSetSelection(Text1, 0, XmTextGetLastPosition(Text1), event-
>xbutton.time);

where Text1 is the widget in question (obviously) and event is some event that
triggered this call.  You can use XtLastTimestampProcessed( display) instead
of xbutton.time if you don't happen to have an event pointer handy.

Jon A. Christopher (jac8792@tam2000.tamu.edu) writes:

I have had difficulty getting this to work as described (even though it agrees
with the documentation).  I believe that it may be because I usually change
the TextField to some value and then try to select it.  I haven't looked at
the internals of the TextField widget, but it must only select the text if the
text hasn't changed since the time specified.  Ususally the
"LastTimestampProcessed" will be be *before* you modify the text, and the
selection is therefore ignored.  I'd suggest using the CurrentTime variable.
This is an X variable which, if used will make sure that your text is always
selected.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Motif FAQ (Part 4 of 9)
Previous Document: 97) How can I highlight text in the Text widget?
Next Document: 99) Can I customize the pointer cursor or insert position indicator

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM