Discussion Locked

Vb6 and CoolBars

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I programically set the user preference for the Position of the Band elements of a CoolBar, (not the Width and not the row - but the order position), at run time .
Using the Position property I can find out the order - but I cannot seem set it! I must be overseeing something (I can only set the Row).

Could someone please help me? Thankyou!

7 replies

by sl-campbell

This took me a long time to figure out myself. MS really messed up here, or I am missing something. It is stupid to allow the user to move the bands but now allow the positioning to be saved and retrieved again.

You need to use a combination of the Visible and NewRow properties.

What I have done is saved the Position and the value of the NewRow properites
of each Band to the registry. You have to make sure that the Band.NewRow value that gets saved to the registry for the Band in the first position gets set to false or you will need an error catcher when this Bands NewRow property gets set (you cannot set the band in position 1)

Then, I have a Sub that gets the values from the registry and sets the values of the cool bar in the same sub.

Now, here's the trick: The first thing that you need to do is set the Visible properties of ALL the bands to FALSE.
Then, in the REVERSE order of the saved position, make each Band one-by-one visible again. This will change the Positionvalues of the Bands.

If I have 3 Bands with inde 1,2,3 and the user has positioned them in the order 2,3,1 then you make them visible again in that order.
The next thing is to do is get the saved NewRow property values and assign them to the Bands - again, make sure that the item in position 1 doesn't get set.

The Sub that you call that sets the values of the cool bar MUST be called right AFTER the form is shown, otherwise it will not act right.

The last thing that needs to be done isthe form needs to be resized (you should have a Sub anyways that helps you out here)

by c1980

Point value changed by question poster.

The first answer works, and wasn't easy to impliment, but once set up it works most of the time - only the left and right locations (not order of position but actual screen locations) of each cool bar is not saved. The ORDER of position vertically and horizontally are OK.
It still just seems that there must be a "Cleaner" way - a way that was intended to create a persistent condition for a CoolBar. It seems to work in other MS programs.

DOES ANYONEELSE HAVE A BETTER IDEA?

by c1980

Point value changed by question poster.
Still looking for a better/easier way

This discussion is closed to new replies.