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. flags can be a combination of the folowing:
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, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, 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 last index.
To always retrieve all the text
in the control, set the range to {0, 0}.
See Also: findText, getSelection, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, setTabs
Example:
-- Find out what is selected sequence posnposn = getSelection( myRE )
See Also: findText, getRichText, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, 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, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, 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, getStream, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, 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./n
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, getStream, printRichText, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection, 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, getStream, printRichText, printRichTextPages, setAlignment, setBullet, setIndent, setIndex, setSelection, 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, getStream, printRichText, printRichTextPages, putStream, setBullet, setIndent, setIndex, setSelection, setTabs
Toggles the bulleting of the paragraph which includes the selection in a RichEdit control.
See Also: findText, getRichText, getSelection, getStream, printRichText, printRichTextPages, putStream, setAlignment, setIndent, setIndex, setSelection, 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, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndex, setSelection, setTabs
This is used for Edit and RichEdit controls.
index is either a single integer of the position you are selecting, or
a two-element sequence in the form : {low_posn, high_posn}. If the high_posn
is zero, everything up to, and including, the last item is selected.
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 set the current scroll position.
Example:
-- select characters 30 thru 43 inclusive 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, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setSelection, setTabs
See Also: findText, getRichText, getSelection, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setTabs
tabs should be a sequence of absolute positions for the tab stops in 1/1000 of an inch.
See Also: findText, getRichText, getSelection, getStream, printRichText, printRichTextPages, putStream, setAlignment, setBullet, setIndent, setIndex, setSelection