Preferences Panels

CobaltAlphaWindow

This class forms the basis for Cobalt's menu panels.  It features variable alpha see-through visibility and the ability to automatically present scrollbars when the  called-for menu panel is too big to fit inside the parent Cobalt world window.

How to use CobaltAlphaWindow  to create new menu panels.

Fastest/easiest way may be to copy/adapt a small existing menu panel class (such as Person Info Panel CCobaltAlphaPersonPanel), or at least study its example.  

Steps from scratch:

1) Make the new panel a subclass of CobaltAlphaWindow
2) declare new named instanceVariableNames for each Tweak widget (or subwidget) you intend to use.
3) define each of these widgets as particular Tweak widgets in the 'initialize' method.  (again, following the example of CCobaltAlphaPersonPanel).
4) If participation in the variable alpha bar settings is desirable for the panel's widgets, each widget object must have a line in an updateAlpha method of the panel that reads: WIDGETNAME fillAlpha: ((val-0.50) max: 0.001).
Note that not all Tweak widgets and their parts respond to alpha level setting messages!
5) The panel itself is constructed in the setupCostume method, which should begin with following code:

setupCostume
    |  |

    super setupCostume.
    
    label:= 'PANEL NAME HERE'.
    self setPanelBounds: PANEL BOUNDS in x@y PIXELS HERE.
      
One then builds the menu column by  composing rows with a label side and a widgets side with the message:

      self addRow: 'label goes here' withWidget nameOfYourWidgetHere.

which adds them to the panel's panelPane (which refers to the area interior to the scrollbars and titlebar..  

If a horizontal dividing line is desired between rows, use the message

      self addDivider.

between the relevant rows to insert a divider.

 Once all of the panel's rows are added to the panelPane, then the panelPane is added to self (the whole menu panel window) with the message
 
       self add: panelPane.

at the end of the setupCostume method  and the panel is then instantiated.

When a Widget needs to be comprised of several sub-Widgets, there exists a method called newWidgetRow to compose them into a single CPlayer within the column element.


Comments