Valhalla Legends Archive

Programming => General Programming => Topic started by: MrRaza on March 06, 2003, 09:13 AM

Title: StatusBar Help
Post by: MrRaza on March 06, 2003, 09:13 AM
How would i go about the way of properly adding text to a statusbar?
Title: Re: StatusBar Help
Post by: Spht on March 06, 2003, 09:22 AM
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.
Title: Re: StatusBar Help
Post by: Banana fanna fo fanna on March 06, 2003, 10:19 AM
statusbar.style = sbrsimple
statusbar.simpletext = "blah!"
Title: Re: StatusBar Help
Post by: MrRaza on March 06, 2003, 10:36 AM
How would I go about setting the length of the panels?
Title: Re: StatusBar Help
Post by: Grok on March 06, 2003, 12:09 PM
Click on StatusBar, click on HELP.
Title: Re: StatusBar Help
Post by: MrRaza on March 06, 2003, 12:50 PM
I believe it's something like:
StatusBar1.panel(x).width
but thanks anyway
Title: Re: StatusBar Help
Post by: Banana fanna fo fanna on March 06, 2003, 02:52 PM
simpletext is way easier
Title: Re: StatusBar Help
Post by: Mesiah / haiseM on March 06, 2003, 06:50 PM
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...
Title: Re: StatusBar Help
Post by: Grok on March 07, 2003, 02:20 AM
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.
Title: Re: StatusBar Help
Post by: Yoni on March 07, 2003, 06:17 AM
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.