45
TMS SOFTWARE
TADVSTRINGGRID
DEVELOPERS GUIDE
76 | Page
procedure AddExpandButton(ACol,ARow, ExpandedHeight: Integer);
function HasExpand(ACol,ARow: Integer): Boolean;
procedure RemoveExpand (ACol,ARow: Integer);
procedure ToggleExpand(ACol,ARow: Integer);
function GetExpandState(ACol,ARow: Integer): Boolean;
function GetExpandHeight(ACol,ARow:Integer; Expand:Boolean): Integer;
The AddExpandButton() function will add an expander button to a cell. The ExpandedHeight
parameter sets the height of the row in expanded state. The collapsed row height is by default the
height of the row before the row gets expanded. The function HasExpand() will return true when a
grid has such expand/collaps button and RemoveExpand() will remove any existing expand/collaps
button from the cell. ToggleExpand() will simply toggle the state of the row from collaps to expand
and vice versa. Finally, the function GetExpandState() will return true when the row is in expanded
state or false when not. The GetExpandHeight() function will return the height of an expanded row
when the Expand parameter is true and the normal height of the row when Expand parameter is
false.
Progressbars and ProgressPie
Two types of progress indicators can be displayed in a grid cell: a rectangular progress bar and a
circular pie type progress indicator. The AddProgress method provides two color parameters, one
for the zero to current position part of the progress bar and one for the current position to end part
of the bar. With the AddProgressEx method, additional color settings for font color in both parts is
possible. The progress bar fills the complete cell and as such the position of the progress bar
reflects a value between 0 and 100 set in the cell text.
procedure AddProgress(ACol,ARow: Integer;FGColor,BKColor: TColor);
procedure AddProgressEx(ACol,ARow:
Integer;FGColor,FGTextColor,BKColor,BKTextColor: TColor);
procedure AddProgressFormatted(ACol,ARow:
Integer;FGColor,FGTextColor,BKColor,BKTextColor: TColor; Fmt: string; Min,
Max: Integer);
procedure RemoveProgress(ACol,ARow: Integer);
procedure AddAdvProgress(ACol,ARow: Integer;Min:integer=0;Max:integer=100);
procedure RemoveAdvProgress(ACol,ARow: Integer);
Example: adding progressbar and setting position to 50
Grid.AddProgress(2,3,clRed,clWhite);
Grid.Ints[2,3] := 50;
A method is available AddProgressFormatted that allows to include the numeric formatting of the
value in the progressbar, as shown in this code snippet:
begin
AdvStringGrid1.AddProgressFormatted(1,1,clRed,clBlack,clInfoBk,clBlue,'%d
kb/sec',0,1000);
AdvStringGrid1.Ints[1,1] := 565;
end;