U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » LineEdit, EditFields, DocEdit » Adding simple Append to TextCtrl?
Re: Adding simple Append to TextCtrl? [message #61085 is a reply to message #49773] Mon, 11 November 2024 17:01 Go to previous message
kov_serg is currently offline  kov_serg
Messages: 42
Registered: August 2008
Location: Russia
Member
How about AppendPreservingSelection for interactive adding text to control:
void LineEdit_Append2(LineEdit &edit, const String &text) {
	int64 pos=edit.GetCursor64(), len=edit.GetLength64();
	int64 h,t; bool sel=edit.GetSelection(h,t);
	edit.Append(text);
	if (pos==len) {
		len=edit.GetLength();
		edit.SetCursor(len);
		if (sel && t==pos) t=len;
	}
	if (sel) edit.SetSelection(h,t);
}

It keeps selection and cursor position if it was at the end.
 
Read Message
Read Message
Read Message
Previous Topic: Rescale image without filter
Goto Forum:
  


Current Time: Thu Oct 01 03:50:35 GMT+2 2026

Total time taken to generate the page: 0.00532 seconds