07.05.2015 Views

Download - True BASIC

Download - True BASIC

Download - True BASIC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

186 <strong>True</strong> <strong>BASIC</strong> Language System<br />

If the font size is a negative number, the previous size will not be changed.<br />

You can find out what fonts are available by calling TC_FontsAvailable.<br />

The default colors are black (-1) on white (-2) , with a black border. If you wish to specify other colors, use<br />

CALL TC_Txed_SetColor (cid, forecolor, backcolor, bordercolor)<br />

The three colors are numbers that refer to the color mix table currently in use (see Chapter 13 “Graphics”). If you<br />

specify a number less than -2, the previous value of that color will not be changed.<br />

Cut, Copy, and Paste with Text Editors<br />

<strong>True</strong> Controls provides for the usual cut, copy, and paste functions.<br />

CALL TC_Txed_Cut (txed)<br />

CALL TC_Txed_Copy (txed)<br />

CALL TC_Txed_Paste (txed)<br />

In each case, it is assumed that text has been selected by the user, so that it shows in reversed color. Cut removes the<br />

text from the text editor and places it on the system clipboard. Copy just places the selected text on the system clipboard.<br />

Paste inserts the contents of the system clipboard at the insertion point, indicated by the insertion cursor; if<br />

text has been selected, paste replaces the selected text with the contents of the clipboard.<br />

If you have included menus in the window that contains the text editor, you may wish to create menu items for cut,<br />

copy, and paste. You can then use the TC_Txed_SetCutCopyPaste routine to have <strong>True</strong> Controls intercept<br />

those menu items and call the appropriate subroutine above. The format for this routine is:<br />

CALL TC_Txed_SetCutCopyPaste (wid, cutm, cuti, copym, copyi, pastem, pastei)<br />

For cutm and cuti, you supply the appropriate subscripts for the menu and item choice for Cut, and so on for<br />

the remaining arguments. <strong>True</strong> Controls keeps track of a text edit control attached to a particular window, and<br />

invokes appropriate cut, copy, or paste operations. Warning: the text edit control must be attached, and there can<br />

be no more than one such attached text edit control.<br />

Find Text in Text Editors<br />

<strong>True</strong> Controls includes a search utility that works with either wrapped or unfolded text.<br />

CALL TC_Txed_Find (cid, case, word, key$, par, ln1, ch1, ln2, ch2, found)<br />

If you wish the search to be case-sensitive, set the variable case to 1; otherwise, set it to 0. If you wish the search<br />

to concentrate on entire words, set the variable word to 1; otherwise, set it to 0.<br />

The search key must be supplied in the string variable key$. The next five arguments specify where the search<br />

should begin. (Note that if the text is not wrapped, then the line number is always 0. Also note that paragraph,<br />

line, and character numbering start with 0.) To start the search at the beginning of the text, set all five values to<br />

0.<br />

If the search is successful, then the argument found will have the value 1. The matched text will be selected in<br />

the text editor, and its position returned in the five arguments. If the search is not successful, found will have the<br />

value 0, and the prior values of the five arguments will not be changed.<br />

Note that the matched text must be contained within a single paragraph, whose number is returned in par.<br />

Selecting Text in Text Editor<br />

Finally, you may wish to select or highlight certain text in the text editor. For example, you may wish to highlight<br />

certain portions of a help file. This can be done with<br />

CALL TC_Txed_SetSelection (cid, par1, ln1, ch1, par2, ln2, ch2)<br />

You must, of course, determine the correct values of the starting and ending paragraphs, lines, and characters.<br />

And remember that paragraph, line, and character numbering starts with 0.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!