Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

How to modify by code the buttons order in a TLMDToobar

I want to do reorder buttons in a TLMDToolbar. 
I try to use this piece of code

  For i:=0 To LMDToolBar1.Buttons.Count-1 Do Begin
    LMDToolBar1.Button[i].Index:=LMDToolBar1.Buttons.Count-1-i
  End;

But this line has no effect, it seems that the property "index"  is readonly!! I don't find an information on the component TLMDToolbar (Help or Website...)
How can do it?

Gerard.

Comments

  • 1 Comment sorted by Votes Date Added
  • Hi,

    >>But this line has no effect, it seems that the property "index"  is readonly!<<
    No. Your code makes no sense. You don't observe that changing index of one item does change index of all other items.
    You must treat list more like a queue.

    One example for correct code would be:

      for i := 0 to LMDToolBar1.Buttons.Count-2 do
        LMDToolBar1.Buttons[LMDToolBar1.Buttons.Count-1].Index := i;

    >>I don't find an information on the component TLMDToolbar (Help or Website...)<
    Buttons object is a simple collection.
Sign In or Register to comment.