Hi,
I no that fltk2.0 is not stable one. But all my projects are in fltk2.0 only .Am helpless thats why am using fltk2.0. And I already crosscompiled fltk3.0 for my ARM processor. Am going to use fltk3.0 for the upcomming projects. On Thu, Apr 12, 2012 at 2:14 PM, MacArthur, Ian (SELEX GALILEO, UK) < [email protected]> wrote: > > > I implemented as you said. It worked great. But the problem > is > > callback is not happening. Here is the code. Can u plz tell me why it is > > not happening?? > > Is that fltk2 code? If so, be advised that fltk2 is deprecated and should > not really be used for new work. Use fltk-1.3 which is the stable (and > actively maintained) branch. > > Anyway - I think the problem is that your derived handle() method needs to > explicitly call the base class handle method, for things to work. > That is what Greg showed in his example, but you appear to have missed > that bit out... > > > > > > > > > class colorInpt : public Input { > > int handle(int event); > > public: > > colorInpt(int x, int y, int w, int h, const char *L); > > > > }; > > > > colorInpt::colorInpt(int x, int y, int w, int h, const char *L) : > Input(x, > > y, w,h,L){ //Constructor for Input class > > } > > > > int colorInpt::handle(int e) { > > int ret = 0; > > No: This line should be > > int ret = Input::handle(e); > > > > switch (e) { > > case FOCUS: color(0xff0c3800); > > redraw(); > > return False; > > No: If you consume the FOCUS event, you should return non-zero here, so > that the fltk core knows you are interested in focus/unfocus events for > this widget... > > > case UNFOCUS: color(0xa3a3c600); > > redraw(); > > return False; > > No: ditto to the FOCUS case above... > > > } > > return(ret); > > } > > > > static colorInpt *inputL = NULL; > > > > static void cb_mycallback(colorInpt* ip, void*){ > > > > strcpy(LoginId, ip->value()); > > #ifdef DEBUG > > fprintf(stderr,"Login Id ::%s\n", LoginId); > > #endif > > } > > > > > > inputL = new colorInpt(100, 50, 130, 25, "Login Id :"); > > inputL->labelsize(14); > > inputL->callback((fltk::Callback*)cb_mycallback); > > inputL->when(fltk::WHEN_CHANGED); > > > > > > On Thu, Apr 12, 2012 at 9:36 AM, Rajesh Kumar <[email protected]> > wrote: > > > > > Hi Greg, > > > > > > Here I should declare a class named Fl_Input or can I > > directly > > > call handle method of Input box??? > > > > > > On Wed, Apr 11, 2012 at 11:35 PM, Greg Ercolano <[email protected]> > wrote: > > > > > >> On 04/11/12 10:46, Rajesh Kumar wrote: > > >> > Thanks for the reply. Can u post pseudo code for this?? > > >> > > >> I think Albrecht means something like this in your derived class: > > >> > > >> int handle(int e) { > > >> int ret = Fl_Input::handle(e); > > >> switch (e) { > > >> case FL_FOCUS: color(YOUR_FOCUS_COLOR); redraw(); > > >> return(1); > > >> case FL_UNFOCUS: color(YOUR_UNFOCUS_COLOR); redraw(); > > >> return(1); > > >> } > > >> return(ret); > > >> } > > > > > SELEX Galileo Ltd > Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex > SS14 3EL > A company registered in England & Wales. Company no. 02426132 > ******************************************************************** > This email and any attachments are confidential to the intended > recipient and may also be privileged. If you are not the intended > recipient please delete it from your system and notify the sender. > You should not copy it or use it for any purpose nor disclose or > distribute its contents to any other person. > ******************************************************************** > > _______________________________________________ > fltk mailing list > [email protected] > http://lists.easysw.com/mailman/listinfo/fltk > -- * Thanks & Regards, Rajesh Kumar P * _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

