Skip to content

Tabs.md

cfloutier edited this page Apr 27, 2024 · 7 revisions

Tabs

Tabs has been rewritten 4 times ! it was the first element I worked on and I was struggling with UI Toolkit logic and behavior. The solutions thats were mainly used didn't satisfied what I wanted to have to be easy to configure and maintains.

The tabs in K2D2 have quite a complexity because each one holds a pilot that can be visible or not and active or not. each page have to show this 2 informations and dealing with only css to do that made the problem more complex.

I finally had to separate the work into many differents classes :

  • TabbedPage : maintains the a global logic. It creates TabButton depending on TabPages found in it's content.
  • TabPage : is a VisualElement used to idntiy a page and create it's associated TabButton
  • TabButton : created by the is TabbedPage in the TabsBar
  • TabsBar : have the responsability of showing and hiding pages and changing buttons look on user inputs

After 4 attemps I fianally found a quite good logic.

Clone this wiki locally