Tips_gui   >   Tabpanes   >   Tab Panes (All Contents)

Tab Panes

This section covers various topics related to tab panes.

I especially like using tab panes with subwindows. See the Tab Pane Subwindows topic for more information.

Tab Pane Subwindows

I especialy like using tab panes with subwindows.

Tab1 might be the purchase order header and Tab2 would be the purchase order items.

To improve window instantiation time, the $classname property of Tab2,3,... is not assigned until the user clicks on the respective tab. This way when the window is intantiated only Tab1's subwindow is instantiated.

The sample code and demo shows you how this can be accomplished.

; $event method of the tab pane object.

On evTabSelected

; Set the $classname of the subwindow when the user switches to it.
Switch pTabNumber
   Case 1
      ; The subwindow is already set.
   Case 2
      Do irSubWin2.$classname.$assign('wSubWindow2')
   Case 3
      Do irSubWin3.$classname.$assign('wSubWindow3')
End Switch

Tip

If you wanted to create a flexible tab pane object you could have the tab pane add the subwindow field to itself using notation. You could create an instance variable list, iTabPaneList, which stores the tab caption names and the class name of each subwindow or an item reference to it. Then create a method, $addTabPaneSubWin(pTabNum,pTabCaption,prWin), which adds a new line to the iTabPanesList... and you've got yourself a very flexible reuseable object-oriented tab pane window which could be instantiated again and again.

$alltabcaptions, $alltabtooltips

If you use the F4 Notation Inspector and click the magnifying glass on a tab pane object in design mode, then press the F6 Property Inspector and look under the General tab you will see the properties $alltabcaptions and $alltabtooltips.

Hovering over these properties with the mouse the tooltip explains that these properties return a carriage return separated string of all the tab captions or tooltips.

You can use $alltabcaptions and $alltabtooltips to get or set the tab captions and tab tooltips. A $redraw is not required after setting the tab captions.

Click the Run Demo button for a demonstration.

Prior to the $alltabcaptions method you had to loop through the tab panes and set the $tabcaption property for each tab. Switching from one tab to the next would trigger an evTabSelected event message. To prevent this you had to set the $active property to kFalse while looping through the tabs. Setting the tab captions using $alltabcaptions property is a much nicer way to go.