I’m experimenting with creating a horizontal button group derived from the ButtonGroup class. I’m running into problems, but before I scrap it and build one from scratch (deriving from the Group class instead), I was wondering if anyone has tried this.
My approach:
- Derive a class from ButtonGroup.
- In the Init() function, change the layout direction to horizontal
- Override the OnKeyEvent function
- Intercept the up/down key events and release focus
- Intercept the left/right key events and use those to change which button has focus
There are problems with this approach mainly with intercepting the up/down events. You have to indicate that you’ve handled those events or else the base ButtonGroup class uses them to change which button has focus (just as they do with the default vertical layout direction). This keeps the key event from ascending up the chain, which is problematic; the parent really needs those events to decide who gets focus after the button group loses it.
At any rate, I’m very close to starting from scratch by deriving from the Group class instead and going a little lower level.
Any thoughts or suggestions are appreciated.
