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 » How to stick focus on a control
How to stick focus on a control [message #699] Wed, 25 January 2006 22:20 Go to previous message
zsolt is currently offline  zsolt
Messages: 698
Registered: December 2005
Location: Budapest, Hungary
Contributor
I want to avoid leaving a control until user doesn't type valid value in it. And I want to show some exclamation if he wants to leave the control.
Is there a standard way to do that?

I tried overriding LostFocus() and ChildLostFocus() of the control, but the problem is wery bizarre:

The user clicks into a (e.g.) DocEdit.
Then the next code runs:
void DocEdit::LeftDown(Point p, dword flags) {
	SetFocus();
	PlaceCaret(GetCursor(Point(p.x - 1, p.y + sb - 1)), flags & K_SHIFT);
	SetCapture();
}

So my original control losts focus, runs its own exclamation thing and sets focus back to himself.
After this the DocEdit captures the cursor and user can not click to anywhere.

The problem can be solved if I place SetCapture() into the first line of DocEdit::LeftDown() and call ReleaseCtrlCapture(); in the original control's LostFocus() and ChildLostFocus().

So for me, the best solution would be to move "SetCapture()" line to the top of the method, but I don't know if it breaks any other things?

Any Idea?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Focus sticks in MenuBar when iterating with TAB key
Next Topic: tray icon & balloon notification
Goto Forum:
  


Current Time: Tue May 14 12:31:27 CEST 2024

Total time taken to generate the page: 0.01344 seconds