• Welcome to Valhalla Legends Archive.
 

StatusBar Help

Started by MrRaza, March 06, 2003, 09:13 AM

Previous topic - Next topic

MrRaza

How would i go about the way of properly adding text to a statusbar?

Spht

#1
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.

Banana fanna fo fanna

#2
statusbar.style = sbrsimple
statusbar.simpletext = "blah!"

MrRaza

#3
How would I go about setting the length of the panels?

Grok

#4
Click on StatusBar, click on HELP.

MrRaza

#5
I believe it's something like:
StatusBar1.panel(x).width
but thanks anyway

Banana fanna fo fanna

#6
simpletext is way easier

Mesiah / haiseM

#7
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...
]HighBrow Innovations
Coming soon...

AIM Online Status: 

Grok

#8
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.

Yoni

#9
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.