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 » Please help debug this program (Re: EditDouble with customized Convert)
Re: Please help debug this program (Re: EditDouble with customized Convert) [message #41370 is a reply to message #41321] Fri, 06 December 2013 18:33 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 526
Registered: March 2007
Contributor
The following change to EditField::Insert(int, cost WString&) will fix the problem. I believe this should be regarded as a library bug and should be fixed to honor EditField's promise to work with customized Convert.

int EditField::Insert(int pos, const WString& itext)
{

	// omitted many unchanged lines
	//
	// the following test might need to be rewritten 
	// taking the Format/Scan effect into account
	//
	if(ins.GetCount() + text.GetCount() > maxlen) {
		BeepExclamation();
		return 0;
	}
	
	//changes ======================
	int len=text.GetLength();
	text.Insert(pos, ins);
	SetData(GetData()); // might be smarter way to achieve it
	len-=text.GetLength();
	Update();
	return -len;
}


After insert action, the text the EditField held in its internal storage becomes different from what it displays (because of the customized Format). This should not happen. Above code did the synchronization. I feel that it's not the best place to do such synchronization. Mirek will certainly be able to find the best and most economic way to achieve such synchronization, but one is indeed needed.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wrap EditString Rect to text
Next Topic: New method with EditorSyntax
Goto Forum:
  


Current Time: Fri Apr 19 16:32:54 CEST 2024

Total time taken to generate the page: 0.03361 seconds