>>-anEditControl~SetText(--text--)-----------------------------><
The SetText method places text in the edit control. Any current text content in the edit control is completely replaced.
The only argument is:
The text to be displayed in the edit control. For multi-line edit controls the text must contain the carriage return and line-feed characters.
The return values are:
No error.
Error. The value is the negated Operating System Error code. The absolute value of the return can be used to look up the error reason in the Windows documentation.
The following code snippets use the GetText and SetText methods in a dialog that could be used as a simple file editor:
... ::method defineDialog ... self~addEntryLine(110, , 5, 5, 170, 150, "VSCROLL HSCROLL MULTILINE") self~addButton(115, 5, 160, 35, 15, "Open", onOpen) self~addButton(116, 45, 160, 35, 15, "Save", onSave) ... ::method initDialog expose editControl editControl = self~getEditControl(110) ::method onOpen expose editControl if .nil == editControl then return fileName = self~getFile if fileName == "" then return fObj = .stream~new(fileName) fObj~open if fObj~state \== 'READY' then return text = fObj~charin(1, fObj~chars) fObj~close editControl~setText(text) editControl~setModified(.false) ::method onSave expose editControl if .nil == editControl then return if editControl~isModified then do text = editControl~getText self~saveFile(text) editControl~setModified(.false) end else do j = InfoDialog("There is nothing to save") end