Q: Is there an easy way to assign speedbutton properties via iteration at runtime? (The Speedbutton properties in my application are very dynamic.) That is I don't want to have to do the following for every speedbutton property that changes:
Toolbar.Speedbutton1.Glyph := GetGlyph(1);
Toolbar.Speedbutton2.Glyph := GetGlyph(2);
But rather something that like
For I := 1 to NumSpeedButtons do
Toolbar.Speedbutton[I].Glyph := GetGlyph(I);
A: This code fragment might put you on the right track. It iterates through all the components on the form. I suppose you could use the Tag property to control which Glyph is which in your GetGlyph function.
for I := 0 to ComponentCount-1 do
if Components[I] is TSpeedbutton then
TSpeedButton(Components[I]).Glyph := GetGlyph();
Another option is to build your own array just for SpeedButtons (much
like TForm builds it for all components).