[fxruby-users] How to control Button access ?

Lyle Johnson lyle at lylejohnson.name
Thu Sep 11 10:35:09 EDT 2008


On Wed, Sep 10, 2008 at 8:08 PM, dragoncity <dragoncity at aanet.com.au> wrote:

> PS: I posted this  on Fox-users and received a possible solution, but would
> like to know if the same idea can be done with FXRuby.
>
> === eg ====
> One way is to derive FXButton class and override "canFocus()" method:
>
> class MyButton : public FXButton {
> public:
>  FXbool canFocus() const { return false; }
> }
> =========

Yes, the same approach should work in FXRuby. In fact, you should in
theory be able to just override the canFocus? method on a particular
button instance without having to subclass FXButton, e.g.

    no_focus_button = FXButton.new(...)
    def no_focus_button.canFocus?; false; end

Hope this helps,

Lyle


More information about the fxruby-users mailing list