Documentation for Win32lib v0.70.18
Table of Contents
Routines that deal with text output.
func drawText(integer id, sequence text, object rect, object flags, integer tabsize, integer left, integer right) Places the text text into the rectangle rect, wrapping words if necessary.
proc getFindText( id ) Opens the "Find" Dialog
proc getFRText(integer id, integer replace_if_set,object callback) Opens the "Find" Dialog
proc getReplaceText( id ) Opens the "Replace" Dialog
func setFRMsgStrings(object nf_message,object nf_caption,object ra_message, object ra_caption) Gets and possibly sets the strings appearing in the default message boxes when &
proc textOut( atom HDC, sequence TextDef ) Writes text to a control.
func textRect(integer id,sequence text,object rect,object flags,integer tabsize,integer left,integer right) Calculates the RECT structure need to draw all the text.
Documentation for Win32lib v0.70.18
Table of Contents
[func]
drawText (integer id, sequence text, object rect, object flags, integer tabsize, integer left, integer right)
Places the text text into the rectangle rect, wrapping words if necessary.
Returns: SEQUENCE: {height, count, {left, top, right, bottom} }
Category: Text
This returns a sequence of three values: The height, in pixels, of the text drawn,
the number of characters used that could fit into the rectangle specified, and the
rectangle actually used, given as a {left,top,right,bottom} sequence. The rectangle is given in client coordinates for the control id.
The meaning and valid values for the other parameters are to be found in the Win32 API documentation.
Example:
sequence result
sequence rect
result = drawText(myWind, "Fourscore and twenty years ago, our fathers, ...",
{5,5,140, 75}, DT_WORDBREAK, 4, 0, 0)
textheight = result[1]
textcnt= result[2]
rect = result[3]
See Also:
getFindText,
getFRText,
getReplaceText,
setFRMsgStrings,
textOut,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
Opens the "Find" Dialog
Category: Text
id should be the id of the control in which the Find Dialog will
search. The Find dialog is a modeless dialog, which means that it
will remain open and on top, until the user closes it.
This call is equivalent to getFRText(id,w32False,-1).
See Also:
drawText,
getFRText,
getReplaceText,
setFRMsgStrings,
textOut,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
[proc]
getFRText (integer id, integer replace_if_set,object callback)
Opens the "Find" Dialog
Category: Text
id should be the id of the control in which the Find or Replace Dialog will
search. The dialog is a modeless dialog, which means that it
will remain open and on top, until the user closes it.
The dialog is a Find dialog if replace_if_set is w32False, and a Replace dialof if it is not zero.
If callback is not -1, it is a routine id called on completion of a find or replace operation.
The callback procedure should take two integer parameter. The first one is the id of the control, and the second is:
0 if the operation failed;
1 if it succeeded and is not a ReplaceAll operation;
the number of replaced occurences on completion of a ReplaceAll operation.
If callback is -1, a default behaviour takes place, which may involve displaying an information
dialog box. You can customise the strings it displays using setFRStrings(). If callback is a
sequence, then the previous callback will remain in force, or set to -1 if none.
See Also:
drawText,
getFindText,
getReplaceText,
setFRMsgStrings,
textOut,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
Opens the "Replace" Dialog
Category: Text
id should be the id of the control in which the Replace Dialog will
search. The Replace dialog is a modeless dialog, which means that it
will remain open and on top, until the user closes it.
This call is equivalent to getFRText(id,w32True,-1).
See Also:
drawText,
getFindText,
getFRText,
setFRMsgStrings,
textOut,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
[func]
setFRMsgStrings (object nf_message,object nf_caption,object ra_message, object ra_caption)
Gets and possibly sets the strings appearing in the default message boxes when &
Returns: (SEQUENCE) A sequence of four strings.
Category: Text
find/replace operation completes.
The arguments are, respectively:
the message displayed when text is searched and not found;
the caption of the corresponding message box;
the message displayed when a ReplaceAll operation completes;
the message displayed when text is searched and not found.
As an added twist, the ReplaceAll completion message may contain the substring "%d" once:
this substring will be replaced by the replaced occurence count.
Passing any atom as one of the parameters will leave the corresponding value
unchanged. In all cases, the current values for all four strings are returned in the same order as the arguments./n
When calling getFRText() with a valid callback routine id, the message boxes are not displayed,
and your papplication may take all appropriate steps.
See Also:
drawText,
getFindText,
getFRText,
getReplaceText,
textOut,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
[proc]
textOut ( atom HDC, sequence TextDef )
Writes text to a control.
Category: Text
This is a special version of wPuts that can be faster under certain
circumstances.
HDC is the Device Context of a control and not its Id. This can
be obtained by getDC() or assignFont(). And must be released after
use.
TextDef is a sequence of up to 7 elements. Elements 4 thru 7 are
optional and can be 'omitted' by using an empty sequence for them.
The elements are ...
pTextDefn[1] = text string to display.
pTextDefn[2] = x (horizontal pixel position)
pTextDefn[3] = y (vertical pixel position)
pTextDefn[4] = Foregroud color
pTextDefn[5] = Background color
pTextDefn[6] = Mode (OPAQUE or TRANSPARENT)
pTextDefn[7] = Vertical Alignment with respect to character height.
(AlignTop, AlignBottom, AlignBaseline)
Example:
atom hdc
hdc = assignFont(Mypixmap)
H = getTextHeight(Mypixmap, "|")
W = 4
textOut(hdc,{" Name:", W, 0 * H, Black, White, OPAQUE})
textOut(hdc,{"Address:", W, 1 * H})
textOut(hdc,{" Age:", W, 2 * H})
textOut(hdc,{" Weight:", W, 3 * H})
W = getTextWidth(Mypixmap, "_") * 9
textOut(hdc,{NameFld, W, 0 * H, Blue, BrightWhite})
textOut(hdc,{AddressFld, W, 1 * H})
textOut(hdc,{sprintf("%d",AgeFld), W, 2 * H})
textOut(hdc,{sprintf("%5.2f", WeightFld), W, 3 * H})
releaseDC(Mypixmap)
See Also:
drawText,
getFindText,
getFRText,
getReplaceText,
setFRMsgStrings,
textRect
Documentation for Win32lib v0.70.18
Table of Contents
[func]
textRect (integer id,sequence text,object rect,object flags,integer tabsize,integer left,integer right)
Calculates the RECT structure need to draw all the text.
Returns: SEQUENCE: {height, width,rectangle}
Category: Text
l rect defines the left, top and maximum right pixel (for multiple line text).
The parameters are the same as for drawText(), as the same API function is called by both routines.
On return, the rectangle actually used is given as {left, top, right, bottom}.
Example:
sequence result
result = textRect(myWind, "Fourscore and twenty years ago, our fathers, ...",
{5,5,140, 75}, DT_WORDBREAK, 4, 0, 0)
See Also:
drawText,
getFindText,
getFRText,
getReplaceText,
setFRMsgStrings,
textOut