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 » LineEdit, EditFields, DocEdit » lostfocus
lostfocus [message #6055] Sun, 29 October 2006 11:35 Go to next message
djesus is currently offline  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 Go to previous messageGo to next message
fallingdutch is currently offline  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 #6058 is a reply to message #6055] Sun, 29 October 2006 12:35 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 629
Registered: December 2005
Location: Budapest, Hungary
Contributor
You can overload
virtual void ChildGotFocus ()
virtual void ChildLostFocus ()
functions in the container.
Re: lostfocus [message #6059 is a reply to message #6055] Sun, 29 October 2006 13:58 Go to previous messageGo to next message
djesus is currently offline  djesus
Messages: 14
Registered: September 2006
Promising Member
Thanks, but if I have in the layout editor a edit named myedit how I can to overload functions.

Sorry for my ignorance
Re: lostfocus [message #6068 is a reply to message #6059] Sun, 29 October 2006 20:47 Go to previous message
mirek is currently offline  mirek
Messages: 13442
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
Previous Topic: Right aligned EditField?
Next Topic: Bug "Self-invalidating time in EditTime"?
Goto Forum:
  


Current Time: Fri Oct 22 22:13:35 CEST 2021

Total time taken to generate the page: 0.01242 seconds