range should be a sequence containing the range of text you'd like to search within the RichEdit, or an atom, if you want to search through all of the text. When specifying a range, the first index is included and the second index is excluded. flags can be a combination of the folowing:
Example:
atom fnd, frompoint integer cnt sequence word -- Count all occurances of a word. word = "procedure" cnt = 0 frompoint = 0 fnd = -1 while fnd != 0 do fnd = findText(myRichFld, word, {frompoint,-1}, findDown + findMatchCase + findWholeWord) if fnd then cnt += 1 frompoint = fnd end if end while
See Also: getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
If range is an atom, any selected text is returned. However
if there is no selected text and range is -1 then all the text is returned.
If range is a sequence, range should be a 2-element sequence with the
first element the starting index to be retrieved, and the
second element the first index NOT retrieved, like setIndex() does.
To always retrieve all the text in the control, set the range to {0, 0}.
Indexes are clipped so as to make sense. If they don't, "" is returned.
See Also: findText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Example:
-- Find out what is selected sequence posnposn = getSelection( myRE )
See Also: findText, getRichText, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Failure will occur if the control is not a RichEdit, or if the character in the selected range don't have the same font. You must free the returned memory when done with it.
See Also: findText, getRichText, getSelection, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Use flag StreamText to return plain text, or StreamRTF to return rich text. This can be combined to StreamSelection to only return any selected content from the RichEdit.
Example:
-- Create a RichEdit control RE = create( RichEdit, "", Win , 20, 20, 360, 200, ES_NOHIDESEL) . . . -- Save the text into a file from a RichEdit control richout = open("MyRich.txt", "w") -- Get the selected text from the control. printf(richout, "%s", { getStream( RE, StreamText + StreamSelection) } )close( richout )
See Also: findText, getRichText, getSelection, getSelectionFont, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
OutId is the control Id where the text is displayed. Usually 'Printer' but can be
a Window or Pixmap. If not a printer, this can be used to do a print-preview display.
InId is the RichText control
Start is the first position in the RichEdit to start from.
End is the last position in the RichEdit control. Use -1 to include all text up
to the end of the control.
Box is the area in the output control that will receive the formatted text. It is in the form
{Left, Top, Right, Bottom, Scale}, where Scale is one of ...
Render is w32True if you wish to actually output the text, w32False to format it but not print it.
Example:
if length(getPrinter()) > 0 then VOID = startDoc("RichText Printer Test") VOID = startPage() printRichText(Printer, RE, 0, -1, {0.5, 0.5, 2.5, 3, w32InchScale}, w32True) VOID = endPage() VOID = endDoc()releasePrinter() repaintWindow(PPV) end if
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
InId is the RichText control
pCallBack is a routine_id of a user defined function that is called before each page
is built and again just before each page is output. If this is not a valid routine_id
(eg. -1) then this routine will assume a 0.5 inch margin and print the entire RichText
document, using multiple pages if required.
The function will be passed a two parameters.
Left and Top indicate an offset from the left and top edges of the page, respectively.
Right and Bottom, if positive values are also offsets from the left and top
edges respectively, but if negative, they are offsets from the right and bottom
edges.
Scale is one of ...
When the function is called using w32RP_Output, the function must return one of ...
Note that you need to set the Printer device context before calling this. That can be done by calling getPrinter() or getPrintChoice().
Example:
function RTPager(integer pCode, sequence pParms) if pCode = w32RP_Build then -- Return the printable page area -- which is different for odd -- and even pages. if and_bits(pParms[1], 1) then return {0.25, 1, -0.75, -0.5, w32InchScale} else return {0.75, 1, -0.25, -0.5, w32InchScale} end if end ifif pCode = w32RP_Output then -- The page has been built with text from the richedit control, so now -- I can add my own touches...
-- Display the title text on the top left corner. wPuts( {Printer, 0, 0}, pParms[5] )
-- Display the page number on the bottom-right of the page. lFooter = sprintf(" Page %d", pParms[1]) wPuts( {Printer, lParms[4][1] - getTextWidth(lFooter), lParms[4][2] - (getTextHeight(lFooter) * 2)}, lFooter )
-- Tell win32lib to output the page now. return w32RP_Print end if end function
. . .
if length(getPrinter()) > 0 then printRichTextPages(RE, routine_id("RTPager"), "This Is The Title") releasePrinter() end if
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Use flag StreamText to indicate that contains plain text, or StreamRTF to indicate that text contains rich text. This can be combined with StreamSelection so that only any selected text in the control is replaced with text data.
Example:
sequence rich integer RE, fn, c . . . -- Create a RichEdit control RE = create( RichEdit, "", Win , 20, 20, 360, 200, ES_NOHIDESEL)-- Load the text into the RichEdit control fn = open("rich.rtf", "r") if fn != -1 then rich = {} c = getc( fn ) while c != -1 do rich &= c c = getc( fn ) end while
putStream( RE, StreamRTF, rich )
close( fn ) end if
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Sets Alignment of the paragraph which includes the selection in a RichEdit control. alignment should be one of the following values:
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Toggles the bulleting of the paragraph which includes the selection in a RichEdit control.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
If id is not the id of a RichEdit control for which getFindText() or getReplaceText()
is being called, then "" is returned.
Otherwise, a triple is returned. The first element is the string to be found. If getFindText()
is being called, the second element is 0, else it is the replacement string.
If findWhat is a string, the corresponding field in the dialog box will be updated. If
getReplaceText() is being invoked and replaceWith is a string, that field is updated as well.
If flags is a sequence, the current value of the dialog box flags is simply returned;
otherwise, the dialog box flags are set to the new value and the former value is returned.
In both cases, the value is returned as the third element of the returned sequence.
If action is not w32False, thedialog box will perform as if a button had been clicked,
depending on the value passed in flags or the current vlue of the dialog flags. Otherwise,
no further action is taken and user must push a dialog button for next thing to happen.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
Sets indenting. If you don't want to change any of the indent modes, pass it's parameter as a sequence. All values should be in pixels.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndex, setREChangeNotification, setSelection, setTabEnabled, setTabs
This is used for Edit and RichEdit controls.
index is either
Use 0 to deselect the current selection.
For ListView controls, index can be set to w32SelectAll to select all items.
For Window, VScroll, HScroll, VTrackBar, HTrackBar, ProgressBar, UpDown: this sets the current scroll position.
Example:
-- select characters 30 thru 42 inclusive. Cursor blinks at character 43. setIndex( TheEdit, {30, 43} ) -- select all characters setIndex( TheEdit, {1, 0} ) -- select all characters from position 78 setIndex( TheEdit, {78, 0} ) -- move insertion point to char 50 setIndex( TheEdit, 50 )
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setREChangeNotification, setSelection, setTabEnabled, setTabs
By default, RichEdit conrols do not notify their parent when a change in the data they hold takes place. Setting flag to a positive value will cause the RichEdit of id id to fire w32HChange on any change to its contents. Passing 0 wil disable this behaviour. Passing a negative -- value will simply return the current status.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setSelection, setTabEnabled, setTabs
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setTabEnabled, setTabs
between controls. Pass 0 as flag to disable need for the Ctrl key, w32GetValue to just get the flag value, or anything else to enable it. For (Rich)Edit controls, the need for the Ctrl key is turned on by default, and disabled for other controls.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabs
tabs should be a sequence of absolute positions for the tab stops in 1/1000 of an inch.
See Also: findText, getRichText, getSelection, getSelectionFont, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setFRData, setIndent, setIndex, setREChangeNotification, setSelection, setTabEnabled