Chapter 15. EditControl Class

Table of Contents
Selected
Select
ScrollCommand
LineScroll
EnsureCaretVisibility
FirstVisibleLine
IsModified
SetModified
Lines
LineIndex
LineFromIndex
LineLength
GetLine
GetText
SetText
ReplaceSelText
SetLimit
PasswordChar=
PasswordChar
SetReadOnly
SetMargins
Margins
SetCue
ShowBalloon
HideBalloon
AddStyle
RemoveStyle
ReplaceStyle
GetStyle

The EditControl class provides methods to query and modify edit controls, which are also called entry lines in the ooDialog documentation. It inherits all methods of the DialogControl class (see page DialogControl Class).

Use the GetEditControl method (see page GetEditControl) to retrieve an object of the EditControl class.

Requires:

The EditControl class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Methods:

Instances of the EditControl class implement the methods listed in the following EditControl Instance Methods table.

Table 15-1. EditControl Instance Methods

Method......on page
AddStyleAddStyle
EnsureCaretVisibilityEnsureCaretVisibility
FirstVisibleLineFirstVisibleLine
GetLineGetLine
GetStyleGetStyle
GetTextGetText
HideBalloonHideBalloon
IsModifiedIsModified
LineFromIndexLineFromIndex
LineIndexLineIndex
LineLengthLineLength
LineScrollLineScroll
LinesLines
MarginsMargins
PasswordCharPasswordChar
PasswordChar=PasswordChar=
RemoveStyleRemoveStyle
ReplaceStyleReplaceStyle
ReplaceSelTextReplaceSelText
ScrollCommandScrollCommand
SelectSelect
SelectedSelected
SetCueSetCue
SetLimitSetLimit
SetMarginsSetMargins
SetModifiedSetModified
SetReadOnlySetReadOnly
SetTextSetText
ShowBalloonShowBalloon

Selected

>>-anEditControl~Selected--------------------------------------><


The Selected method retrieves the indexes of the starting and ending character of the text selected. If the starting index equals the ending index, no text is selected and the index specifies the current cursor position. If the ending index is 0 and the starting index is 1, the entire text is selected.

Return value:

The one-based starting and ending index of the current selection, separated by a blank.

Example:

The following example displays the starting and ending index of the text selection of the edit control NAME. It then selects the entire text of the edit control.

edit = MyDialog~GetEditControl("NAME")
if edit == .Nil then return
parse value edit~Selected with start end
say "Starting index of selection is" start
say "Ending index of selection is" end
edit~Select(1,0)