Skip to content

DefaultItem Property

Description

Retrieves whether or not the Tab is the default Tab in the Tab Pane.

Property Type

Read-write property

Syntax (Visual Basic)

Public Property DefaultItem() As Boolean

Return Type

True if this Tab is the default Tab, False otherwise.

Remarks

The DefaultItem specifies the tab that will be displayed when the backstage view is opened. This should only be set for the FIRST tab.

Important:

When implementing a Ribbon Backstage, Microsoft requires that at least 1 tab be added to the Tab Pane and the first Tab MUST be selected when the Backstage is displayed. Therefore, the first Tab MUST have DefaultItem set to True.

Example

Dim RibbonBar As RibbonBar  
Set RibbonBar = CommandBars.ActiveMenuBar  

Dim BackstageView As RibbonBackstageView  
Set BackstageView = CommandBars.CreateCommandBar("CXTPRibbonBackstageView")  

Set RibbonBar.AddSystemButton.CommandBar = BackstageView  

BackstageView.AddCommand ID_FILE_SAVE, "Save"  
BackstageView.AddCommand ID_FILE_SAVE_AS, "Save As"  
BackstageView.AddCommand ID_FILE_OPEN, "Open"  
BackstageView.AddCommand ID_FILE_CLOSE, "Close"  

If (pageBackstageInfo Is Nothing) Then Set pageBackstageInfo = New pageBackstageInfo  
If (pageBackstageSend Is Nothing) Then Set pageBackstageSend = New pageBackstageSend  
If (pageBackstageHelp Is Nothing) Then Set pageBackstageHelp = New pageBackstageHelp  

Dim ControlInfo As RibbonBackstageTab  
Set ControlInfo = BackstageView.AddTab(1000, "Info", pageBackstageInfo.hwnd)  

BackstageView.AddTab 1002, "Save && Send", pageBackstageSend.hwnd  
BackstageView.AddTab 1001, "Help", pageBackstageHelp.hwnd  

BackstageView.AddCommand ID_FILE_OPTIONS, "Options"  
BackstageView.AddCommand ID_APP_EXIT, "Exit"  

ControlInfo.DefaultItem = True  

CommandBars.Icons.LoadBitmap App.Path & "\res\BackstageIcons.png", _  
Array(ID_FILE_SAVE, ID_FILE_SAVE_AS, ID_FILE_OPEN, ID_FILE_CLOSE, ID_FILE_OPTIONS, ID_APP_EXIT), xtpImageNormal

See Also

RibbonBackstageTab Object


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.