set Tool position by code


06-30-2009, 6:25 AM
Hi.
Can someone help me out with this:
I'd like to add new tool from code and need to change the position of the newly added tool inside the band.
In other words: assume we have band with 4 tools and I'd like to add new tool after 2-nd tool.

ActiveBar.Bands(BandName).Tools.Add ToolID, ToolName

Thanks in advance.

Ilia

Re: set Tool position by code


06-30-2009, 6:55 AM
zazaturman,

First, you can add a new Tool to collection by using Tools.Add method:
Set buttonTool = ActiveBar31.Tools.Add(111, "NewTool")
buttonTool.Caption = "NewTool"
buttonTool.Style = 3

After this you can insert newly created tool by using Insert method:

ActiveBar31.Bands("Band1").Tools.Insert 2, ActiveBar31.Tools("NewTool")

Please find the attched sample which adds new tool to band after 2nd tool.

Thank you,
Andrey T.