Page 1 of 1

Edit Control Insert Text, Clear Text, Get Text

Posted: 12 May 2016 15:32
by PYB
Hi there,

Right now I am using this code to insert and clear text in an Edit Control

To insert I use

Code: Select all

Msg = string::format("% \n %", edit1_ctl:getText(), "Some text"), edit1_ctl:setText(Msg).
and to clear just

Code: Select all

 edit1_ctl:setText("")
which is the right way to do this ?

I checked in the class and there should be an insert/add text and clear text functionality.

Thank you, bye.

Posted: 13 May 2016 12:45
by Ferenc Nagy
PYB,
You have solved the clearing of the text correctly.
The insertion needs an insertion point.

The insertion needs a selection within the edited text.
You can set it by

Code: Select all

selectText : (charCount First, charCount Last).
and get it using

Code: Select all

getTextSelection : (charCount First [out], charCount Last [out]).
You can split the whole contents by the edit control

Code: Select all

edit_ctl:getText()=WholeText, edit_ctl:getTextSelection(First,Last), string::splitLength(WholeText,[First,Last-First,string:length(WholeText)-Last)=[Front,_Throwaway,Tail], edit_ctl:setText(string::concat(Front,Inserted,Tail)).

Posted: 15 May 2016 22:22
by Thomas Linder Puls
You could also consider using a messageControl instead.