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 » U++ Library : Other (not classified elsewhere) » subclassing LineEdit is ugly
subclassing LineEdit is ugly [message #2366] Sun, 09 April 2006 21:46 Go to previous message
hojtsy is currently offline  hojtsy
Messages: 241
Registered: January 2006
Location: Budapest, Hungary
Experienced Member
I am trying to subclass LineEdit, to create some kind of terminal window, where the user can only enter after the last character of the text. It seems quite much possible, but the resulting code would have lot of copy-paste from library code. It would be much easier to subclass LineEdit after the following desired modifications:

1) make these methods virtual, so that I can replace them:
PlaceCaretNoG
InsertChar
DeleteChar
Backspace
AlignChar

2) Extract to a new virtual method this last part of LineEdit::Key, so that I can replace this code in a subclass.
if(IsReadOnly()) return false;
switch(key) {
case K_DELETE:
	DeleteChar();
	break;
case K_BACKSPACE:
	Backspace();
	break;
case K_SHIFT_TAB:
	AlignChar();
	break;
case K_CTRL_Y:
case K_CTRL_L:
	if(cutline) {
		CutLine();
		break;
	}
default:
	if(InsertChar(key, count, true))
		return true;
	return MenuBar::Scan(WhenBar, key);
}
return true; 


Additionally please correct the error in the quoted code that WhenBar hotkeys are not working in read-only LineEdits.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Add and AddPick should return reference to added element
Next Topic: uvs wishes
Goto Forum:
  


Current Time: Fri Jul 18 07:13:43 CEST 2025

Total time taken to generate the page: 0.04149 seconds