Mega Code Archive

 
Categories / Delphi / Examples
 

How to Set a new Index to TToolButton of a TToolbar

Title: How to Set a new Index to TToolButton of a TToolbar procedure SetIndex(Value: integer); // --- Modify in the Public section of Class TToolButton property Index: Integer read GetIndex write SetIndex; // --- Implementation procedure TToolButton.SetIndex(Value: integer); begin if FToolBar nil then begin FToolBar.FButtons.Move(Self.Index,Value); FToolBar.RepositionButtons(FToolBar.FButtons.Count-1); FToolBar.RecreateButtons; UpdateControl; end; end;