Setting Status Bar Properties at Runtime

The fourth and fifth panels of the StatusBar control located on the WindowsCommonControls form are set at runtime by the UpdateStatusBarControl subroutine, found in the General Routines in the form module.

To open the module to the subroutine desired, follow these steps:

1.
Open the WindowsCommonControls form in Design mode.

2.
Click the Code toolbar button on the Form Design toolbar.

3.
Choose the UpdateStatusBarRoutine from the Procedure combo box.

The routine in Listing 14.13 performs two actions. It sets the picture property of the fourth panel to the selected tab picture, and displays (in the fifth panel) the caption of the chosen tab.

Note

Like other collections in Access and other Windows development languages, the collections are zero-based. This is why the index that says 3 is panel number 4.


Listing 14.13. Chap14.mdb: Updating the Status
Sub UpdateStatusBarControl(intChoice As Integer)

  On Error GoTo Error_UpdateStatusBarControl

  '-- Set the fourth panel to the currently selected tab
  Set Me!ocxStatusBar.Panels(3).Picture =
     Me!ocxImageList.ListImages(intChoice).Picture

  '-- Set the fifth panel the caption of the currently selected tab
  Me!ocxStatusBar.Panels(4).Text = Me!ocxTabStrip.Tabs(intChoice).Caption

Exit_UpdateStatusBarControl:
  Exit Sub

Error_UpdateStatusBarControl:

  MsgBox Error$
  Resume Error_UpdateStatusBarControl

End Sub

The StatusBar control is a great way to let the user know what's happening on each of your forms.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.40.199