Difference between revisions of "DesktopTabPanel"

From Xojo Documentation

(Created page with "N/A")
 
 
Line 1: Line 1:
N/A
+
{{ClassBox
 +
| super=[[DesktopPagePanel]]
 +
| platform=all
 +
| scope=global
 +
| newinversion=2021r3
 +
}}
 +
{{Description
 +
| text=Used to organize controls into groups of tabs that can be selected by the user. Only the controls on the selected tab are visible.
 +
}}
 +
 
 +
<dynamicTable id="Events" super="PagePanel" class="eventTable" title="Events" columns="3">
 +
</dynamicTable>
 +
 
 +
<dynamicTable id="Properties" super="PagePanel" class="propertyTable" title="Properties" columns="3">
 +
{{Property | name=Bold | type=Boolean | platform=all | description=(Boolean)&nbsp;&nbsp; Applies the bold style to the TabPanel captions. }}
 +
{{Property | name=FontName | description=(String)&nbsp;&nbsp;Name of the font used to display the tab captions.  }}
 +
{{Property | name=FontSize | description=(Single)&nbsp;&nbsp;Size of the font used to display the tab captions.  }}
 +
{{Property | name=FontUnit | description=(FontUnits)&nbsp;&nbsp;The units in which FontSize is measured. }}
 +
{{Property | name=Italic | type=Boolean | platform=all | description=( Boolean)&nbsp;&nbsp;Applies the italic style to the TabPanel captions. }}
 +
{{Property | name=SmallTabs | type=Boolean | platform=all | readonly=yes | description=( Boolean)&nbsp;&nbsp;If True, decreases the vertical dimension of the tab panel (macOS only). }}
 +
{{Property | name=Underline | type=Boolean | platform=all | description=( Boolean)&nbsp;&nbsp;Applies the underline style to the TabPanel captions. }}
 +
</dynamicTable>
 +
 
 +
<dynamicTable id="Methods" super="PagePanel" class="methodTable" title="Methods" columns="3" exclude="AddPanel,AddPanelAt">
 +
{{Method | name=AddPanel | description=AddPanel(name As String)&#x0A;Adds a tab to the TabPanel using the specified name as the tab caption.}}
 +
{{Method | name=AddPanelAt | description=AddPanelAt(index As Integer, name As String)&#x0A;Adds a tab to the TabPanel at the specified index using the specified name as the tab caption.}}
 +
{{Method | name=CaptionAt | description=CaptionAt(Index as Integer) as String&#x0A;Allows you to get or set the caption of the specified tab at runtime. }}
 +
</dynamicTable>
 +
 
 +
==Notes==
 +
 
 +
===Getting and Setting the displayed Panel===
 +
Use the Value property to get and set the tab panel being displayed. Also, the PanelCount property of the [[DesktopPagePanel]] gives you the number of panels in the '''DesktopTabPanel'''. The '''DesktopTabPanel''' control is subclassed from [[DesktopPagePanel]]; the Value and PanelCount properties are described there.
 +
 
 +
You get or set the panel on which a control is located via the PanelIndex property of the [[DesktopControl]] class. The first panel is numbered zero.
 +
 
 +
The following line of code moves a ListBox from its current panel to the second panel of a '''DesktopPagePanel'''.
 +
 
 +
<rbcode>
 +
ListBox1.PanelIndex = 1
 +
</rbcode>
 +
 
 +
===Adding, Labelling, and Renaming Tabs===
 +
Click the value of the Panels property of the '''DesktopTabPanel''' to display the Tab Panel editor. From this screen, you can:<br>
 +
 
 +
* Rename the existing tab labels by clicking twice on its name and editing the name.<br>
 +
* Add tabs and their labels by clicking the Add button.<br>
 +
* Delete any tab by highlighting it and clicking Delete.<br>
 +
* Rearrange the tabs by highlighting a tab and clicking the Up or Down buttons.<br>
 +
 
 +
You add controls to a particular panel by clicking its tab and dragging controls to that panel.
 +
 
 +
===Placing Controls on Tab Panels===
 +
You can place other controls on the surface of any tab panel. Such controls are visible only when the user clicks on that panel's tab to bring it to the front. You can use the PanelIndex property of the [[DesktopControl]] class to read the panel on which the control is located.
 +
 
 +
Placing '''TabPanels''' within [[DesktopPagePanel|PagePanels]] (and vice versa) are '''not''' supported.
 +
 
 +
If the [[DesktopTabPanel.CaptionAt|CaptionAt]] property contains an ampersand character, it will display only if it is preceded by another ampersand character. This is done to make applications on all platforms behave consistently. The ampersand character is used to indicate the keyboard accelerator on Windows.
 +
 
 +
Controls placed on TabPanels are referenced in your code just by using the control name as if it were not on a TabPanel:
 +
 
 +
  PushButton1.Caption = "OK"
 +
 
 +
The '''DesktopTabPanel''' does not track the controls within it. You can retrieve an array of controls that are attached to a given index like this:
 +
 
 +
<rbcode>
 +
Function ControlsOnTabPanel(panel As TabPanel, panelIndex As Integer) As DesktopUIControl()
 +
 
 +
  Var tbControls() As DesktopUIControl
 +
 
 +
  Var wnd As DesktopWindow = panel.Window
 +
  Var lastIndex As Integer = wnd.ControlCount - 1
 +
  For i As Integer = 0 To lastIndex
 +
    Var c As DesktopUIControl = wnd.Control(i)
 +
    If c IsA DesktopUIControl Then
 +
      Var rControl As DesktopUIControl = DesktopUIControl(c)
 +
      If rControl.Parent = panel And rControl.PanelIndex = panelIndex Then
 +
        tbControls.AddRow(rControl)
 +
      End If
 +
    End If
 +
  Next
 +
 
 +
  Return tbControls
 +
 
 +
End Function
 +
</rbcode>
 +
 
 +
==See Also==
 +
[[DesktopUIControl]] class; [[DesktopPagePanel]] control.
 +
 
 +
[[Category:Desktop]]
 +
[[Category:Desktop Controls]]

Latest revision as of 20:21, 23 July 2021

Class (inherits from DesktopPagePanel)


New in 2021r3

Used to organize controls into groups of tabs that can be selected by the user. Only the controls on the selected tab are visible.

Events
Change DragExit MouseEnter
Close DragOver MouseExit
ConstructContextualMenu DropObject MouseMove
ContextualMenuAction KeyDown MouseWheel
DragEnter KeyUp Open
Properties
Active fa-lock-32.png Left SelectedPanelIndex
AllowAutoDeactivate LockBottom SmallTabs fa-lock-32.png
AllowTabStop LockLeft TabIndex
Bold LockRight Tooltip
Enabled LockTop Top
FontName MouseCursor Transparent
FontSize MouseX fa-lock-32.png TrueWindow fa-lock-32.png
FontUnit MouseY fa-lock-32.png Underline
Handle fa-lock-32.png Name fa-lock-32.png Visible
Height PanelCount fa-lock-32.png Width
Index fa-lock-32.png PanelIndex Window fa-lock-32.png
Italic Parent
LastAddedPanelIndex fa-lock-32.png Scope fa-lock-32.png
Methods
AcceptFileDrop AddPanelAt Refresh
AcceptPictureDrop CaptionAt RemovePanelAt
AcceptRawDataDrop Close SetFocus
AcceptTextDrop DrawInto
AddPanel Invalidate

Notes

Getting and Setting the displayed Panel

Use the Value property to get and set the tab panel being displayed. Also, the PanelCount property of the DesktopPagePanel gives you the number of panels in the DesktopTabPanel. The DesktopTabPanel control is subclassed from DesktopPagePanel; the Value and PanelCount properties are described there.

You get or set the panel on which a control is located via the PanelIndex property of the DesktopControl class. The first panel is numbered zero.

The following line of code moves a ListBox from its current panel to the second panel of a DesktopPagePanel.

ListBox1.PanelIndex = 1

Adding, Labelling, and Renaming Tabs

Click the value of the Panels property of the DesktopTabPanel to display the Tab Panel editor. From this screen, you can:

  • Rename the existing tab labels by clicking twice on its name and editing the name.
  • Add tabs and their labels by clicking the Add button.
  • Delete any tab by highlighting it and clicking Delete.
  • Rearrange the tabs by highlighting a tab and clicking the Up or Down buttons.

You add controls to a particular panel by clicking its tab and dragging controls to that panel.

Placing Controls on Tab Panels

You can place other controls on the surface of any tab panel. Such controls are visible only when the user clicks on that panel's tab to bring it to the front. You can use the PanelIndex property of the DesktopControl class to read the panel on which the control is located.

Placing TabPanels within PagePanels (and vice versa) are not supported.

If the CaptionAt property contains an ampersand character, it will display only if it is preceded by another ampersand character. This is done to make applications on all platforms behave consistently. The ampersand character is used to indicate the keyboard accelerator on Windows.

Controls placed on TabPanels are referenced in your code just by using the control name as if it were not on a TabPanel:

 PushButton1.Caption = "OK"

The DesktopTabPanel does not track the controls within it. You can retrieve an array of controls that are attached to a given index like this:

Function ControlsOnTabPanel(panel As TabPanel, panelIndex As Integer) As DesktopUIControl()

Var tbControls() As DesktopUIControl

Var wnd As DesktopWindow = panel.Window
Var lastIndex As Integer = wnd.ControlCount - 1
For i As Integer = 0 To lastIndex
Var c As DesktopUIControl = wnd.Control(i)
If c IsA DesktopUIControl Then
Var rControl As DesktopUIControl = DesktopUIControl(c)
If rControl.Parent = panel And rControl.PanelIndex = panelIndex Then
tbControls.AddRow(rControl)
End If
End If
Next

Return tbControls

End Function

See Also

DesktopUIControl class; DesktopPagePanel control.