RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TToolBar.CanAutoSize Method

Indicates whether the toolbar can resize itself automatically to accommodate its contents.

Pascal
function CanAutoSize(var NewWidth: Integer; var NewHeight: Integer): Boolean; override;
C++
virtual __fastcall Boolean CanAutoSize(int NewWidth, int NewHeight);

CanAutoSize is called automatically when the AutoSize property is true and an attempt is made to resize the control. It allows the toolbar to implement the AutoSize property before the resize sequence that ends with the OnResize event. 

When CanAutoSize is called, the NewWidth and NewHeight parameters indicate the proposed new dimensions of the toolbar. CanAutoSize adjusts these values so that the toolbar's size adjusts to its buttons. If the adjustment results in values of NewWidth and NewHeight that differ from the control's current width and height, CanAutoSize returns true, indicating that the resize sequence should proceed. If, after adjustment, NewWidth and NewHeight equal Width and Height, CanAutoSize returns false, and the resize sequence is aborted. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!