TextFuncs.xml revision 994689c1
1994689c1Smrg<sect1 id="Text_Functions">
2994689c1Smrg<title>Text Functions</title>
3994689c1Smrg<!-- .XS -->
4994689c1Smrg<!-- 	Text Functions -->
5994689c1Smrg<!-- .XE -->
6994689c1Smrg<para>
7994689c1Smrg<!-- .LP -->
8994689c1SmrgThe following functions are provided as convenience routines for use with
9994689c1Smrgthe Text widget.  Although many of these actions can be performed by
10994689c1Smrgmodifying resources, these interfaces are frequently more efficient.
11994689c1Smrg</para>
12994689c1Smrg<para>
13994689c1Smrg<!-- .LP -->
14994689c1SmrgThese data structures are defined in the Text widget's public header file,
15994689c1Smrg&lt;X11/Xaw/Text.h&gt;.
16994689c1Smrg</para>
17994689c1Smrg<para>
18994689c1Smrg<!-- .LP -->
19994689c1Smrg<!-- .IN "XawTextPosition" "" "@DEF@" -->
20994689c1Smrgtypedef long XawTextPosition;
21994689c1Smrg<!-- .sp -->
22994689c1Smrg</para>
23994689c1Smrg<para>
24994689c1Smrg<!-- .LP -->
25994689c1SmrgCharacter positions in the Text widget begin at 0 and end at n, where
26994689c1Smrgn is the number of characters in the Text source widget.
27994689c1Smrg</para>
28994689c1Smrg<para>
29994689c1Smrg<!-- .LP -->
30994689c1Smrg<!-- .IN "XawTextBlock" "" "@DEF@" -->
31994689c1Smrg<literallayout class="monospaced">
32994689c1Smrg<!-- .TA .5i 1.5i 2.25i -->
33994689c1Smrg<!-- .ta .5i 1.5i 2.25i -->
34994689c1Smrgtypedef struct {
35994689c1Smrg	int <emphasis remap='I'>firstPos</emphasis>;
36994689c1Smrg	int <emphasis remap='I'>length</emphasis>;
37994689c1Smrg	char *<emphasis remap='I'>ptr</emphasis>;
38994689c1Smrg	unsigned long <emphasis remap='I'>format</emphasis>;
39994689c1Smrg} XawTextBlock, *XawTextBlockPtr;
40994689c1Smrg</literallayout>
41994689c1Smrg</para>
42994689c1Smrg<para>
43994689c1Smrg<!-- .LP -->
44994689c1Smrg<!-- .IN "XawTextBlockPtr" "" -->
45994689c1Smrg<variablelist>
46994689c1Smrg  <varlistentry>
47994689c1Smrg    <term>
48994689c1Smrg      <emphasis remap='I'>firstPos</emphasis>
49994689c1Smrg    </term>
50994689c1Smrg    <listitem>
51994689c1Smrg      <para>
52994689c1SmrgThe first position, or index, to use within the <emphasis remap='I'>ptr</emphasis> field.
53994689c1SmrgThe value is commonly zero.
54994689c1Smrg      </para>
55994689c1Smrg    </listitem>
56994689c1Smrg  </varlistentry>
57994689c1Smrg  <varlistentry>
58994689c1Smrg    <term>
59994689c1Smrg      <emphasis remap='I'>length</emphasis>
60994689c1Smrg    </term>
61994689c1Smrg    <listitem>
62994689c1Smrg      <para>
63994689c1SmrgThe number of characters to be used from the <emphasis remap='I'>ptr</emphasis> field.
64994689c1SmrgThe number of characters used is commonly the number of characters
65994689c1Smrgin <emphasis remap='I'>ptr</emphasis>, and must not be greater than the length of the string
66994689c1Smrgin <emphasis remap='I'>ptr</emphasis>.
67994689c1Smrg      </para>
68994689c1Smrg    </listitem>
69994689c1Smrg  </varlistentry>
70994689c1Smrg  <varlistentry>
71994689c1Smrg    <term>
72994689c1Smrg      <emphasis remap='I'>ptr</emphasis>
73994689c1Smrg    </term>
74994689c1Smrg    <listitem>
75994689c1Smrg      <para>
76994689c1SmrgContains the string to be referenced by the Text widget.
77994689c1Smrg      </para>
78994689c1Smrg    </listitem>
79994689c1Smrg  </varlistentry>
80994689c1Smrg  <varlistentry>
81994689c1Smrg    <term>
82994689c1Smrg      <emphasis remap='I'>format</emphasis>
83994689c1Smrg    </term>
84994689c1Smrg    <listitem>
85994689c1Smrg      <para>
86994689c1SmrgThis flag indicates whether the data pointed to by <function>ptr</function> is char
87994689c1Smrgor wchar_t.  When the associated widget has <function>international</function> set
88994689c1Smrgto <function>false</function> this field must be XawFmt8Bit.  When the associated
89994689c1Smrgwidget has <function>international</function> set to <function>true</function> this field must be
90994689c1Smrgeither XawFmt8Bit or XawFmtWide.
91994689c1Smrg    </para>
92994689c1Smrg  </listitem>
93994689c1Smrg  </varlistentry>
94994689c1Smrg</variablelist>
95994689c1Smrg</para>
96994689c1Smrg<note>
97994689c1Smrg<para>
98994689c1Smrg<!-- .LP -->
99994689c1SmrgNote: Previous versions of Xaw used
100994689c1Smrg<function>FMT8BIT ,</function>
101994689c1Smrgwhich has been retained for backwards compatibility. <function>FMT8BIT</function> is
102994689c1Smrgdeprecated and will eventually be removed from the implementation.
103994689c1Smrg</para>
104994689c1Smrg</note>
105994689c1Smrg<sect2 id="Selecting_Text">
106994689c1Smrg<title>Selecting Text</title>
107994689c1Smrg<para>
108994689c1Smrg<!-- .LP -->
109994689c1SmrgTo select a piece of text, use
110994689c1Smrg<function>XawTextSetSelection : </function>
111994689c1Smrg<!-- .IN "XawTextSetSelection" "" "@DEF@" -->
112994689c1Smrg<funcsynopsis>
113994689c1Smrg<funcprototype>
114994689c1Smrg  <funcdef>void<function> XawTextSetSelection</function></funcdef>
115994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
116994689c1Smrg  <paramdef>XawTextPositionleft,<parameter> right</parameter></paramdef>
117994689c1Smrg</funcprototype>
118994689c1Smrg</funcsynopsis>
119994689c1Smrg<!-- .FN -->
120994689c1Smrg<variablelist>
121994689c1Smrg  <varlistentry>
122994689c1Smrg    <term>
123994689c1Smrg      <emphasis remap='I'>w</emphasis>
124994689c1Smrg    </term>
125994689c1Smrg    <listitem>
126994689c1Smrg      <para>
127994689c1SmrgSpecifies the Text widget.
128994689c1Smrg      </para>
129994689c1Smrg    </listitem>
130994689c1Smrg  </varlistentry>
131994689c1Smrg  <varlistentry>
132994689c1Smrg    <term>
133994689c1Smrg      <emphasis remap='I'>left</emphasis>
134994689c1Smrg    </term>
135994689c1Smrg    <listitem>
136994689c1Smrg      <para>
137994689c1SmrgSpecifies the character position at which the selection begins.
138994689c1Smrg      </para>
139994689c1Smrg    </listitem>
140994689c1Smrg  </varlistentry>
141994689c1Smrg  <varlistentry>
142994689c1Smrg    <term>
143994689c1Smrg      <emphasis remap='I'>right</emphasis>
144994689c1Smrg    </term>
145994689c1Smrg    <listitem>
146994689c1Smrg      <para>
147994689c1SmrgSpecifies the character position at which the selection ends.
148994689c1Smrg    </para>
149994689c1Smrg  </listitem>
150994689c1Smrg  </varlistentry>
151994689c1Smrg</variablelist>
152994689c1Smrg</para>
153994689c1Smrg<para>
154994689c1Smrg<!-- .LP -->
155994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>.  <!-- xref --> 
156994689c1SmrgIf redisplay is enabled, this function highlights the text and
157994689c1Smrgmakes it the <function>PRIMARY</function> selection.  This function does not have any
158994689c1Smrgeffect on <function>CUT_BUFFER0</function>.
159994689c1Smrg</para>
160994689c1Smrg<para>
161994689c1Smrg<!-- .LP -->
162994689c1Smrg</para>
163994689c1Smrg</sect2>
164994689c1Smrg<sect2 id="Unhighlighting_Text">
165994689c1Smrg<title>Unhighlighting Text</title>
166994689c1Smrg<para>
167994689c1Smrg<!-- .LP -->
168994689c1SmrgTo unhighlight previously highlighted text in a widget, use
169994689c1Smrg<function>XawTextUnsetSelection</function>:
170994689c1Smrg<!-- .IN "XawTextUnsetSelection" "" "@DEF@" -->
171994689c1Smrg<funcsynopsis>
172994689c1Smrg<funcprototype>
173994689c1Smrg  <funcdef>void<function> XawTextUnsetSelection</function></funcdef>
174994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
175994689c1Smrg</funcprototype>
176994689c1Smrg</funcsynopsis>
177994689c1Smrg<!-- .FN -->
178994689c1Smrg<variablelist>
179994689c1Smrg  <varlistentry>
180994689c1Smrg    <term>
181994689c1Smrg      <emphasis remap='I'>w</emphasis>
182994689c1Smrg    </term>
183994689c1Smrg    <listitem>
184994689c1Smrg      <para>
185994689c1SmrgSpecifies the Text widget.
186994689c1Smrg    </para>
187994689c1Smrg  </listitem>
188994689c1Smrg  </varlistentry>
189994689c1Smrg</variablelist>
190994689c1Smrg</para>
191994689c1Smrg</sect2>
192994689c1Smrg<sect2 id="Getting_Current_Text_Selection">
193994689c1Smrg<title>Getting Current Text Selection</title>
194994689c1Smrg<para>
195994689c1Smrg<!-- .LP -->
196994689c1SmrgTo retrieve the text that has been selected by this
197994689c1Smrgtext widget use <function>XawTextGetSelectionPos</function>:
198994689c1Smrg<!-- .IN "XawTextGetSelectionPos" "" "@DEF@" -->
199994689c1Smrg<funcsynopsis>
200994689c1Smrg<funcprototype>
201994689c1Smrg  <funcdef>void<function> XawTextGetSelectionPos</function></funcdef>
202994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
203994689c1Smrg  <paramdef>XawTextPosition*begin_return,<parameter> *end_return</parameter></paramdef>
204994689c1Smrg</funcprototype>
205994689c1Smrg</funcsynopsis>
206994689c1Smrg<!-- .FN -->
207994689c1Smrg<variablelist>
208994689c1Smrg  <varlistentry>
209994689c1Smrg    <term>
210994689c1Smrg      <emphasis remap='I'>w</emphasis>
211994689c1Smrg    </term>
212994689c1Smrg    <listitem>
213994689c1Smrg      <para>
214994689c1SmrgSpecifies the Text widget.
215994689c1Smrg      </para>
216994689c1Smrg    </listitem>
217994689c1Smrg  </varlistentry>
218994689c1Smrg  <varlistentry>
219994689c1Smrg    <term>
220994689c1Smrg      <emphasis remap='I'>begin_return</emphasis>
221994689c1Smrg    </term>
222994689c1Smrg    <listitem>
223994689c1Smrg      <para>
224994689c1SmrgReturns the beginning of the text selection.
225994689c1Smrg      </para>
226994689c1Smrg    </listitem>
227994689c1Smrg  </varlistentry>
228994689c1Smrg  <varlistentry>
229994689c1Smrg    <term>
230994689c1Smrg      <emphasis remap='I'>end_return</emphasis>
231994689c1Smrg    </term>
232994689c1Smrg    <listitem>
233994689c1Smrg      <para>
234994689c1SmrgReturns the end of the text selection.
235994689c1Smrg    </para>
236994689c1Smrg  </listitem>
237994689c1Smrg  </varlistentry>
238994689c1Smrg</variablelist>
239994689c1Smrg</para>
240994689c1Smrg<para>
241994689c1Smrg<!-- .LP -->
242994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>. <!-- xref --> 
243994689c1SmrgIf the returned values are equal, no text is currently selected.
244994689c1Smrg</para>
245994689c1Smrg</sect2>
246994689c1Smrg<sect2 id="Replacing_Text">
247994689c1Smrg<title>Replacing Text</title>
248994689c1Smrg<para>
249994689c1Smrg<!-- .LP -->
250994689c1SmrgTo modify the text in an editable Text widget use <function>XawTextReplace</function>:
251994689c1Smrg<!-- .IN "XawTextReplace" "" "@DEF@" -->
252994689c1Smrg<funcsynopsis>
253994689c1Smrg<funcprototype>
254994689c1Smrg  <funcdef>int<function> XawTextReplace</function></funcdef>
255994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
256994689c1Smrg  <paramdef>XawTextPositionstart,<parameter> end</parameter></paramdef>
257994689c1Smrg  <paramdef>XawTextBlock<parameter> *text</parameter></paramdef>
258994689c1Smrg</funcprototype>
259994689c1Smrg</funcsynopsis>
260994689c1Smrg<!-- .FN -->
261994689c1Smrg<variablelist>
262994689c1Smrg  <varlistentry>
263994689c1Smrg    <term>
264994689c1Smrg      <emphasis remap='I'>w</emphasis>
265994689c1Smrg    </term>
266994689c1Smrg    <listitem>
267994689c1Smrg      <para>
268994689c1SmrgSpecifies the Text widget.
269994689c1Smrg      </para>
270994689c1Smrg    </listitem>
271994689c1Smrg  </varlistentry>
272994689c1Smrg  <varlistentry>
273994689c1Smrg    <term>
274994689c1Smrg      <emphasis remap='I'>start</emphasis>
275994689c1Smrg    </term>
276994689c1Smrg    <listitem>
277994689c1Smrg      <para>
278994689c1SmrgSpecifies the starting character position of the text replacement.
279994689c1Smrg      </para>
280994689c1Smrg    </listitem>
281994689c1Smrg  </varlistentry>
282994689c1Smrg  <varlistentry>
283994689c1Smrg    <term>
284994689c1Smrg      <emphasis remap='I'>end</emphasis>
285994689c1Smrg    </term>
286994689c1Smrg    <listitem>
287994689c1Smrg      <para>
288994689c1SmrgSpecifies the ending character position of the text replacement.
289994689c1Smrg      </para>
290994689c1Smrg    </listitem>
291994689c1Smrg  </varlistentry>
292994689c1Smrg  <varlistentry>
293994689c1Smrg    <term>
294994689c1Smrg      <emphasis remap='I'>text</emphasis>
295994689c1Smrg    </term>
296994689c1Smrg    <listitem>
297994689c1Smrg      <para>
298994689c1SmrgSpecifies the text to be inserted into the file.
299994689c1Smrg    </para>
300994689c1Smrg  </listitem>
301994689c1Smrg  </varlistentry>
302994689c1Smrg</variablelist>
303994689c1Smrg</para>
304994689c1Smrg<para>
305994689c1Smrg<!-- .LP -->
306994689c1SmrgThis function will not
307994689c1Smrgbe able to replace text in read-only text widgets.  It will also only
308994689c1Smrgbe able to append text to an append-only text widget.
309994689c1Smrg</para>
310994689c1Smrg<para>
311994689c1Smrg<!-- .LP -->
312994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function> and <!-- xref -->
313994689c1Smrg<function>XawTextBlock</function>.
314994689c1Smrg</para>
315994689c1Smrg<para>
316994689c1Smrg<!-- .LP -->
317994689c1SmrgThis function may return the following values:
318994689c1Smrg<variablelist>
319994689c1Smrg  <varlistentry>
320994689c1Smrg    <term>
321994689c1Smrg      <function>XawEditDone</function>
322994689c1Smrg    </term>
323994689c1Smrg    <listitem>
324994689c1Smrg      <para>
325994689c1Smrg<!-- .IN "XawEditDone" "" -->
326994689c1SmrgThe text replacement was successful.
327994689c1Smrg      </para>
328994689c1Smrg    </listitem>
329994689c1Smrg  </varlistentry>
330994689c1Smrg  <varlistentry>
331994689c1Smrg    <term>
332994689c1Smrg      <function>XawPositionError</function>
333994689c1Smrg    </term>
334994689c1Smrg    <listitem>
335994689c1Smrg      <para>
336994689c1Smrg<!-- .IN "XawPositionError" "" -->
337994689c1SmrgThe edit mode is <function>XawtextAppend</function> and <function>start</function> is not the position of
338994689c1Smrgthe last character of the source.
339994689c1Smrg      </para>
340994689c1Smrg    </listitem>
341994689c1Smrg  </varlistentry>
342994689c1Smrg  <varlistentry>
343994689c1Smrg    <term>
344994689c1Smrg      <function>XawEditError</function>
345994689c1Smrg    </term>
346994689c1Smrg    <listitem>
347994689c1Smrg      <para>
348994689c1Smrg<!-- .IN "XawEditError" "" -->
349994689c1SmrgEither the Source was read-only or the range to be deleted is larger
350994689c1Smrgthan the length of the Source.
351994689c1Smrg
352994689c1Smrg    </para>
353994689c1Smrg  </listitem>
354994689c1Smrg  </varlistentry>
355994689c1Smrg</variablelist>
356994689c1Smrg</para>
357994689c1Smrg<para>
358994689c1Smrg<!-- .LP -->
359994689c1SmrgThe <function>XawTextReplace</function> arguments <function>start</function> and
360994689c1Smrg<emphasis remap='I'>end</emphasis> represent the text source character positions for the
361994689c1Smrgexisting text that is to be replaced by the text in the text block.
362994689c1SmrgThe characters from <emphasis remap='I'>start</emphasis> up to
363994689c1Smrgbut not including <emphasis remap='I'>end</emphasis> are deleted, and the characters
364994689c1Smrgspecified on the text block are inserted in their place.  If
365994689c1Smrg<emphasis remap='I'>start</emphasis> and <emphasis remap='I'>end</emphasis> are equal, no text is deleted and the new
366994689c1Smrgtext is inserted after <emphasis remap='I'>start</emphasis>.
367994689c1Smrg</para>
368994689c1Smrg</sect2>
369994689c1Smrg<sect2 id="Searching_for_Text">
370994689c1Smrg<title>Searching for Text</title>
371994689c1Smrg<para>
372994689c1Smrg<!-- .LP -->
373994689c1SmrgTo search for a string in the Text widget, use
374994689c1Smrg<function>XawTextSearch</function>:
375994689c1Smrg<!-- .IN "XawTextSearch" "" "@DEF@" -->
376994689c1Smrg<funcsynopsis>
377994689c1Smrg<funcprototype>
378994689c1Smrg  <funcdef>XawTextPosition<function> XawTextSearch</function></funcdef>
379994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
380994689c1Smrg  <paramdef>XawTextScanDirection<parameter> dir</parameter></paramdef>
381994689c1Smrg  <paramdef>XawTextBlock*<parameter> text</parameter></paramdef>
382994689c1Smrg</funcprototype>
383994689c1Smrg</funcsynopsis>
384994689c1Smrg<!-- .FN -->
385994689c1Smrg<variablelist>
386994689c1Smrg  <varlistentry>
387994689c1Smrg    <term>
388994689c1Smrg      <emphasis remap='I'>w</emphasis>
389994689c1Smrg    </term>
390994689c1Smrg    <listitem>
391994689c1Smrg      <para>
392994689c1SmrgSpecifies the Text widget.
393994689c1Smrg      </para>
394994689c1Smrg    </listitem>
395994689c1Smrg  </varlistentry>
396994689c1Smrg  <varlistentry>
397994689c1Smrg    <term>
398994689c1Smrg      <emphasis remap='I'>dir</emphasis>
399994689c1Smrg    </term>
400994689c1Smrg    <listitem>
401994689c1Smrg      <para>
402994689c1SmrgSpecifies the direction to search in.  Legal values are
403994689c1Smrg<function>XawsdLeft</function> and <function>XawsdRight</function>.
404994689c1Smrg      </para>
405994689c1Smrg    </listitem>
406994689c1Smrg  </varlistentry>
407994689c1Smrg  <varlistentry>
408994689c1Smrg    <term>
409994689c1Smrg      <emphasis remap='I'>text</emphasis>
410994689c1Smrg    </term>
411994689c1Smrg    <listitem>
412994689c1Smrg      <para>
413994689c1SmrgSpecifies a text block structure that contains the text to search for.
414994689c1Smrg    </para>
415994689c1Smrg  </listitem>
416994689c1Smrg  </varlistentry>
417994689c1Smrg</variablelist>
418994689c1Smrg</para>
419994689c1Smrg<para>
420994689c1Smrg<!-- .LP -->
421994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function> and <function>XawTextBlock</function>. <!-- xref -->
422994689c1SmrgThe <function>XawTextSearch</function> function will begin at the insertion point
423994689c1Smrgand search in the
424994689c1Smrgdirection specified for a string that matches the one passed in
425994689c1Smrg<emphasis remap='I'>text</emphasis>.  If the string is found the location of the first
426994689c1Smrgcharacter in the string is returned.  If the string could not be
427994689c1Smrgfound then the value <function>XawTextSearchError</function> is returned.
428994689c1Smrg</para>
429994689c1Smrg</sect2>
430994689c1Smrg<sect2 id="Redisplaying_Text">
431994689c1Smrg<title>Redisplaying Text</title>
432994689c1Smrg<para>
433994689c1Smrg<!-- .LP -->
434994689c1SmrgTo redisplay a range of characters, use <function>XawTextInvalidate</function>:
435994689c1Smrg<!-- .IN "XawTextInvalidate" "" "@DEF@" -->
436994689c1Smrg<funcsynopsis>
437994689c1Smrg<funcprototype>
438994689c1Smrg  <funcdef>void<function> XawTextInvalidate</function></funcdef>
439994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
440994689c1Smrg  <paramdef>XawTextPositionfrom,<parameter> to</parameter></paramdef>
441994689c1Smrg</funcprototype>
442994689c1Smrg</funcsynopsis>
443994689c1Smrg<!-- .FN -->
444994689c1Smrg<variablelist>
445994689c1Smrg  <varlistentry>
446994689c1Smrg    <term>
447994689c1Smrg      <emphasis remap='I'>w</emphasis>
448994689c1Smrg    </term>
449994689c1Smrg    <listitem>
450994689c1Smrg      <para>
451994689c1SmrgSpecifies the Text widget.
452994689c1Smrg      </para>
453994689c1Smrg    </listitem>
454994689c1Smrg  </varlistentry>
455994689c1Smrg  <varlistentry>
456994689c1Smrg    <term>
457994689c1Smrg      <emphasis remap='I'>from</emphasis>
458994689c1Smrg    </term>
459994689c1Smrg    <listitem>
460994689c1Smrg      <para>
461994689c1SmrgSpecifies the start of the text to redisplay.
462994689c1Smrg      </para>
463994689c1Smrg    </listitem>
464994689c1Smrg  </varlistentry>
465994689c1Smrg  <varlistentry>
466994689c1Smrg    <term>
467994689c1Smrg      <emphasis remap='I'>to</emphasis>
468994689c1Smrg    </term>
469994689c1Smrg    <listitem>
470994689c1Smrg      <para>
471994689c1SmrgSpecifies the end of the text to redisplay.
472994689c1Smrg    </para>
473994689c1Smrg  </listitem>
474994689c1Smrg  </varlistentry>
475994689c1Smrg</variablelist>
476994689c1Smrg</para>
477994689c1Smrg<para>
478994689c1Smrg<!-- .LP -->
479994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>. <!-- xref -->
480994689c1SmrgThe <function>XawTextInvalidate</function>
481994689c1Smrgfunction causes the specified range of characters to be redisplayed
482994689c1Smrgimmediately if redisplay is enabled or the next time that redisplay is
483994689c1Smrgenabled.
484994689c1Smrg</para>
485994689c1Smrg<para>
486994689c1Smrg<!-- .LP -->
487994689c1Smrg<!-- .sp 1 -->
488994689c1SmrgTo enable redisplay, use <function>XawTextEnableRedisplay</function>:
489994689c1Smrg<!-- .IN "XawTextEnableRedisplay" "" "@DEF@" -->
490994689c1Smrg<funcsynopsis>
491994689c1Smrg<funcprototype>
492994689c1Smrg  <funcdef>void<function> XawTextEnableRedisplay</function></funcdef>
493994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
494994689c1Smrg</funcprototype>
495994689c1Smrg</funcsynopsis>
496994689c1Smrg<!-- .FN -->
497994689c1Smrg<variablelist>
498994689c1Smrg  <varlistentry>
499994689c1Smrg    <term>
500994689c1Smrg      <emphasis remap='I'>w</emphasis>
501994689c1Smrg    </term>
502994689c1Smrg    <listitem>
503994689c1Smrg      <para>
504994689c1SmrgSpecifies the Text widget.
505994689c1Smrg    </para>
506994689c1Smrg  </listitem>
507994689c1Smrg  </varlistentry>
508994689c1Smrg</variablelist>
509994689c1Smrg</para>
510994689c1Smrg<para>
511994689c1Smrg<!-- .LP -->
512994689c1SmrgThe <function>XawTextEnableRedisplay</function> function flushes any changes due to
513994689c1Smrgbatched updates when <function>XawTextDisableRedisplay</function>
514994689c1Smrgwas called and allows future changes to be reflected immediately.
515994689c1Smrg</para>
516994689c1Smrg<para>
517994689c1Smrg<!-- .LP -->
518994689c1Smrg<!-- .sp 1 -->
519994689c1SmrgTo disable redisplay while making several changes, use
520994689c1Smrg<function>XawTextDisableRedisplay</function>.
521994689c1Smrg<!-- .IN "XawTextDisableRedisplay" "" "@DEF@" -->
522994689c1Smrg<funcsynopsis>
523994689c1Smrg<funcprototype>
524994689c1Smrg  <funcdef>void<function> XawTextDisableRedisplay</function></funcdef>
525994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
526994689c1Smrg</funcprototype>
527994689c1Smrg</funcsynopsis>
528994689c1Smrg<!-- .FN -->
529994689c1Smrg<variablelist>
530994689c1Smrg  <varlistentry>
531994689c1Smrg    <term>
532994689c1Smrg      <emphasis remap='I'>w</emphasis>
533994689c1Smrg    </term>
534994689c1Smrg    <listitem>
535994689c1Smrg      <para>
536994689c1SmrgSpecifies the Text widget.
537994689c1Smrg    </para>
538994689c1Smrg  </listitem>
539994689c1Smrg  </varlistentry>
540994689c1Smrg</variablelist>
541994689c1Smrg</para>
542994689c1Smrg<para>
543994689c1Smrg<!-- .LP -->
544994689c1SmrgThe <function>XawTextDisableRedisplay</function> function causes all changes to be
545994689c1Smrgbatched until either <function>XawTextDisplay</function> or <function>XawTextEnableRedisplay</function>
546994689c1Smrgis called.
547994689c1Smrg</para>
548994689c1Smrg<para>
549994689c1Smrg<!-- .LP -->
550994689c1Smrg<!-- .sp 1 -->
551994689c1SmrgTo display batched updates, use <function>XawTextDisplay</function>:
552994689c1Smrg<!-- .IN "XawTextDisplay" "" "@DEF@" -->
553994689c1Smrg<funcsynopsis>
554994689c1Smrg<funcprototype>
555994689c1Smrg  <funcdef>void<function> XawTextDisplay</function></funcdef>
556994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
557994689c1Smrg</funcprototype>
558994689c1Smrg</funcsynopsis>
559994689c1Smrg<!-- .FN -->
560994689c1Smrg<variablelist>
561994689c1Smrg  <varlistentry>
562994689c1Smrg    <term>
563994689c1Smrg      <emphasis remap='I'>w</emphasis>
564994689c1Smrg    </term>
565994689c1Smrg    <listitem>
566994689c1Smrg      <para>
567994689c1SmrgSpecifies the Text widget.
568994689c1Smrg    </para>
569994689c1Smrg  </listitem>
570994689c1Smrg  </varlistentry>
571994689c1Smrg</variablelist>
572994689c1Smrg</para>
573994689c1Smrg<para>
574994689c1Smrg<!-- .LP -->
575994689c1SmrgThe <function>XawTextDisplay</function> function forces any accumulated updates to be
576994689c1Smrgdisplayed.
577994689c1Smrg</para>
578994689c1Smrg</sect2>
579994689c1Smrg<sect2 id="Resources_Convenience_Routines">
580994689c1Smrg<title>Resources Convenience Routines</title>
581994689c1Smrg<para>
582994689c1Smrg<!-- .LP -->
583994689c1SmrgTo obtain the character position of the left-most character on the
584994689c1Smrgfirst line displayed in the widget (the value of the
585994689c1Smrg<function>displayPosition</function> resource), use <function>XawTextTopPosition</function>.
586994689c1Smrg<!-- .IN "XawTextTopPosition" "" @DEF@" -->
587994689c1Smrg<funcsynopsis>
588994689c1Smrg<funcprototype>
589994689c1Smrg  <funcdef>XawTextPosition<function> XawTextTopPosition</function></funcdef>
590994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
591994689c1Smrg</funcprototype>
592994689c1Smrg</funcsynopsis>
593994689c1Smrg<!-- .FN -->
594994689c1Smrg<variablelist>
595994689c1Smrg  <varlistentry>
596994689c1Smrg    <term>
597994689c1Smrg      <emphasis remap='I'>w</emphasis>
598994689c1Smrg    </term>
599994689c1Smrg    <listitem>
600994689c1Smrg      <para>
601994689c1SmrgSpecifies the Text widget.
602994689c1Smrg    </para>
603994689c1Smrg  </listitem>
604994689c1Smrg  </varlistentry>
605994689c1Smrg</variablelist>
606994689c1Smrg</para>
607994689c1Smrg<para>
608994689c1Smrg<!-- .LP -->
609994689c1Smrg<!-- .sp 1 -->
610994689c1SmrgTo assign a new selection array to a text widget use
611994689c1Smrg<function>XawTextSetSelectionArray</function>:
612994689c1Smrg<!-- .IN "XawTextSetSelectionArray" "" "@DEF@" -->
613994689c1Smrg<funcsynopsis>
614994689c1Smrg<funcprototype>
615994689c1Smrg  <funcdef>void<function> XawTextSetSelectionArray</function></funcdef>
616994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
617994689c1Smrg  <paramdef>XawTextSelectType*<parameter> sarray</parameter></paramdef>
618994689c1Smrg</funcprototype>
619994689c1Smrg</funcsynopsis>
620994689c1Smrg<!-- .FN -->
621994689c1Smrg<variablelist>
622994689c1Smrg  <varlistentry>
623994689c1Smrg    <term>
624994689c1Smrg      <emphasis remap='I'>w</emphasis>
625994689c1Smrg    </term>
626994689c1Smrg    <listitem>
627994689c1Smrg      <para>
628994689c1SmrgSpecifies the Text widget.
629994689c1Smrg      </para>
630994689c1Smrg    </listitem>
631994689c1Smrg  </varlistentry>
632994689c1Smrg  <varlistentry>
633994689c1Smrg    <term>
634994689c1Smrg      <emphasis remap='I'>sarray</emphasis>
635994689c1Smrg    </term>
636994689c1Smrg    <listitem>
637994689c1Smrg      <para>
638994689c1SmrgSpecifies a selection array as defined in the section called \fBText
639994689c1SmrgSelections for Application Programmers\fP.
640994689c1Smrg    </para>
641994689c1Smrg  </listitem>
642994689c1Smrg  </varlistentry>
643994689c1Smrg</variablelist>
644994689c1Smrg</para>
645994689c1Smrg<para>
646994689c1Smrg<!-- .LP -->
647994689c1SmrgCalling this function is equivalent to setting the value of the
648994689c1Smrg<function>selectionTypes</function> resource.
649994689c1Smrg</para>
650994689c1Smrg<para>
651994689c1Smrg<!-- .LP -->
652994689c1Smrg<!-- .sp 1 -->
653994689c1SmrgTo move the insertion point to the specified source position, use
654994689c1Smrg<function>XawTextSetInsertionPoint</function>:
655994689c1Smrg<!-- .IN "XawTextSetInsertionPoint" "" "@DEF@" -->
656994689c1Smrg<funcsynopsis>
657994689c1Smrg<funcprototype>
658994689c1Smrg  <funcdef>void<function> XawTextSetInsertionPoint</function></funcdef>
659994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
660994689c1Smrg  <paramdef>XawTextPosition<parameter> position</parameter></paramdef>
661994689c1Smrg</funcprototype>
662994689c1Smrg</funcsynopsis>
663994689c1Smrg<!-- .FN -->
664994689c1Smrg<variablelist>
665994689c1Smrg  <varlistentry>
666994689c1Smrg    <term>
667994689c1Smrg      <emphasis remap='I'>w</emphasis>
668994689c1Smrg    </term>
669994689c1Smrg    <listitem>
670994689c1Smrg      <para>
671994689c1SmrgSpecifies the Text widget.
672994689c1Smrg      </para>
673994689c1Smrg    </listitem>
674994689c1Smrg  </varlistentry>
675994689c1Smrg  <varlistentry>
676994689c1Smrg    <term>
677994689c1Smrg      <emphasis remap='I'>position</emphasis>
678994689c1Smrg    </term>
679994689c1Smrg    <listitem>
680994689c1Smrg      <para>
681994689c1SmrgSpecifies the new position for the insertion point.
682994689c1Smrg    </para>
683994689c1Smrg  </listitem>
684994689c1Smrg  </varlistentry>
685994689c1Smrg</variablelist>
686994689c1Smrg</para>
687994689c1Smrg<para>
688994689c1Smrg<!-- .LP -->
689994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>. <!-- xref -->
690994689c1SmrgThe text will be scrolled vertically if necessary to make the line
691994689c1Smrgcontaining the insertion point visible.  Calling this function is
692994689c1Smrgequivalent to setting the <function>insertPosition</function> resource.
693994689c1Smrg</para>
694994689c1Smrg<para>
695994689c1Smrg<!-- .LP -->
696994689c1Smrg<!-- .sp 1 -->
697994689c1SmrgTo obtain the current position of the insertion point, use
698994689c1Smrg<function>XawTextGetInsertionPoint</function>:
699994689c1Smrg<!-- .IN "XawTextGetInsertionPoint" "" "@DEF@" -->
700994689c1Smrg<funcsynopsis>
701994689c1Smrg<funcprototype>
702994689c1Smrg  <funcdef>XawTextPosition<function> XawTextGetInsertionPoint</function></funcdef>
703994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
704994689c1Smrg</funcprototype>
705994689c1Smrg</funcsynopsis>
706994689c1Smrg<!-- .FN -->
707994689c1Smrg<variablelist>
708994689c1Smrg  <varlistentry>
709994689c1Smrg    <term>
710994689c1Smrg      <emphasis remap='I'>w</emphasis>
711994689c1Smrg    </term>
712994689c1Smrg    <listitem>
713994689c1Smrg      <para>
714994689c1SmrgSpecifies the Text widget.
715994689c1Smrg    </para>
716994689c1Smrg  </listitem>
717994689c1Smrg  </varlistentry>
718994689c1Smrg</variablelist>
719994689c1Smrg</para>
720994689c1Smrg<para>
721994689c1Smrg<!-- .LP -->
722994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>. <!-- xref -->
723994689c1SmrgThe result is equivalent to retrieving the value of the
724994689c1Smrg<function>insertPosition</function> resource.
725994689c1Smrg</para>
726994689c1Smrg<para>
727994689c1Smrg<!-- .LP -->
728994689c1Smrg<!-- .sp 1 -->
729994689c1SmrgTo replace the text source in the specified widget, use
730994689c1Smrg<function>XawTextSetSource</function>:
731994689c1Smrg<!-- .IN "XawTextSetSource" "" "@DEF@" -->
732994689c1Smrg<funcsynopsis>
733994689c1Smrg<funcprototype>
734994689c1Smrg  <funcdef>void<function> XawTextSetSource</function></funcdef>
735994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
736994689c1Smrg  <paramdef>Widget<parameter> source</parameter></paramdef>
737994689c1Smrg  <paramdef>XawTextPosition<parameter> position</parameter></paramdef>
738994689c1Smrg</funcprototype>
739994689c1Smrg</funcsynopsis>
740994689c1Smrg<!-- .FN -->
741994689c1Smrg<variablelist>
742994689c1Smrg  <varlistentry>
743994689c1Smrg    <term>
744994689c1Smrg      <emphasis remap='I'>w</emphasis>
745994689c1Smrg    </term>
746994689c1Smrg    <listitem>
747994689c1Smrg      <para>
748994689c1SmrgSpecifies the Text widget.
749994689c1Smrg      </para>
750994689c1Smrg    </listitem>
751994689c1Smrg  </varlistentry>
752994689c1Smrg  <varlistentry>
753994689c1Smrg    <term>
754994689c1Smrg      <emphasis remap='I'>source</emphasis>
755994689c1Smrg    </term>
756994689c1Smrg    <listitem>
757994689c1Smrg      <para>
758994689c1SmrgSpecifies the text source object.
759994689c1Smrg      </para>
760994689c1Smrg    </listitem>
761994689c1Smrg  </varlistentry>
762994689c1Smrg  <varlistentry>
763994689c1Smrg    <term>
764994689c1Smrg      <emphasis remap='I'>position</emphasis>
765994689c1Smrg    </term>
766994689c1Smrg    <listitem>
767994689c1Smrg      <para>
768994689c1SmrgSpecifies character position that will become the upper left hand corner
769994689c1Smrgof the displayed text.  This is usually set to zero.
770994689c1Smrg    </para>
771994689c1Smrg  </listitem>
772994689c1Smrg  </varlistentry>
773994689c1Smrg</variablelist>
774994689c1Smrg</para>
775994689c1Smrg<para>
776994689c1Smrg<!-- .LP -->
777994689c1SmrgSee section 5.4 for a description of <function>XawTextPosition</function>. <!-- xref -->
778994689c1SmrgA display update will be performed if redisplay is enabled.
779994689c1Smrg</para>
780994689c1Smrg<para>
781994689c1Smrg<!-- .LP -->
782994689c1Smrg<!-- .sp 1 -->
783994689c1SmrgTo obtain the current text source for the specified widget, use
784994689c1Smrg<function>XawTextGetSource</function>:
785994689c1Smrg<!-- .IN "XawTextGetSource" "" "@DEF@" -->
786994689c1Smrg<funcsynopsis>
787994689c1Smrg<funcprototype>
788994689c1Smrg  <funcdef>Widget<function> XawTextGetSource</function></funcdef>
789994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
790994689c1Smrg</funcprototype>
791994689c1Smrg</funcsynopsis>
792994689c1Smrg<!-- .FN -->
793994689c1Smrg<variablelist>
794994689c1Smrg  <varlistentry>
795994689c1Smrg    <term>
796994689c1Smrg      <emphasis remap='I'>w</emphasis>
797994689c1Smrg    </term>
798994689c1Smrg    <listitem>
799994689c1Smrg      <para>
800994689c1SmrgSpecifies the Text widget.
801994689c1Smrg    </para>
802994689c1Smrg  </listitem>
803994689c1Smrg  </varlistentry>
804994689c1Smrg</variablelist>
805994689c1Smrg</para>
806994689c1Smrg<para>
807994689c1Smrg<!-- .LP -->
808994689c1SmrgThis function returns the text source that this Text widget is currently
809994689c1Smrgusing.
810994689c1Smrg</para>
811994689c1Smrg<para>
812994689c1Smrg<!-- .LP -->
813994689c1Smrg<!-- .sp -->
814994689c1SmrgTo enable and disable the insertion point, use
815994689c1Smrg<function>XawTextDisplayCaret</function>:
816994689c1Smrg<!-- .IN "XawTextDisplayCaret" "" "@DEF@" -->
817994689c1Smrg<funcsynopsis>
818994689c1Smrg<funcprototype>
819994689c1Smrg  <funcdef>void<function> XawTextDisplayCaret</function></funcdef>
820994689c1Smrg  <paramdef>Widget<parameter> w</parameter></paramdef>
821994689c1Smrg  <paramdef>Boolean<parameter> visible</parameter></paramdef>
822994689c1Smrg</funcprototype>
823994689c1Smrg</funcsynopsis>
824994689c1Smrg<!-- .FN -->
825994689c1Smrg<variablelist>
826994689c1Smrg  <varlistentry>
827994689c1Smrg    <term>
828994689c1Smrg      <emphasis remap='I'>w</emphasis>
829994689c1Smrg    </term>
830994689c1Smrg    <listitem>
831994689c1Smrg      <para>
832994689c1SmrgSpecifies the Text widget.
833994689c1Smrg      </para>
834994689c1Smrg    </listitem>
835994689c1Smrg  </varlistentry>
836994689c1Smrg  <varlistentry>
837994689c1Smrg    <term>
838994689c1Smrg      <emphasis remap='I'>visible</emphasis>
839994689c1Smrg    </term>
840994689c1Smrg    <listitem>
841994689c1Smrg      <para>
842994689c1SmrgSpecifies whether or not the caret should be displayed.
843994689c1Smrg    </para>
844994689c1Smrg  </listitem>
845994689c1Smrg  </varlistentry>
846994689c1Smrg</variablelist>
847994689c1Smrg</para>
848994689c1Smrg<para>
849994689c1Smrg<!-- .LP -->
850994689c1SmrgIf <function>visible</function> is <function>False</function> the insertion point will be disabled.
851994689c1SmrgThe marker is re-enabled either by setting <function>visible</function> to <function>True</function>, by
852994689c1Smrgcalling <function>XtSetValues</function>, or by executing the <function>display-caret</function>
853994689c1Smrgaction routine.
854994689c1Smrg</para>
855994689c1Smrg</sect2>
856994689c1Smrg</sect1>
857