Discussions related to Visual Prolog
-
PYB
- Posts: 12
- Joined: 16 Nov 2012 1:50
Post
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
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.
-
Ferenc Nagy
- VIP Member
- Posts: 215
- Joined: 24 Apr 2007 12:26
Post
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)).
TIA, Regards,
Frank Nagy