Documentation for Win32lib v0.70.18
Table of Contents

Edit Controls

These are routines that let you inspect and alter attributes of the text edit controls


Such as EditText, MleText and RichEdit.

  • func autoSelect( object id, integer Flag )   Turns on and off an edit control's auto-selection property.
  • func charToIndex(integer id,integer line,integer column)   Retrieves the index of a character at a given line and column.
  • proc clear( object )    Clear selected text from object.
  • proc copy( object )    Copy any selected text from object and place in the clipboard.
  • proc cut( object )    Cut any selected text from object and place in the clipboard.
  • proc deleteLine(integer id, object line)   Removes the line with supplied number.
  • func getCharacterAt(integer id,integer x,integer y)   Determines the line and column a screen position maps to.
  • func getCharacterCount(integer id,integer flag)   Returns the number of characters in the control.
  • func getCharacterPosition(integer id,integer line,integer col)   Determines the screen position of the designated character relative to the upper left corner of the client area of the control.
  • func getLine(id,number,flag)   Fetches the text of the request line.
  • func getVisibleLines(id)   Determines the numbers of first and last lines displayed on screen.
  • func indexToLine(integer id,integer index)   Translates a character index to a {line,column} pair.
  • proc insertTextAt(integer id,sequence text,object pos)    Inesrts text in the text of at a defined point.
  • proc limitText( object, size )   Limits the amount of text a user can enter into an Edit control.
  • proc paste( object )    Paste text from the clipboard to object.
  • proc undo( object )    Undo last edit in object.

    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    autoSelect
    ( object id, integer Flag )

    Turns on and off an edit control's auto-selection property.

    Returns: OBJECT: Current AutoSelect status.

    Category: Edit Controls

    If flag is w32True, the edit control id is set to have Auto-Selection, otherwise it is set off.

    If id is a single control id, then the return value is a integer.
    If id is a sequence of controls, then the return value is a sequence containing one status flag per control referenced in id.

    id can be either a single control id or a list of ids in a sequence.

    Auto-selection means that when the edit control gets focus, all its contents is selected automatically for you.

    Example:

          sequence asv
          fldName = create( EditText, "", aWindow, x1, y1, width1, height1, 0 )
          fldAddress = create( EditText, "", aWindow, x1, y2, width1, height1, 0 )
          asv = autoSelect({fldName, fldAddress}, w32True)
    

    See Also: charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    charToIndex
    (integer id,integer line,integer column)

    Retrieves the index of a character at a given line and column.

    Returns: (INTEGER) Index of character.

    Category: Edit Controls

    See Also: autoSelect, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    clear
    ( object )

    Clear selected text from object.

    Category: Edit Controls

    Example:

              -- clear selected text in TheTextEdit
               clear( TheTextEdit )
    

    See Also: autoSelect, charToIndex, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    copy
    ( object )

    Copy any selected text from object and place in the clipboard.

    Category: Edit Controls

    Example:

              -- copy text from TheTextEdit into the clipboard
               copy( TheTextEdit )
    

    See Also: autoSelect, charToIndex, clear, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    cut
    ( object )

    Cut any selected text from object and place in the clipboard.

    Category: Edit Controls

    Example:

              -- cut text from TheTextEdit
               cut( TheTextEdit )
    

    See Also: autoSelect, charToIndex, clear, copy, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    deleteLine
    (integer id, object line)

    Removes the line with supplied number.

    Category: Edit Controls

    line is either a single line or a {lower,upper} range of lines to delete. No action is taken if the line number is invalid. If the deleted lines overlap the selection, the selection will be shortened accordingly.

    See Also: autoSelect, charToIndex, clear, copy, cut, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getCharacterAt
    (integer id,integer x,integer y)

    Determines the line and column a screen position maps to.

    Returns: (SEQUENCE) A {line number, character number, line length, character value} sequence, or {}.

    Category: Edit Controls

    x and y are client screen coordinates relative to id. If a position refers to past end of line whitespace, the information returned is relative to the last character of that line. If it is past the last character in the control, the returned information is relative to that character. You can check for this condition by calling getCharacterPosition() and comparing the result to the initial position.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getCharacterCount
    (integer id,integer flag)

    Returns the number of characters in the control.

    Returns: (INTEGER) The number of characters in the control.

    Category: Edit Controls

    If flag is zero, this will be a fast estimate, slightly larger than the actual count. Passing a nonzero flag will return the actual count, accurate but slower.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getCharacterPosition
    (integer id,integer line,integer col)

    Determines the screen position of the designated character relative to the upper left corner of the client area of the control.

    Returns: (SEQUENCE) A {x,y} coordinate pair in client coordinates, or 0 if character doesn't exist.

    Category: Edit Controls

    As a special case, if col is 0, then line is a character index.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getLine
    (id,number,flag)

    Fetches the text of the request line.

    Returns: (SEQUENCE) The (length of) requested line in the control, -1 on error.

    Category: Edit Controls

    id must refer to an edit or rich edit control; otherwise, the function returns 0. If number is 0 or less, the text of current line in the control is returned. The current line is the one where the selection starts, if any, or the one where the insertion point currently is. If flag is w32False, the length is returned; otherwise, the text of the line is returned.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getVisibleLines, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getVisibleLines
    (id)

    Determines the numbers of first and last lines displayed on screen.

    Returns: (SEQUENCE) {number of first line, number of last line}.

    Category: Edit Controls

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, indexToLine, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    indexToLine
    (integer id,integer index)

    Translates a character index to a {line,column} pair.

    Returns: (SEQUENCE) {line number, index of character in this line}

    Category: Edit Controls

    Note that, if word wrap was set using the EM_SETTARGETDEVICE message, the returned information is not reliable if the index falls into the wrapped part of a line.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, insertTextAt, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    insertTextAt
    (integer id,sequence text,object pos)

    Inesrts text in the text of at a defined point.

    Category: Edit Controls

    If pos is an atom, text will be appended to the control's text. Otherwise, it specifies the insertion point as {line,column}. If the insertion point is inside the selection, the selection will be enlarged and contains the inserted text as well. Otherwise, selection is preserved.

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, limitText, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    limitText
    ( object, size )

    Limits the amount of text a user can enter into an Edit control.

    Category: Edit Controls

    Example:

          aTextBox = create( EditText, "", aWindow, x1, y1, width1, height1, 0 )
          aEditor  = create( RichEdit, "", aWindow, x2, y2, width2, height2, 0 )
          limitText( aTextBox, 50 )   -- No more than 50 characters allowed.
          limitText( aEditor, 50000 ) -- No more than 50,000 characters allowed.
    

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, paste, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    paste
    ( object )

    Paste text from the clipboard to object.

    Category: Edit Controls

    Example:

              -- paste text from clipboard to TheTextEdit
               paste( TheTextEdit )
    

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, undo


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    undo
    ( object )

    Undo last edit in object.

    Category: Edit Controls

    Example:

              -- undo last edit in TheTextEdit
               undo( TheTextEdit )
    

    See Also: autoSelect, charToIndex, clear, copy, cut, deleteLine, getCharacterAt, getCharacterCount, getCharacterPosition, getLine, getVisibleLines, indexToLine, insertTextAt, limitText, paste