On 14.03.2012 20:31, Rajesh Kumar wrote:
> I got one small problem. The method suggested by u is working fine. But it
> is failing when user enters input, it is not taking of that situation.
> Application is simply exiting. I added WHEN_CHANGED also. Why because I am
> using that in input. That means am taking the input value for each and
> every character.

Yes, that's the kind of problems I anticipated. If you want to do it
right, then you must set the activity flag/counter even for such events
that are delivered directly to leaf widgets. Keyboard input is one of
these. There may be others as well.

> I think handler function take care of this situation. can u suggest me what
> should I do now???

If you use FL_WHEN_CHANGED already you could increment the window's
counter like that:

  my_input->window()->had_events++;

where my_input is a pointer to the input widget. OTOH, you could do the
same as for the window, derive your own class, and use the handle()
method as in Ian's example for the idle_win class, in this case for
your idle_input class etc.

The same problem might arise if you have other widgets that use FL_ENTER
events - in this case following FL_MOVE events will be delivered to the
widget directly and not to the window. You'd have to do similar things
for such cases.

However, as I said before: you must first define what you consider as
activity. Is moving the mouse already activity? ...

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to