Dmitry wrote:
>>> I need to disable dotted square when pressing Fl_Button, how
>>> can I do it?
>>
>>     my_button->clear_visible_focus();
> 
>  I did it in callback of my_button. But widget draws it anyway.

        Hmm, that *should* work if you set it at button creation time.
        True, though, it seems if you try to change it from the button's
        own callback, even if you call redraw() after, it stays on. Huh.

        For sure you can turn off the box for all widgets with 
Fl::visible_focus(onoff)
        http://fltk.org/documentation.php/doc-1.1/Fl.html#Fl.visible_focus
        ..and that seems to work, even from the button's own callback.

        But not sure why my_button->clear_visible_focus(); doesn't work
        right away from the button's callback.

        Here's the replication which I tested with 1.1.x-svn on fedora3.
        After you push the button, the focus box is still there. You can
        keep pushing the button and it persists, so it's not a redraw issue.

        Seems the only way it work is if the mouse leaves the window first,
        and you force the window to be unfocused, then when you go back
        it will be OK from then on. So somehow this state is getting cached
        until the window goes out of focus.

        Is this a bug maybe?

#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>

static void Button_CB(Fl_Widget* in, void*) {
    in->clear_visible_focus();          // this doesn't work unless win goes 
out of focus
    in->redraw();                       // this doesn't help

    // Fl::visible_focus(0);            // this works though, taking effect 
right away
}

int main(int argc, char *argv[]) {
    Fl_Double_Window win(0, 0, 220, 100, 0);
    Fl_Button but(10, 10, 200, 40, "Push To Disable Focus");
    but.callback(Button_CB);
    win.end();
    win.show();
    return(Fl::run());
}

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

Reply via email to