Toolbar Problem

greenspun.com : LUSENET : MW Software's Visual BASIC Descusion System : One Thread

I'm having a very frustrating problem with the common controls toolbar. It seems like it would be a simple task, but has proven quite difficult.

I have a toolbar in an application which has a three-button group for alignments (left, center, right). When you press one button, the one that was pressed before should unpress, like in WordPad, for example. When in the group, this works perfectly when you actually click the button. However, I have menu options that represent the same alignment choices. When you change the alignment via the menu option, the buttons' value do not properly update. In other words, if I start the application with the left alignment on by default, go to the menu option and select to right align the text from the menu option, while the right align button is pressed properly, the left one in not unpressed properly with the .value setting. I even thought about and actually tried switching it around so that the code for the procedures is in the actual toolbar2_buttonclick and then called from the menus. However, no matter what I put in the ??? of toolbar2_buttonclick(???) it produces type mismatch no matter how it's used outside of the actual toolbar events. I have placed a small (>3k) demonstration of this problem online as a project. If anyone can help, you can download the demo from ftp://ftp.cdhnow.com/code.zip. Any and all help is greatly appreciated and a resolution would be worshipped. :)

Thank you,

Chris Hoffman CDH Productions support@cdhnow.com http://www.cdhnow.com ***************************** Member of the Association of Shareware Professionals (ASP)

-- Chris Hoffman (info@cdhnow.com), June 07, 1999

Answers

I had the same frustration and rec'd the answer from Joacim Andersson (joacim@programmer.net, who I found on vb-world forum. in the mnuAlign?_Click sub try the following Call toolbar2_ButtonClick(toolbar2.Buttons(the tag you gave for the button")). Also try adding toolbar2.Buttons.Item("tag name").Value= tbrPressed

For example My toolbar name i tlbMain and onr of the buttons has the tag "Open". My code in a _Click subroutine i

Call tlbMain_ButtonClick(tlbMain.Buttons("Open")) tlbMain.Buttons.Item("Open").Value= tbrPressed

Good luck

Now if someone can help me with my Data Report question ....

-- Chet Maple (cmaple@nemonet.com), September 10, 1999.


Moderation questions? read the FAQ