FutureBasic Logo

<<    Index    >> FutureBasic 5

edit$   statement

edit$(efID) = ¬
  font, size, style, mode, red, green, blue
edit$(efID,lineNumber) = ¬
  font, size, style, mode, red, green, blue
edit$(efID,-1) = ¬
  font, size, style, mode, red, green, blue
edit$(efID,selStart,selEnd) = ¬
  font, size, style, mode, red, green, blue

This statement replaces all or a portion of the text in the edit field whose ID is efID in the current output window. PascalString is any string expression. ZTXThandle& is a handle to a "ZTXT" block (a "ZTXT" block contains text and (optionally) style information. TEXTresID% is the resource ID number of a "text" resource in an open resource file. A container is a variable that can hold up to 2 gigabytes of information. In the case of edit fields, the information is truncated at 32,767 characters which is the maximum number of characters allowed in an edit field.
If the field is a multistyled field, and you use the &ZTXThandle& syntax, then any style information found in the "ZTXT" block is applied to the field's text.
If a single parameter is used, the edit$ statement attempts to replace as much of the edit field text as will fit (up to 32K).
If a second parameter of -1 is added, the function replaces the current selection in whole or part depending on the size of the source variable. A second parameter that consists of a numeric value greater than or equal to zero specifies the line number that is to be replaced.
Where three parameters are used, the second and third values specify the starting and ending points of text to be replaced.
In all cases, FutureBasic insures that the field is not overflowed.
When the style parameter is used, the runtime toggles specific style attributes instead of setting them. For instance, the bold style may be toggled on then off again by using the same style parameter of _boldbit%. If you wish to reset the selection to a particular style regardless of its current state, then begin by using a style parameter of zero before resetting the desired bits.
Inserted text may take on specific font characteristics as described by new parameters. This feature is available starting with Release 4. You may describe a font (by number), a size, style, and text mode. RGB colors are also definable using the red, green and blue parameters. Any of these parameters may be eliminated as long as a comma is retained as a place holder. The following example places "Mississippi" in the third line of the field using red text in a Monaco font.
edit$(4,3) = "Mississippi",_monaco,,,-1

edit$(1) = "555-2467"
edit$(2) = &myZTXThndle&
edit$(3) = %-350
edit$(4,-1) = ReplaceCurrSel$
edit$(5,12) = ReplaceLine12$
edit$(6,10,20) = "Replace characters 10 thru 20 with this."
edit$(7,-1) = ReplaceCurrSel$,newFont,newSize,newStyle
edit$(8) = #myBigContainer$$

Colors can be specified either as red,[green,[blue]] or @rgb, where rgb is an RGBColor record. Note: the runtime distinguishes between a red value and an rgb address by taking any value from 0 to 65535 to mean "red", with any other value meaning "address of rgb record". Thus you cannot use a negative red values and must use the unsigned integer equivalent, for example 45536 not -20000.

See Also:
edit$ function; edit field; read field; window(_efNum)