Home » U++ Library support » LineEdit, EditFields, DocEdit » lostfocus
lostfocus [message #6055] |
Sun, 29 October 2006 11:35 |
djesus
Messages: 14 Registered: September 2006
|
Promising Member |
|
|
Hi I would like to do any after edit field has a lost focus. In other toolkit there is a event like onlostfocus, but I don`t know if I can do it in ultimate.
Thanks a lot
|
|
|
Re: lostfocus [message #6057 is a reply to message #6055] |
Sun, 29 October 2006 11:47 |
fallingdutch
Messages: 258 Registered: July 2006
|
Experienced Member |
|
|
use the virtual method
virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags)
where event == MOUSELEAVE, so eg this:
Image MyCtrl::MouseEvent(int event, Point p, int zdelta, dword keyflags) {
if(event == MOUSELEAVE) {
//do something here
return NULL;
}
else {
return Ctrl::MouseEvent(event, p, zdelta, keyflags);
}
};
[edit: just saw, that EditCtr has the virtual function "LostFocus" - just use that]
Bas
[Updated on: Sun, 29 October 2006 12:22] Report message to a moderator
|
|
|
|
|
Re: lostfocus [message #6068 is a reply to message #6059] |
Sun, 29 October 2006 20:47 |
|
mirek
Messages: 13986 Registered: November 2005
|
Ultimate Member |
|
|
Well, if you are about to overload ChildLostFocus, you do not have to change anything in Layout, just overload it for your dialog class:
struct MyDlg : MyLayout<TopWindow> {
virtual void ChildLostFocus();
};
Anyway, the trouble of this method is that at the moment ChildLostFocus is called, focus is already out, so you have hard time to detect whether it is your editfield that lost the focus.
Therefore you will probably have to follow a little bit more complicated path and derive from EditField, overloading LostFocus method.
To have your new widget in Layout, just add it as user class. There is a little catch - class has to be defined when layout file is included. If for some reason you do not want that, you can still have it in the layout, just leave the name of class empty and add a public member to your dialog class with the same name as defined in layout, with proper class type.
Mirek
|
|
|
Goto Forum:
Current Time: Mon Jun 17 08:39:56 CEST 2024
Total time taken to generate the page: 0.02251 seconds
|