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++ Widgets - General questions or Mixed problems » Proposal: add IsReadOnly() handling inside ButtonOption
Proposal: add IsReadOnly() handling inside ButtonOption [message #26434] Sat, 01 May 2010 16:07 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Imagine a common situation: you have a number of choices and you want to make exactly one of them chosen/selected. One way to do this is to make a number of ButtonOption controls and handle switching between them. Generally it is easily done in U++.

index.php?t=getfile&id=2510&private=0

The problem is when user clicks already "selected" ButtonOption. This way it becomes unselected, which is commonly not the best idea. The better idea is to make "chosen" button irresponsible to user clicks, while other buttons are, contrary, ready to be clicked and become "chosen".

I've made a number of attempts to make "chosen" button option irresponsible to user clicks and failed. Digging into code revealed that there is no way to make it. So I propose handling Editable/ReadOnly flag for ButtonOption. This requires a little patch which IMO won't break any compatibility yet making ButtonOption more flexible:

(Button.cpp)
void  ButtonOption::LeftDown(Point, dword) {
	if (IsReadOnly())
		return;
	push = true;
	Refresh();
}

void  ButtonOption::LeftUp(Point, dword) {
	if (IsReadOnly())
		return;
	option = !option;
	push = false;
	UpdateActionRefresh();
}

void  ButtonOption::MouseMove(Point, dword flags) {
	if (IsReadOnly())
		return;
	bool p = !!(flags & K_MOUSELEFT);
	if(push != p) {
		push = p;
		Refresh();
	}
}


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: QTF with QtfRichObject as Button label causes crash
Next Topic: Moving child ctrl, runtime, by mouse and keyboard
Goto Forum:
  


Current Time: Mon Apr 29 06:43:05 CEST 2024

Total time taken to generate the page: 0.07436 seconds