Microsoft KB Archive/256066

= HOWTO: Use the StatusBar ActiveX Control in Visual FoxPro =

Article ID: 256066

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q256066



SUMMARY
This article shows how to programmatically access the most common properties and methods of the StatusBar ActiveX control using Visual FoxPro.



MORE INFORMATION
A StatusBar control provides a window, usually at the bottom of a parent form, through which an application can display various kinds of status data. The StatusBar control can be divided up into a maximum of sixteen Panel objects that are contained in a Panels collection.

Running the following code illustrates some of the most common usages for the StatusBar ActiveX control. To use this code, copy it into a new program in Visual FoxPro and run it. Public frmOLETest Local lnPanels

frmOLETest = CREATEOBJECT('Form') && Create Instance of the Form

With frmOLETest    && Set Default Values for the Form .CAPTION = 'StatusBar Control Test Form' .WIDTH = 800 .HEIGHT = 200 .VISIBLE = .T.   .ADDOBJECT('OCXTest','StatusBarControl', ;        'MSComctlLib.sBarCtrl.2') && Create Instance of the StatusBar Control Endwith

With frmOLETest.OCXTest    && Set Values and options of the StatusBar Control .Panels(1).TEXT = "Sample Text"    && Default Text For Panel 1 .Panels(1).TOOLTIPTEXT = "Panel 1" .Panels(1).STYLE = 0
 * !* Default Panel

For lnPanels = 2 TO 8 .Panels.ADD                        && Adds Panels 2 to 8 .Panels(lnPanels).STYLE = lnPanels - 1   && Show each Panel Style .Panels(lnPanels).TOOLTIPTEXT = "Panel " + ; ALLTRIM(STR(lnPanels)) Endfor Endwith
 * !* Additional Panels
 * !* Style 0 = Text or Bitmap
 * !*     1 = Caps Lock
 * !* 2 = Num Lock
 * !* 3 = Insert
 * !* 4 = Scroll Lock
 * !* 5 = System Time
 * !* 6 = System Date
 * !* 7 = Kana entry (Japanese characters)

Define CLASS StatusBarControl AS OLECONTROL Visible = .T.   Height = 25 Enddefine

