Skip to content

StatusBar Collection

Description

Custom Statusbar

For a list of all members defined in this module, see StatusBar Members.

Object Model

Object Model
Diagram
StatusBarPane

Remarks

Command Bars comes with a built-in custom status bar. You have the ability to add panes to the custom status bar and can access each individual pane to change the message that is displayed. The custom status bar will automatically use the current Command Bars theme. For example, if you have the Command Bars theme set to Office 2003, the custom status bar will automatically use the Office 2003 theme. The custom status bar uses the DescriptionText property of your Command Bar controls to display text in the "Idle Text" pane when the mouse is positioned over a Command Bar control simply by adding a pane with ID zero. The custom status bar can be used to display other useful information such as Caps Lock, Scroll Lock, and Num Lock just by assigning the correct indicator to the status bar pane.

You can add a pane to display any useful information. In addition to custom panes, there are several "special" panes that can be added to the status bar.

Name Special Key Code Meaning
ID_IDLE_PANE 0 Used to display idle text and the DescriptionText of controls on mouse over.
ID_INDICATOR_CAPS 59137 Indicates whether CAPS Lock is on or off.
ID_INDICATOR_NUM 59138 Indicates whether Num Lock is on or off.
ID_INDICATOR_SCRL 59139 Indicates whether Scroll Lock is on or off.

Example

StatusBar Sample (Visual Basic) This sample code illustrates how to display the custom status bar, add some custom panes, and how to customize the panes.

' Place these constants in the General code section  

Const ID_INDICATOR_CAPS = 59137  
Const ID_INDICATOR_NUM = 59138  
Const ID_INDICATOR_SCRL = 59139  
Const ID_CUSTOM_PANE = 300  
Const ID_SWITCH_PRINTLAYOUT = 7700  
Const ID_SWITCH_FULLSCREENREADING = 7701  
Const ID_SWITCH_WEBLAYOUT = 7702  
Const ID_SWITCH_OUTLINE = 7703  
Const ID_SWITCH_DRAFT = 7704  
Const ID_INDICATOR_VIEWSHORTCUTS = 227  
Const ID_INDICATOR_ZOOM = 228  
Const ID_INDICATOR_ZOOMSLIDER = 229  

Dim ViewZoom As Long  
Dim WithEvents StatusBar As StatusBar  
Dim StatusBar As IStatusBar  
Set StatusBar = CommandBars.StatusBar  

' Make the custom status bar visible  
StatusBar.Visible = True  

' Adds the "special" idle pane to the custom status bar  
StatusBar.AddPane 0  
' Set Pane Style  
StatusBar.SetPaneStyle 0, SBPS_STRETCH  
' Add some Idle Text to be displayed while the application is idle  
StatusBar.IdleText = "Idle Text"  
' Set Pane width  
StatusBar.SetPaneWidth 0, 75  

' Adds a custom user-defined pane  
StatusBar.AddPane ID_CUSTOM_PANE  
StatusBar.SetPaneText ID_CUSTOM_PANE, "Hello World"  
StatusBar.SetPaneStyle ID_CUSTOM_PANE, SBPS_NOBORDERS  
StatusBar.SetPaneWidth ID_CUSTOM_PANE, 55  

' Adds the special Caps lock indicator pane  
StatusBar.AddPane ID_INDICATOR_CAPS  
' Adds the special Num lock indicator pane  
StatusBar.AddPane ID_INDICATOR_NUM  
' Adds the special Scroll lock indicator pane  
StatusBar.AddPane ID_INDICATOR_SCRL  

CommandBars.Icons.LoadBitmap App.Path & "\res\StatusBarViewSwitches.png", _  
    Array(ID_SWITCH_PRINTLAYOUT, ID_SWITCH_FULLSCREENREADING, ID_SWITCH_WEBLAYOUT, ID_SWITCH_OUTLINE, ID_SWITCH_DRAFT), xtpImageNormal  

Dim SwitchPane As StatusBarSwitchPane  
Set SwitchPane = StatusBar.AddSwitchPane(ID_INDICATOR_VIEWSHORTCUTS)  
SwitchPane.AddSwitch ID_SWITCH_PRINTLAYOUT, "Print Layout"  
SwitchPane.AddSwitch ID_SWITCH_FULLSCREENREADING, "Full Screen Reading"  
SwitchPane.AddSwitch ID_SWITCH_WEBLAYOUT, "Web Layout"  
SwitchPane.AddSwitch ID_SWITCH_OUTLINE, "Outline"  
SwitchPane.AddSwitch ID_SWITCH_DRAFT, "Draft"  
SwitchPane.Checked = ID_SWITCH_PRINTLAYOUT  
SwitchPane.Caption = "&View Shortcuts"  

Set Pane = StatusBar.AddPane(ID_INDICATOR_ZOOM)  
Pane.Text = "100%"  
Pane.Button = True  
Pane.ToolTip = "Zoom level. Click to open the Zoom dialog box."  
Pane.Caption = "&Zoom"  
Pane.BeginGroup = False  
Pane.SetPadding 8, 0, 8, 0  

Dim SliderPane As StatusBarSliderPane  
Set SliderPane = StatusBar.AddSliderPane(ID_INDICATOR_ZOOMSLIDER)  
SliderPane.Width = 130  
SliderPane.ToolTip = "Zoom"  
SliderPane.Min = 0  
SliderPane.Max = 200  
SliderPane.Value = 100  
SliderPane.Caption = "&Zoom Slider"  
SliderPane.BeginGroup = False  
ViewZoom = 100  

StatusBar.RibbonDividerIndex = 3  
StatusBar.ToolTipContext.Style = xtpToolTipResource  
StatusBar.EnableCustomization True

See Also


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