[fxruby-users] Keeping child focused in FXTabBook (on key press)

Jannis Pohlmann info at sten-net.de
Thu May 19 17:15:41 EDT 2005


Jannis Pohlmann schrieb:

> Hi list, hi Lyle.
>
> I've got some problems here using a (now enabled, thanks to Lyle) 
> FXScrollArea in a FXTabBook
> instance.
>
> When pressing the KEY_Up or KEY_Left the FXScrollArea looses its 
> focus. Instead, the related
> FXTabItem gets focused. Usually, that's okay and I assume it is an 
> intended behaviour.
>
> A topic that I couldn't find being discussed anywhere, neither on 
> fxruby.org nor on the list (didn't
> I search hard enough?) was how to ignore those focus changes.
>
> I've browsed the FOX source once again. FXScrollArea is derived from 
> FXComposite. This means
> that it sends SEL_KEYPRESS events to its target by default (or better, 
> when begin enabled).
>
> And it sends SEL_FOCUS_UP to itself, handling it by itself. Hmmm, 
> well, still, I didn't find
> the point which handler I'd have to overload/overwrite in order to 
> ignore the message which
> leads to the focus change.
>
> I hope there's someone out there who has an idea.
>
> Kind regards,
> Jannis

I just found it out by myself: I had to write a

    FXMAPFUNC(SEL_KEYPRESS, 0, :onKeyPress)

in my FXScrollArea subclass and add a

    return 1

statement into :onKeyPress. That's all. I found the solution in
   
    FXComposite::onKeyPress.

- Jannis


More information about the fxruby-users mailing list