Uniface on GitHub
Fixes and Updates
Author: firstname.lastname@example.org (hartmut.link)
does anybody know, how I can position the cursor within a multiline editbox ?
end of text, end of line, next line.
If I remember it well (tried it a long long time ago) the uniface macro statements works only in unifields.
Think I saw somwehere (in the undocumented features channels) there is a way to position the cursor
perhaps with fieldproperties or something similar.
Sometimes, one can abuse the "find" to go to the next line or so, but this is crippleware path of professionalism
Hi, has someone a solution to position the cursor at the end of a RichEditBox? Regards RogerW.
rogerw said Hi, has someone a solution to position the cursor at the end of a RichEditBox? Regards RogerW.
Hi RogerW, You could use the Windows USER32 function SendMessage for this. By sending the message EM_SETSEL to the RichEditBox widget you can set the position of the cursor and with the message EM_SCROLLCARET you can make sure that the cursor is visible (i.e. scrolls the cursor position into view). In order to send a message to a widget you need to obtain its window handle you can use the GetFocus function (that will retrieve the handle of the window that has the focus). You can call the mentioned USER32 functions using C Call-Out signatures. The required code would look like this:
I’ve created a small sample that demonstrates the above code in "action" (see the Community Sample "Set cursor position in RichEditBox"). The sample includes the form CURSOR1 and the C Call-Out signature USER32. The form features two buttons (one to add text to the RichEditBox field and one to set the cursor). The above code can be found in the Asynchronous Interrupt trigger of the form and it's triggered from the Field Gets Focus trigger. Please note that I’ve created this sample using Uniface 9.7.03. But it should also work with any other Uniface 9.7 or 9.6 version. Hope this helps. Daniel
Thanks Daniel, we will try it soon. I didn't expect an answer on this question . Regards RogerW.
Hi Daniel, Nice, very nice! As soon as I discovered this small example, I've immediately found a real usage scenario! but ... I can't live on bread alone! Is it also possible to mark a piece of text, like a character or a word or a line or from char 10 to char 20? ...and having also the option to choose backgroud color is asking too much? Gianni
© 2021 Uniface Privacy & Cookies | Privacy Statement | Legal