Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: Tue May 13 18:07:20 CEST 2025

Total time taken to generate the page: 0.03408 seconds