If you need more from a StatusBar than either the native VFP or the MS StatusBar ActiveX control can offer, then creating your own InterNet Explorer style statusbar is not as difficult as you might imagine.
What this statusbar will not do is display the messages from a VFP menu.
What it will do is a whole lot more than the alternatives and is only really limited by your imagination as a developer!
In the following example a simple five panel statusbar bar is created.
Panel 1 - Bitmap + line of text
This is used to display a 16 x 16 bitmap and text string relative to the control passed over by the mouse, or any other bitmaps/messages you programatically send.
Panel 2 - Progressbar
This displays the progress of processing within a loop
Panel 3 - AVI Player
This displays 16 x 16 .avi files
Panel 4 - Time display
Time including seconds, (if you don't already have a timer running, you will need to add one)
Panel 5 - Date display
Today's date
The example comes from an MDI form which sits at the bottom of [color blue]_SCREEN[/color], so to include the statusbar in a form, you simply replace the [color blue]_SCREEN[/color] references with [color blue]THISFORM[/color].
The panels are containers with the following non-default properties
[color blue]
.Height = 20
.SpecialEffect = 1
[/color]
The containers for panels 1 - [color blue].cntPanel1[/color], 2 - [color blue].cntPanel2[/color] and 3 - [color blue].cntPanel3[/color], each have a form method relative to the container, [color blue].mCntPanel1()[/color], [color blue].mCntPanel2()[/color] and [color blue].mCntPanel3()[/color].
File names, messages etc are passed to the controls in the container through the methods as parameters.
The [color blue].Resize()[/color] event of the form adjusts the positions of the containers relative to the width of the form.
The width of [color blue].cntPanel1[/color] is adjusted relative to the width of the remaining space in the statusbar.
The code and controls required for the progressbar can be found in FAQ184-2366
You will not find many 16 x 16 .avi files but making your own is easy.
Let's assume you want the print icon or the save icon to flash during an operation. In animation terms you could use two bitmaps, a 16 x 16 bitmap with an image and 16 x 16 bitmap without an image. The player continuously plays the sequence and thus the display flashes, until told to stop.
To show the .avi file you need the OleClass MSComCt2.Animation.2 control to be found in the list of ActiveX controls.
To be able to create .avi files, download the freeware AviCreator 1.5 to be found through any Internet search engine.
If you don't want to take advantage of the possibilities presented by using the animation control, a simple workaround is to use an image control instead and use the timer event to toggle the [color blue].Visible[/color] property. This will cause the image control to appear/disappear every second.
The sizing of the controls is important - I suggest you use MS Sans Serif fontsize 9 for the labels and 16 x 16 for the image and olecontrol. The texbox use for the progressbar should be the same size as its container.
So how do you send messages to the statusbar?
In the [color blue].MouseEnter()[/color] or [color blue].MouseMove()[/color] event of a control such as a commandbutton of a toolbar, put :-
[color blue]
oStatusBar.mCntPanel1(THIS.Picture,THIS.ToolTipText)
[/color]
The code in the method [color blue].mCntPanel1()[/color] would be :-
[color blue]
LPARAMETERS cFile, cLine1
WITH THIS
[tab].cntPanel1.Image1.Picture = cFile
[tab].cntPanel1.Label1.Caption = cLine1
ENDWITH
[/color]
For form objects, you need to substitute [color blue]THIS.Picture[/color] with a path\filename.ext
To play/stop an .avi file
[color blue]
oStatusBar.mCntPanel3([avi\print.avi],[Play])
[/color]
or
[color blue]
oStatusBar.mCntPanel3([avi\print.avi],[Stop])
[/color]
The code in the method [color blue].mCntPanel3()[/color] would be :-
[color blue]
LPARAMETERS cFile, cAction
THIS.cntPanel3.oleAviPlayer.Open(cFile)
lcExpr = [THIS.cntPanel3.oleAviPlayer.] + cAction
&lcExpr
[color black]
The code from the form follows to enable you to put your own version together.
[color blue]
PUBLIC ofooter
ofooter=NEWOBJECT("footer")
ofooter.Show
RETURN
*************************************************
*-- Form: footer (c:\test\newfooter.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 02/11/03 09:06:00 AM
*
DEFINE CLASS footer AS form
WITH .cntPanel3
.Left = _SCREEN.Width - 136
ENDWITH
WITH .cntPanel4
.Left = _SCREEN.Width - 113
ENDWITH
WITH .cntPanel5
.Left = _SCREEN.Width - 60
ENDWITH
WITH .cntPanel1 && The one panel that resizes
.Left = 3
.Width = _SCREEN.Width - 343
ENDW
ENDW
ENDPROC
PROCEDURE Init
THIS.Resize()
THIS.mCntLabel1([],[This is a test, and an even bigger test])
THIS.mCntLabel2()
THIS.mCntLabel3([bitmaps\n3.avi],[Play])
ENDPROC
ENDDEFINE
*
*-- EndDefine: footer
**************************************************
[color black]
If anyone can work out a way of utilizing the messages from a VFP menu, please advise
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.