|
|
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 |
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?
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Thu May 16 18:06:10 CEST 2024
Total time taken to generate the page: 0.02278 seconds
|
|
|