On 07.05.2012 16:01, leowang wrote:
>> On 07.05.2012 11:11, leowang wrote:
>>
>>> I have use take_focus to let the focus on the widget, but how can I remove 
>>> the focus from this widget?
>>
>> Give the focus to another widget, or use Fl::focus(0); maybe.
>>
>> But what do you want to achieve with this?

> I have the case that, I have two Fl_Box widget, each has a normal_pic as it's 
>  background, and if the focus on it, it will change the focusd_pic as it's 
> background, if the focus remove, then change the normal pic.

So far I can follow you. As said before, this can be done by
deriving a class and using handle(int event) to change the
backgroung picture as needed.

> So I need to remove the focus from the widget which has focus.

I still don't understand *this*. Removing the focus from a widget
is handled automatically if another widget gets the focus. Do you
mean that you need this for testing? Then, simply add another
widget like an Fl_Input and click on this one, so the focus will
move... Or, if you really need it in your program (why?), you
can do Fl::focus(0), but I wouldn't know why you should need this.
Still puzzled...

Or do you only want to *know* when the widget *loses* the focus?
Then you can use handle(int event) to handle the FL_UNFOCUS event.
I believe I wrote this already, though.

Albrecht
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to