TabbedFrame allows one to keep multiple “pages” of DirectGUI controls, and to flip between them by clicking on button-tabs at the top of the TabbedFrame.
The repository below contains the “TabbedFrame” class itself, and a simple example-program.
I’ve started to integrate the tabbed frame in my app for the preference panel but I encountered a problem that prevent proper integration:
I’m using windows to embed the widget, the window is a simple DirectFrame, with minimal decoration attached to it, and the widget is reparented to the frame. So when the window is dragged, the widget is moved along and (in the future) when resized the widget it modified as well.
It works fine with the frame of the TabbedFrame widget, however the tab buttons are not reparented to the given parent, instead they seem to be directly reparented to aspect2d, so when I move the window, the buttons stay in place.
I think there should be a main frame, under witch the pane frame and all the tab buttons are reparented, though it might have impact on the scale and position parameters.
Hmm… It shouldn’t complicate usage overmuch–after all, most work is expected to be done in the TabbedFrame’s “pages”, rather than in the TabbedFrame itself. However, as you say, it may complicate parameter-application a bit. That said, it may be possible to work around that, redirecting the parameters to the primary frame, rather than the “handle” frame…
I’ll give this some thought, I think; if I make changes, I’ll post again here, I intend!
The solution was actually pretty simple: I just parented the buttons to the main frame. No additional frame required, at least as far as my testing has shown.
I’ve also updated the example-program to demonstrate this new behaviour.
(PS: Sorry that it took me so long to get to this!)
Just one small bug (or misunderstanding by me), you assume that tab_scale is a float, or it could be a vector if the screen does not have the same scaling for X and Y. Usually DirectGui objects use a three components tuple for their scale (X, 1, Y). Using a tuple cause the following line to crash
Minor update: I’ve committed what I believe to be a fix for the above issue. TabbeFrame should now accept things like tuples or Vec3s for the value of “tab_scale”, along with its preexisting acceptance of single floats in that parameter.