Valhalla Legends Forums Archive | General Programming | StatusBar Help

AuthorMessageTime
MrRaza
How would i go about the way of properly adding text to a statusbar?
March 6, 2003, 3:13 PM
Spht
StatusBar1.Panels(1).Text = "Hello world!"

Replace StatusBar1 with the name of your status bar control.

That will add the text to the first panel. By default, a status bar has one panel. To add a panel, use StatusBar1.Panels.Add.
March 6, 2003, 3:22 PM
St0rm.iD
[code]
statusbar.style = sbrsimple
statusbar.simpletext = "blah!"
[/code]
March 6, 2003, 4:19 PM
MrRaza
How would I go about setting the length of the panels?
March 6, 2003, 4:36 PM
Grok
Click on StatusBar, click on HELP.
March 6, 2003, 6:09 PM
MrRaza
I believe it's something like:
[code]StatusBar1.panel(x).width[/code]

but thanks anyway
March 6, 2003, 6:50 PM
St0rm.iD
simpletext is way easier
March 6, 2003, 8:52 PM
MesiaH
whats the difference? you still have to declare the index of the panel your adding the text to, IMO it would be just an extra line of code if your declaring it as simple style each time you add text to the panel...
March 7, 2003, 12:50 AM
Grok
No no no noooooo.....

The StatusBar can work in either of two modes:  Normal or SimpleText.  Do this by changing the "Style" property to either sbrNormal or sbrSimple.

IF style is Simple:
* there is only one panel, stretching the length of the statusbar.
* you set the one panel's text by calling
  StatusBar1.SimpleText = "whatever you want to display"
* no index is needed to any panels

IF style is Normal:
* there are one or more panels, accessible by the Panels collection of the StatusBar control, e.g.
  StatusBar1.Panels(index)
* the properties of each panel are accessible by indexing the panel through the collection, such as text and width
  StatusBar1.Panels(i).Width = 3600   '2.5 inches
  StatusBar1.Panels(i).Text = "I can use panels"

Width of panels is normally expressed in twips, by always the inherited from the ScaleMode of the container form.  By definition, a twip is 1/1440 of an inch.

The StatusBar is useful for showing state data that the user is interested in while in the current context.  For example you can show NUM, SCRL, and CAPS panels that automatically reflect the lock mode of those toggles.

WIDTH -- There are three choices for setting the width of panels.  The useful AutoSize values are sbrNoAutoSize, sbrSpring, sbrContents.

In practice you should usually set some panels to sbrContents, and one to sbrSpring.  The sbrSpring panel will grow to fill the remaining space on the StatusBar.

HTH.
March 7, 2003, 8:20 AM
Yoni
The power of simple vs. normal mode in the status bar is that you can change between simple and normal dynamically.

You can set the SimpleText when the status bar is in normal mode and you can set stuff about panels when the status bar is in simple mode. When the status bar isn't in the mode you're editing, the changes will be reflected in the memory, and will become visible when you switch the style.

(I don't know how to switch in VB, in Win32 you send SB_SIMPLE.)

This is useful when you want to add text descriptions to menu items (IIRC not "built in" in VB and requires subclassing - you'll get over it). When the menu appears you'll switch to simple mode, when a menu item is highlighted you'll change the simple text, when the menu is closed you'll switch back to normal mode and you won't even have to rebuild the statusbar.
March 7, 2003, 12:17 PM

Search