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 » Bugfix: DocEdit, not to put back to wantfocus after clicking into it
Bugfix: DocEdit, not to put back to wantfocus after clicking into it [message #43215] Sun, 08 June 2014 19:13 Go to next message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
The patch:
-------------------------- uppsrc/CtrlLib/DocEdit.cpp --------------------------
index e5344eb..672e581 100644
@@ -257,17 +257,17 @@ void DocEdit::PlaceCaret(int newpos, bool select) {
 }
 
 int DocEdit::GetMousePos(Point p)
 {
 	return GetCursorPos(Point(p.x - 1, p.y + sb - 1));
 }
 
 void DocEdit::LeftDown(Point p, dword flags) {
-	SetWantFocus();
+	SetFocus();
 	int c = GetMousePos(p);
 	int l, h;
 	if(GetSelection(l, h) && c >= l && c < h) {
 		selclick = true;
 		return;
 	}
 	PlaceCaret(c, flags & K_SHIFT);
 	SetCapture();

Edit: changed "clucking" to "clicking" in title

[Updated on: Tue, 17 June 2014 15:50]

Report message to a moderator

Re: Bugfix: DocEdit, not to put back to wantfocus after clucking into it [message #43256 is a reply to message #43215] Mon, 16 June 2014 19:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
I am not quite sure about this. Behaviour is more or less consistent with other widgets here.

"WantFocus" is defined as flag that says that U++ is eligible to pass focus to widget, in other words, it can call SetFocus as result of some action. I believe that LeftDown is such example...

Mirek
Re: Bugfix: DocEdit, not to put back to wantfocus after clucking into it [message #43260 is a reply to message #43256] Tue, 17 June 2014 15:47 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
In a standard windows application, the user presses the tab key to iterate thru controls.
If I want to exclude a control from this iteration process, I disable WantFocus flag in the control.
This is a working way for controls, except for DocEdit. Clicking into it enables the disabled WantFocus for the control. A click changes it's behaviour.

I think, it is a bug in the code. SetFocus() should be enough instead of SetWantFocus().
Re: Bugfix: DocEdit, not to put back to wantfocus after clucking into it [message #43278 is a reply to message #43260] Sun, 22 June 2014 09:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
zsolt wrote on Tue, 17 June 2014 15:47
In a standard windows application, the user presses the tab key to iterate thru controls.
If I want to exclude a control from this iteration process, I disable WantFocus flag in the control.
This is a working way for controls, except for DocEdit. Clicking into it enables the disabled WantFocus for the control. A click changes it's behaviour.

I think, it is a bug in the code. SetFocus() should be enough instead of SetWantFocus().



OK. I think that you are right. Applied.
Re: Bugfix: DocEdit, not to put back to wantfocus after clucking into it [message #43283 is a reply to message #43278] Mon, 23 June 2014 01:26 Go to previous message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thanks for your better fixes Smile
Previous Topic: Window not scrolling
Next Topic: How to use caret / caretCtrl in a custom control [SOLVED]
Goto Forum:
  


Current Time: Sun Jun 16 08:47:22 CEST 2024

Total time taken to generate the page: 0.02150 seconds