Click to See Complete Forum and Search --> : Need help with sub controls


billwilson3
May 28th, 2004, 07:39 PM
I need to be able to localize the buttons on a toolbar on the fly. (along with other controls).

The Toolbar control has a buttons collection of the buttons on the bar. Unfortunately the items in the collections are not members of the Button class, they are ToolbarButtons instead. Buttons derive from the Control class and all inherit properties like Name (which is used to locate the replacement text in the rez file. The ToolbarButton class derives from Component. This class does not contain a name, nor does the Toobarbutton class. When I look at the property sheet for a toolbar and check the Buttons collection, I see names for the buttons that match the names in the rez file. Where are these names related to the button objects? I cannot find it anywhere.

Thanks, Bill

Viperius
May 29th, 2004, 01:55 AM
Hi, i don't know about the names in the rez file, but can't you create a new class derived from ToolbarButtons, with an added property "Name" or something? This way you could ID them. (haven't worked with the Toolbar control yet, so don't know if thats possible...)

billwilson3
May 31st, 2004, 12:46 PM
When I get the list of buttons from the toolbar, they are ToolBarButton objects. I can wrap them and name the wrappers, but its too late by then. I need to get the name the actual developer used when he added the buttons to the toolbar.

I'm thinking about requiring them to name the buttons according to a convention. Something like MyToolba_buton1, etc. That way my program can deduce the name from the toolbar's name and the button position.

billwilson3
May 31st, 2004, 12:48 PM
Viperius,

I forgot to mention, thanks for the suggestion.