Criar novo indice para um TToolButton de um TToolbar

Top  Previous  Next

  The property Index of a TToolButton is Read-Only, 

  with this example we put full access of the property ;) 

} 

 

// --- Put in the Private section of Class TToolButton 

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