1255
|
The Change event is called before changing the value. Is there any event such as Changed that is called after updating the cell's value
// Changed event - Occurs after the user has changed the content of a cell.
procedure TForm1.Grid1Changed(ASender: TObject; Item : HITEM; ColIndex : Integer);
begin
with Grid1 do
begin
OutputDebugString( Items.CellValue[OleVariant(Item),OleVariant(ColIndex)] );
end
end;
with Grid1 do
begin
BeginUpdate();
(IUnknown(Columns.Add('Edit')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.EditType;
Items.AddItem('Item 1');
Items.AddItem('Item 2');
EndUpdate();
end
|
1254
|
How can I reposition the +/- (expand/collapse) icon to show as "number, icon, text" (sample 2)
// AnchorClick event - Occurs when an anchor element is clicked.
procedure TForm1.Grid1AnchorClick(ASender: TObject; AnchorID : WideString; Options : WideString);
begin
with Grid1 do
begin
i := FormatABC('int(value)',OleVariant(AnchorID),Null,Null);
with Items do
begin
i := ItemByIndex[i];
exp := ExpandItem[i];
ExpandItem[i] := False;
end;
end
end;
with Grid1 do
begin
BeginUpdate();
HTMLPicture['expand'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYc7YYBY5vVBkiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyxgjsRzEKv1TqtXrNbrtfsIAwgASAHA' +
'GShQwGQzGABUGEzudAqgyWdSmWw2Fw+sABSHI4AGH1XAGAxGAwywlI6eRqjGi1YuaJJEIJUHBPYqSJYKQAwCBDKbBPbncBibrUKQjGLFQo+TBFfR5GaUAR/KbGICyRxs' +
'iCOQClgdJxGoMpkGycpdDqUZ0EoJQJHYVoWCSCA4kEbRlHKRwJiYcYCH0PBNB2JwYCaCRsGcE8LDyfZKg+U59EsAZMlQCgJkcEA9CsywkiKJwiFcIQwEEgI=';
HTMLPicture['collapse'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYU7YQBCooJSAiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyzyO13dGEAGYzWcqlWrFarlesA3AGcS' +
'AHAGShQwGQzGABUGEv2TAAFUGS26Uy2GwuH1wAKQ5HAAw+s4YwGIwGGWISpVLiXT5MrxiJyJJEIJUHBPYqSXYOQAgBgAB6jJwufxxX7YYhdYhFCSsSwSC4uMLoQajNJA' +
'G8QgZAgSIqGMCwRBkAJDicGwuiMeoHGeaRFlAU5qDwQQ6A+CYnlgPQeisGJfl4AJYhsRISjQYwJHIcpmmALAtlMEpkE4YBREmEpPBAARdicSw8AES5fi+fI5g+PpcAAU' +
'JKgyCYknaZRrssJIiicIhXCEMBBICA==';
HTMLPicture['empty'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYE7YABNTWRIJiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyy/O13dGEAGYzWcqlWrFarlesA3AGcS' +
'AHAGShQwGQzGABUGEv2TAAFUGS26Uy2GwuH1wAKQ5HAAw+s4YwGIwGGWYSvDpndpkQ9xhRTJJEIJUHBPdqSGIKYAwBgDUpCfytH57FqoVaTKQTGS0DJ6cDBDzOGwIfAN' +
'HMIxJDmf5CFIAxwA4Q5HEQVJlEWRxnBkMANjsPoqBSEAElkfZ5CMFJMHCC52BALBGjkDpHCuXIAB2bQdEGaQgFIbbLCSIonCIVwhDAQSAg==';
HeaderVisible := False;
HasLines := EXGRIDLib_TLB.exNoLine;
HasButtons := EXGRIDLib_TLB.exNoButtons;
Indent := 12;
DefaultItemHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exHLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
GridLineColor := RGB(204,204,204);
ShowFocusRect := False;
ExpandOnDblClick := False;
ExpandOnKeys := False;
with Columns do
begin
with (IUnknown(Add('Item')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1);
FormatColumn := '(len(parent(1 index ``)) ? (`<b><fgcolor gray>` + (1 pos ``) + `. ` + `</fgcolor></b>` + (%CC0 ? (`<a ` + (0 index ``) + `>`) : ' +
'``) + `<img>` + (%CC0 ? (not %CX0 ? `expand` : `collapse`) : `empty`) + `:16</img>` + (%CC0 ? (`</a>`) : ``)) : ``) + ` ` + valu' +
'e';
with Editor do
begin
EditType := EXGRIDLib_TLB.EditType;
Option[EXGRIDLib_TLB.exEditorAdjustPos] := '32 4 -4 -4';
end;
end;
end;
with Items do
begin
hRoot := AddItem('ACME Corporation');
SelectableItem[hRoot] := False;
ExpandItem[hRoot] := True;
h := InsertItem(hRoot,Null,'Management');
InsertItem(h,Null,'CEO - Alice Brown');
InsertItem(h,Null,'COO - James Lee');
h := InsertItem(hRoot,Null,'HR Department');
InsertItem(h,Null,'Recruiter - Jane Smith');
InsertItem(h,Null,'HR Assistant - Bob Green');
ExpandItem[h] := True;
h := InsertItem(h,Null,'Engineering');
InsertItem(h,Null,'Software Team');
h := InsertItem(h,Null,'Lead Developer - Mark H.');
InsertItem(h,Null,'Frontend Dev - Emily R.');
InsertItem(h,Null,'Backend Dev - Tom W.');
InsertItem(hRoot,Null,'QA Team');
end;
EndUpdate();
end
|
1253
|
How can I reposition the +/- (expand/collapse) icon to show as "number, icon, text" (sample 1)

// AnchorClick event - Occurs when an anchor element is clicked.
procedure TForm1.Grid1AnchorClick(ASender: TObject; AnchorID : WideString; Options : WideString);
begin
with Grid1 do
begin
i := FormatABC('int(value)',OleVariant(AnchorID),Null,Null);
with Items do
begin
i := ItemByIndex[i];
exp := ExpandItem[i];
ExpandItem[i] := False;
end;
end
end;
with Grid1 do
begin
BeginUpdate();
HTMLPicture['expand'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYc7YYBY5vVBkiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyxgjsRzEKv1TqtXrNbrtfsIAwgASAHA' +
'GShQwGQzGABUGEzudAqgyWdSmWw2Fw+sABSHI4AGH1XAGAxGAwywlI6eRqjGi1YuaJJEIJUHBPYqSJYKQAwCBDKbBPbncBibrUKQjGLFQo+TBFfR5GaUAR/KbGICyRxs' +
'iCOQClgdJxGoMpkGycpdDqUZ0EoJQJHYVoWCSCA4kEbRlHKRwJiYcYCH0PBNB2JwYCaCRsGcE8LDyfZKg+U59EsAZMlQCgJkcEA9CsywkiKJwiFcIQwEEgI=';
HTMLPicture['collapse'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYU7YQBCooJSAiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyzyO13dGEAGYzWcqlWrFarlesA3AGcS' +
'AHAGShQwGQzGABUGEv2TAAFUGS26Uy2GwuH1wAKQ5HAAw+s4YwGIwGGWISpVLiXT5MrxiJyJJEIJUHBPYqSXYOQAgBgAB6jJwufxxX7YYhdYhFCSsSwSC4uMLoQajNJA' +
'G8QgZAgSIqGMCwRBkAJDicGwuiMeoHGeaRFlAU5qDwQQ6A+CYnlgPQeisGJfl4AJYhsRISjQYwJHIcpmmALAtlMEpkE4YBREmEpPBAARdicSw8AES5fi+fI5g+PpcAAU' +
'JKgyCYknaZRrssJIiicIhXCEMBBICA==';
HeaderVisible := False;
HasLines := EXGRIDLib_TLB.exNoLine;
HasButtons := EXGRIDLib_TLB.exNoButtons;
Indent := 12;
DefaultItemHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exHLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
GridLineColor := RGB(204,204,204);
ShowFocusRect := False;
ExpandOnDblClick := False;
ExpandOnKeys := False;
with Columns do
begin
with (IUnknown(Add('Item')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1);
FormatColumn := '(len(parent(1 index ``)) ? (`<b><fgcolor gray>` + (1 pos ``) + `. ` + `</fgcolor></b>` + `<a ` + (0 index ``) + `><img>` + (%CC0' +
' ? (not %CX0 ? `expand` : `collapse`) : ``) + `:16</img></a>`) : ``) + ` ` + value';
end;
end;
with Items do
begin
hRoot := AddItem('ACME Corporation');
SelectableItem[hRoot] := False;
ExpandItem[hRoot] := True;
h := InsertItem(hRoot,Null,'Management');
InsertItem(h,Null,'CEO - Alice Brown');
InsertItem(h,Null,'COO - James Lee');
h := InsertItem(hRoot,Null,'HR Department');
InsertItem(h,Null,'Recruiter - Jane Smith');
InsertItem(h,Null,'HR Assistant - Bob Green');
ExpandItem[h] := True;
h := InsertItem(h,Null,'Engineering');
InsertItem(h,Null,'Software Team');
h := InsertItem(h,Null,'Lead Developer - Mark H.');
InsertItem(h,Null,'Frontend Dev - Emily R.');
InsertItem(h,Null,'Backend Dev - Tom W.');
InsertItem(hRoot,Null,'QA Team');
end;
EndUpdate();
end
|
1252
|
Expandable bullet list

// AnchorClick event - Occurs when an anchor element is clicked.
procedure TForm1.Grid1AnchorClick(ASender: TObject; AnchorID : WideString; Options : WideString);
begin
with Grid1 do
begin
i := FormatABC('int(value)',OleVariant(AnchorID),Null,Null);
with Items do
begin
i := ItemByIndex[i];
exp := ExpandItem[i];
ExpandItem[i] := False;
end;
end
end;
with Grid1 do
begin
BeginUpdate();
HTMLPicture['expand'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYM7YIBXCRNbtiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyzZO13dGEAGYzWcqlWrFarlesA3AGcS' +
'AHAGShQwGQzGABUGEv2TAAFUGS26Uy2GwuH1wAKQ5HAAw+s4YwGIwGGWNa6awbST7DBTiLyJJEIJUHBPUqSGJuYYwCAES5pBiQfyEX4QKAFH6QSihJQ/GZlET1FhIcgG' +
'nUdoVHMmxajSIghlMKhsGiAAFggQ5dmKcRHEUEhbFAFQBgacABmAAJgAAcAJkAZgNjUcwDFecYcD8QoIDsGJjD6aYaGyHI7mqLRfgGfBcg+TYggkEhakQThtFsEpAE2X' +
'h7goSIJiSHp6haKgPGOXx3j+c5hiKLpri6JAPHWYJREuFJkBCYxcFeYS7ikJQzG0ZIVGKMBYGsVwXDWVQHjqfpjAoYpyE4Z5vH2YoHDkZwzkkUxHC8pwCgifIHBCdk4G' +
'MLQVmcXJVhicxWi4IIUiKSQ1A8cBUj+eBEGCFQlFSIophiPRkFAWBLFALhwm+HhKjARpmgSGwNn4AIUCcZZUFEKoVmwywkiKJwiFcIQwEEgI';
HTMLPicture['collapse'] := 'gCJKBOI4NBQaBQAhQNJJIIhShQACERCAIA0RD7zf5hiIBOZSI5CACuZwcdMRAhnIJNIMKWKPBb8MIFiIJOBILJzhQOYM7YIBXCRNbtiIYOhFLB0KZvMx0O5hORlABQMJ' +
'pNx0FxOIpUEA1FwxFw3RbWe45iK2MpYJJmJJJFQABERmgaAM0AMRJURDd1AF3hUQhQoAIDvsRAURGIBw8ThRaiJpQ4EwsKNURyzZO13dGEAGYzWcqlWrFarlesA3AGcS' +
'AHAGShQwGQzGABUGEv2TAAFUGS26Uy2GwuH1wAKQ5HAAw+s4YwGIwGGWNa6awbST7DBTiLZJJEIJUHBPdpSGKOAQxCAzGhIBKfbAvUBsSIPbiVMhLTxJPK3banJB0N5s' +
'A8VQRlmCRKjSCRaAIOgCiORISiWaI0DYLJPBYJBxB+LAqAMBRgAsIABjAAhYAOEB5kKDQ5kGZoaCaL5vH2KoEDCbpbDaWRrE8SopE+AA/DcMoZkgAgkhKERDlcdYEHAJ' +
'Rzg4IpyCAKRyl6HZLGONwMEMb5clwWB3n2CZki6FoWC4cwQCbGYukKwhiAwOp3HIEJFGCNBGDyLArE8R56n4RUnlOShHGcXJdgcKQlCOSRdEcLw8DmAoInyexvFeMRGG' +
'0DARmsbRZmsfRxleFZeHoD4eEKKRxGmPANgAC5xDAWpYHMW4uCGywkiKJwiFcIQwEEgI';
HeaderVisible := False;
HasLines := EXGRIDLib_TLB.exNoLine;
HasButtons := EXGRIDLib_TLB.exNoButtons;
Indent := 12;
DefaultItemHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exHLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
GridLineColor := RGB(204,204,204);
ShowFocusRect := False;
ExpandOnDblClick := False;
ExpandOnKeys := False;
with Columns do
begin
with (IUnknown(Add('Item')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1);
FormatColumn := '(len(parent(1 index ``)) ? (`<b><fgcolor gray>` + (1 pos ``) + `. ` + `</fgcolor></b>` + `<a ` + (0 index ``) + `><img>` + (%CC0' +
' ? (not %CX0 ? `expand` : `collapse`) : `collapse`) + `:16</img></a>`) : ``) + ` ` + value';
with Editor do
begin
EditType := EXGRIDLib_TLB.EditType;
Option[EXGRIDLib_TLB.exEditorAdjustPos] := '32D 4D -4D -4D';
end;
end;
end;
with Items do
begin
hRoot := AddItem('ACME Corporation');
SelectableItem[hRoot] := False;
ExpandItem[hRoot] := True;
h := InsertItem(hRoot,Null,'Management');
InsertItem(h,Null,'CEO - Alice Brown');
InsertItem(h,Null,'COO - James Lee');
h := InsertItem(hRoot,Null,'HR Department');
InsertItem(h,Null,'Recruiter - Jane Smith');
InsertItem(h,Null,'HR Assistant - Bob Green');
ExpandItem[h] := True;
h := InsertItem(h,Null,'Engineering');
InsertItem(h,Null,'Software Team');
h := InsertItem(h,Null,'Lead Developer - Mark H.');
InsertItem(h,Null,'Frontend Dev - Emily R.');
InsertItem(h,Null,'Backend Dev - Tom W.');
InsertItem(hRoot,Null,'QA Team');
end;
EndUpdate();
end
|
1251
|
Does grouping support multi-column sorting

with Grid1 do
begin
BeginUpdate();
SingleSort := False;
HeaderVisible := False;
DrawGridLines := EXGRIDLib_TLB.exRowLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
AllowGroupBy := True;
Columns.Add('Prefix');
Columns.Add('Region');
Columns.Add('City');
with (IUnknown(Columns.Add('Sort')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 + %2';
Visible := False;
end;
with Items do
begin
h := AddItem('+33');
CellValue[OleVariant(h),OleVariant(1)] := 'Corsica';
CellValue[OleVariant(h),OleVariant(2)] := 'Bastia ';
h := AddItem('+33');
CellValue[OleVariant(h),OleVariant(1)] := 'Occitanie';
CellValue[OleVariant(h),OleVariant(2)] := 'Toulouse ';
h := AddItem('+33');
CellValue[OleVariant(h),OleVariant(1)] := 'Corsica';
CellValue[OleVariant(h),OleVariant(2)] := 'Ajaccio';
h := AddItem('+33');
CellValue[OleVariant(h),OleVariant(1)] := 'Occitanie';
CellValue[OleVariant(h),OleVariant(2)] := 'Carcassonne ';
end;
Layout := 'multiplesort="C0:2";singlesort="C3:1";';
EndUpdate();
end
|
1250
|
How can I vertically scroll the control
with Grid1 do
begin
BeginUpdate();
ColumnAutoResize := False;
DataSource := (IUnknown((IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('DAO.DBEngine.120'))) as DAO_TLB.PrivDBEngine).OpenDatabase('C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',Null,Null,Null).OpenRecordset('Orders',Null,Null,Null)) as DAO_TLB.Recordset2);
Layout := 'Collapse="";VScroll=10';
EndUpdate();
end
|
1249
|
Export the items as a two-dimensional array

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
PutItems(Export('array','all'),Null);
EndUpdate();
end
|
1248
|
Export only expanded items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(expanded)') );
end
|
1247
|
Export only selectable, sortable leaf items that are neither locked nor dividers

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(leaf,sortable,selectable,!divider,!locked)') );
end
|
1246
|
Export only non-divider items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(!divider)') );
end
|
1245
|
Export only selectable items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(selectable)') );
end
|
1244
|
Export only sortable, but not locked items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(sortable,!locked)') );
end
|
1243
|
Export only checked items on specified column

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(checked[0])') );
end
|
1242
|
Export only filtered, not locked or divider items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(visible,!locked,!divider)') );
end
|
1241
|
Export only selected items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(selected)') );
end
|
1240
|
Export only locked items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','only(locked)') );
end
|
1239
|
Export the leaf items of the control, excluding parent or grouped items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','leaf') );
end
|
1238
|
Export all checked and visible items (the first column in the columns list specifies the index of the column used to query the checkbox state)

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','chk') );
end
|
1237
|
Export the selected-items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','sel') );
end
|
1236
|
Export the visible items, excluding child items of collapsed elements, non-visible items (such as those with a height of 0), and items that do not match the current filter

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','vis') );
end
|
1235
|
Export all items, including the hidden or collapsed items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
ScrollBySingleLine := True;
LinesAtRoot := EXGRIDLib_TLB.exGroupLinesOutside;
with Columns do
begin
with (IUnknown(Add('Desc')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
FormatColumn := 'currency(value)';
end;
end;
with Items do
begin
LockedItemCount[EXGRIDLib_TLB.exTop] := 1;
h := LockedItem[EXGRIDLib_TLB.exTop,0];
CellValue[OleVariant(h),OleVariant(0)] := 'All';
CellValue[OleVariant(h),OleVariant(1)] := 'sum(all,rec,%1)';
CellValueFormat[OleVariant(h),OleVariant(1)] := EXGRIDLib_TLB.exTotalField;
r := AddItem('Root 1');
g1 := InsertItem(r,Null,'Group A');
CellValue[OleVariant(InsertItem(g1,Null,'Item 1')),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(InsertItem(g1,Null,'Item 2')),OleVariant(1)] := OleVariant(2);
CellState[OleVariant(ItemByIndex[3]),OleVariant(0)] := 1;
g2 := InsertItem(r,Null,'Group B');
CellValue[OleVariant(InsertItem(g2,Null,'Item 3')),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(InsertItem(g2,Null,'Item 4')),OleVariant(1)] := OleVariant(4);
ExpandItem[g1] := True;
ExpandItem[r] := True;
h := AddItem('divider');
ItemDivider[h] := 0;
SelectableItem[h] := False;
SortableItem[h] := False;
ItemHeight[h] := 1;
r := AddItem('Root 2');
g1 := InsertItem(r,Null,'Group C');
CellValue[OleVariant(InsertItem(g1,Null,'Item 5')),OleVariant(1)] := OleVariant(5);
CellValue[OleVariant(InsertItem(g1,Null,'Item 6')),OleVariant(1)] := OleVariant(6);
SelectItem[ItemByIndex[2]] := True;
end;
EndUpdate();
OutputDebugString( Export('','all') );
end
|
1234
|
Bolds only the expanded items

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
ConditionalFormats.Add('%CX0',Null).Bold := True;
Columns.Add('Description');
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(InsertItem(h,Null,'Child 2'),Null,'Sub-Child 2');
CellState[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(0)] := 1;
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
InsertItem(h,Null,'Child 3');
end;
EndUpdate();
end
|
1233
|
Displays the root item's index and value/caption using expressions

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
AutoDrag := EXGRIDLib_TLB.exAutoDragPositionAny;
AllowCopyPaste := Integer(EXGRIDLib_TLB.exAllowPaste) Or Integer(EXGRIDLib_TLB.exAllowCut) Or Integer(EXGRIDLib_TLB.exAllowCopy);
SingleSel := False;
DrawGridLines := EXGRIDLib_TLB.exRowLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
GridLineColor := RGB(208,208,208);
ConditionalFormats.Add('%CC0 and %CX0',Null).Bold := True;
with ConditionalFormats.Add('1',Null) do
begin
Bold := True;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2);
end;
with (IUnknown(Columns.Add('Description')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
with (IUnknown(Columns.Add('Index')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := '1 index ``';
Position := 0;
Width := 16;
end;
with (IUnknown(Columns.Add('Root-Index')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := 'root(1 index ``)';
Position := 1;
Width := 32;
Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(15790320);
end;
with (IUnknown(Columns.Add('Root-Value')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := 'root(%0)';
Position := 2;
Width := 32;
Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(15790320);
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(InsertItem(h,Null,'Child 2'),Null,'Sub-Child 2');
CellState[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(0)] := 1;
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
InsertItem(h,Null,'Child 3');
ExpandItem[h] := True;
end;
EndUpdate();
end
|
1232
|
Displays the parent item's index and caption/value using expressions

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
AutoDrag := EXGRIDLib_TLB.exAutoDragPositionAny;
AllowCopyPaste := Integer(EXGRIDLib_TLB.exAllowPaste) Or Integer(EXGRIDLib_TLB.exAllowCut) Or Integer(EXGRIDLib_TLB.exAllowCopy);
SingleSel := False;
DrawGridLines := EXGRIDLib_TLB.exRowLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesSolid;
GridLineColor := RGB(208,208,208);
ConditionalFormats.Add('%CC0 and %CX0',Null).Bold := True;
with ConditionalFormats.Add('1',Null) do
begin
Bold := True;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2);
end;
with (IUnknown(Columns.Add('Description')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exCellHasCheckBox] := OleVariant(True);
PartialCheck := True;
end;
with (IUnknown(Columns.Add('Index')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := '1 index `I`';
Position := 0;
Width := 16;
end;
with (IUnknown(Columns.Add('Parent-Index')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := 'parent(1 index `I`)';
Position := 1;
Width := 32;
Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(15790320);
end;
with (IUnknown(Columns.Add('Parent-Value')) as EXGRIDLib_TLB.Column) do
begin
FormatColumn := 'parent(%0)';
Position := 2;
Width := 32;
Def[EXGRIDLib_TLB.exCellBackColor] := OleVariant(15790320);
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(InsertItem(h,Null,'Child 2'),Null,'Sub-Child 2');
CellState[OleVariant(InsertItem(h,Null,'Child 3')),OleVariant(0)] := 1;
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
InsertItem(h,Null,'Child 3');
ExpandItem[h] := True;
end;
EndUpdate();
end
|
1231
|
Copying and Pasting the Selection Programmatically
with Grid1 do
begin
BeginUpdate();
Columns.Add('Tasks');
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
SingleSel := False;
with Items do
begin
AddItem('Tasks');
SelectItem[AddItem('Task 1')] := True;
SelectItem[AddItem('Task 2')] := True;
end;
IndentSelection(OleVariant(False));
CopySelection();
Items.UnselectAll();
Paste(Null);
EndUpdate();
end
|
1230
|
Enable Copy, Cut and Paste Clipboard operations
with Grid1 do
begin
BeginUpdate();
Columns.Add('Tasks');
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
AllowCopyPaste := Integer(EXGRIDLib_TLB.exAllowPaste) Or Integer(EXGRIDLib_TLB.exAllowCut) Or Integer(EXGRIDLib_TLB.exAllowCopy);
SingleSel := False;
with Items do
begin
AddItem('Tasks');
SelectItem[AddItem('Task 1')] := True;
SelectItem[AddItem('Task 2')] := True;
end;
IndentSelection(OleVariant(False));
EndUpdate();
end
|
1229
|
Adjusts the hierarchy of selected items by changing their parent

with Grid1 do
begin
BeginUpdate();
Columns.Add('Tasks');
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
SingleSel := False;
with Items do
begin
AddItem('Tasks');
SelectItem[AddItem('Task A')] := True;
SelectItem[AddItem('Task B')] := True;
end;
IndentSelection(OleVariant(False));
EndUpdate();
end
|
1228
|
Specify the size of the Columns panel

with Grid1 do
begin
BeginUpdate();
HeaderHeight := 24;
HeaderAppearance := EXGRIDLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False;
end;
ColumnsFloatBarRect := ',,96';
ColumnsFloatBarVisible := Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleAsChild) Or Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns);
EndUpdate();
end
|
1227
|
Show a vertical line between pivot and Columns panel (EBN color)

with Grid1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABRsIQAAYAQGKIYBkAKBQAGaAoDDUNQxQwAAxwfBMKgBBCLIxhEYobgmGIXRpFICQTIcBhaGIZRiAKCRTDmHwyRCNIwCLD8QxtDqBY4gOZZXh' +
'al4cJTgMaBYi+Pw3DZHcbvBRkewzHQAKgnSjoDhEMg1CTVVYTDKdOSzDyEX7sIAACpOIZQVJVEY1VT8cyxIyEZimSypWqiYJ0Ty6cQwTAIgI');
Background[EXGRIDLib_TLB.exColumnsFloatBackColor] := $1000000;
HeaderHeight := 24;
HeaderAppearance := EXGRIDLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False;
end;
ColumnsFloatBarVisible := Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleAsChild) Or Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns);
EndUpdate();
end
|
1226
|
Change the background of the Columns panel (EBN color)

with Grid1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABNoCg6AADACAxRDAMgBQKAAzQFAYahqGKGAAGOD4JhUAIIRZGMIjFDcEwxC6NIpAWLoJDCH4mSTHYxgJIMWwzDiBZgkCA4fiGEYnThCIxzTJ' +
'0aw1CKbYRAKCUKoUAJFsSnQAJIgOO4lULPMIhDDQKQTIKBahoehqIhaEQyDSJNb2DCIahhMSEbKtCooDhGFZUWzLVxTJJNawHJqJJDuOTpSjKH4+RjWFKUXR9b4BJSNA' +
'gqeCQTiSWZEVxRUS0XbGCyZLSQY7uAAMKgOVoDYzdGLwHTtOwrMa1QAsDSbKqWZ5uRpHcQ5aAGN5DPbMbqwOaqLznAaLQLtG4RTikVRPTDYaj437+OaHGyNbI6HTNPpT' +
'lWDJWjYXI8l8C4fg6GYAAEEISgGJJGHQOocgyIwYnqKhYAAIQTH2MYRjQJBRAmZptmEAYIjGU5dk8UgOFgBJUgCTQIBYBoBmCCAmAqApghgDJUDmYQFCCZoEk2OBUm+B' +
'ZPCgZgagaYZIHYHoHmGWBcm8NwiEiFJVgmYgji4Kg6GKSI2C6C5jAiRgygwIojiycINkyeJmAYPJjkiTg+g+ZAIkCdIQkyWQWDuDxkBkJhKguZAzlIRQzGQc5ODWFJlE' +
'kVhWhWZYJFYTYTmUE4yF6F5mAmBhihiZhJhYX4WmQaAUnWGpOlmNhuhuZwJkYcocmcSY4naHZlkmKhrDuJ5JnYfofmgCgGgKIJnlmXJ2h4TQKBosRokoNoOiOaQKDSd4' +
'kmiChMncPBpgoZoaiaaZKHaHonmmE5iiKJRpDicomimaoKiaKoqmqSoeiIPgogqPotiyaxKlYPA+GuCqbBMa5KnaPovmwCwGj6LgP24RIhiyCwmkqMpsksNpKD6LQLBq' +
'OIzi0SxWlaHZtAOahPssM5Wi+IYtlsXpijKbZ5lyTo5mAE4UlqOpjHOQpEjubyanKPJvEuNgVj2TY1CCao+k2G52AyP5wAwBp9DYZZ1CCaxsAABAEICA');
Background[EXGRIDLib_TLB.exColumnsFloatBackColor] := $1000000;
HeaderHeight := 24;
HeaderAppearance := EXGRIDLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False;
end;
ColumnsFloatBarVisible := Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleAsChild) Or Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns);
EndUpdate();
end
|
1225
|
Change the background of the Columns panel (solid color)

with Grid1 do
begin
BeginUpdate();
HeaderHeight := 24;
HeaderAppearance := EXGRIDLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False;
end;
ColumnsFloatBarVisible := Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleAsChild) Or Integer(EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns);
Background[EXGRIDLib_TLB.exColumnsFloatBackColor] := $f0f0f0;
EndUpdate();
end
|
1224
|
Change the visual appearance of the Columns panel

with Grid1 do
begin
BeginUpdate();
VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABNoCg6AADACAxRDAMgBQKAAzQFAYahqGKGAAGOD4JhUAIIRZGMIjFDcEwxC6NIpAWLoJDCH4mSTHYxgJIMWwzDiBZgkCA4fiGEYnThCIxzTJ' +
'0aw1CKbYRAKCUKoUAJFsSnQAJIgOO4lULPMIhDDQKQTIKBahoehqIhaEQyDSJNb2DCIahhMSEbKtCooDhGFZUWzLVxTJJNawHJqJJDuOTpSjKH4+RjWFKUXR9b4BJSNA' +
'gqeCQTiSWZEVxRUS0XbGCyZLSQY7uAAMKgOVoDYzdGLwHTtOwrMa1QAsDSbKqWZ5uRpHcQ5aAGN5DPbMbqwOaqLznAaLQLtG4RTikVRPTDYaj437+OaHGyNbI6HTNPpT' +
'lWDJWjYXI8l8C4fg6GYAAEEISgGJJGHQOocgyIwYnqKhYAAIQTH2MYRjQJBRAmZptmEAYIjGU5dk8UgOFgBJUgCTQIBYBoBmCCAmAqApghgDJUDmYQFCCZoEk2OBUm+B' +
'ZPCgZgagaYZIHYHoHmGWBcm8NwiEiFJVgmYgji4Kg6GKSI2C6C5jAiRgygwIojiycINkyeJmAYPJjkiTg+g+ZAIkCdIQkyWQWDuDxkBkJhKguZAzlIRQzGQc5ODWFJlE' +
'kVhWhWZYJFYTYTmUE4yF6F5mAmBhihiZhJhYX4WmQaAUnWGpOlmNhuhuZwJkYcocmcSY4naHZlkmKhrDuJ5JnYfofmgCgGgKIJnlmXJ2h4TQKBosRokoNoOiOaQKDSd4' +
'kmiChMncPBpgoZoaiaaZKHaHonmmE5iiKJRpDicomimaoKiaKoqmqSoeiIPgogqPotiyaxKlYPA+GuCqbBMa5KnaPovmwCwGj6LgP24RIhiyCwmkqMpsksNpKD6LQLBq' +
'OIzi0SxWlaHZtAOahPssM5Wi+IYtlsXpijKbZ5lyTo5mAE4UlqOpjHOQpEjubyanKPJvEuNgVj2TY1CCao+k2G52AyP5wAwBp9DYZZ1CCaxsAABAEICA');
Background[EXGRIDLib_TLB.exColumnsFloatAppearance] := $1000000;
Background[EXGRIDLib_TLB.exColumnsFloatCaptionBackColor] := $f6f6f6;
BackColorHeader := $1000000;
HeaderHeight := 24;
HeaderAppearance := EXGRIDLib_TLB.Etched;
with Columns do
begin
Add('City');
(IUnknown(Add('Start')) as EXGRIDLib_TLB.Column).Visible := False;
(IUnknown(Add('End')) as EXGRIDLib_TLB.Column).Visible := False;
end;
Description[EXGRIDLib_TLB.exColumnsFloatBar] := 'Show/Hide';
ColumnsFloatBarVisible := EXGRIDLib_TLB.exColumnsFloatBarVisibleIncludeCheckColumns;
EndUpdate();
end
|
1223
|
Defines the symbol used to indicate repeated captions, providing a clear visual cue for identical entries (ditto mark)

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exRowLines;
(IUnknown(Columns.Add('Country')) as EXGRIDLib_TLB.Column).ShowIdem := '<fgcolor gray>〃';
with Items do
begin
AddItem('Spain');
AddItem('Spain');
AddItem('Spain');
AddItem('Spain');
AddItem('Germany');
AddItem('Germany');
AddItem('Germany');
AddItem('Germany');
end;
EndUpdate();
end
|
1222
|
Defines the symbol used to indicate repeated captions, providing a clear visual cue for identical entries (space)

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exRowLines;
(IUnknown(Columns.Add('Country')) as EXGRIDLib_TLB.Column).ShowIdem := ' ';
with Items do
begin
AddItem('Spain');
AddItem('Spain');
AddItem('Spain');
AddItem('Spain');
AddItem('Germany');
AddItem('Germany');
AddItem('Germany');
AddItem('Germany');
end;
EndUpdate();
end
|
1221
|
Displays a glitch funnel for drop-down filter buttons (empty or active)

with Grid1 do
begin
BeginUpdate();
with VisualAppearance do
begin
RenderType := -1;
Add(1,'gBFLBCJwBAEHhEJAAEhABa8IQAAYAQGKIYBkAKBQAGaAoDDUNQxQwAAxwfBMKgBBCLIxhEYobgmGIXRpFMbxCKQahLEiTIhGUYJHgmK4tRiAUgxVDkBxrECZYqjcBZOi' +
'wLQ2TxDM7DNKUCBnIoABhGOaYDh+IQNQjUFKwTRFGRxK4EIRKAyTDLQdRyGSMMbjdQpBCbMiMRqhESKRq2UwYRYCFS1NalaztO6BUAvK67YrWez/YBfF+SfwGeqDYReW' +
'APfgWERnQrGMLxbD8KwZAKTRjkGJ4XhuB41TbQMqufL9ByXHKSSDpGjaXjeO5VVjYNAvS69UzXNq3bhtQAOXCMEwCgI=');
Add(2,'CP:1 -2 0 0 0');
end;
DrawGridLines := EXGRIDLib_TLB.exAllLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesGeometric;
ShowFocusRect := False;
Background[EXGRIDLib_TLB.exHeaderFilterBarButton] := $2000000;
Background[EXGRIDLib_TLB.exHeaderFilterBarActive] := $2000001;
HeaderAppearance := EXGRIDLib_TLB.Etched;
BackColorHeader := RGB(255,255,255);
HeaderHeight := 24;
HeaderVisible := True;
with (IUnknown(Columns.Add('1st col')) as EXGRIDLib_TLB.Column) do
begin
DisplayFilterButton := True;
DisplayFilterPattern := False;
Filter := 'Item B';
FilterType := EXGRIDLib_TLB.exFilter;
end;
Columns.Add('2nd col');
with Items do
begin
AddItem('Item A');
AddItem('Item B');
AddItem('Item C');
end;
ApplyFilter();
EndUpdate();
end
|
1220
|
How can I store any extra data associated with a cell
// ButtonClick event - Occurs when user clicks on the cell's button.
procedure TForm1.Grid1ButtonClick(ASender: TObject; Item : HITEM; ColIndex : Integer; Key : OleVariant);
begin
with Grid1 do
begin
OutputDebugString( Items.CellData[OleVariant(Item),OleVariant(ColIndex)] );
end
end;
with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
with (IUnknown(Columns.Add('Def')) as EXGRIDLib_TLB.Column).Editor do
begin
EditType := EXGRIDLib_TLB.ButtonType;
Locked := True;
end;
with Items do
begin
CellData[OleVariant(AddItem('Cell 1')),OleVariant(0)] := 'your extra data for cell 1';
CellData[OleVariant(AddItem('Cell 2')),OleVariant(0)] := 'your extra data for cell 2';
end;
EndUpdate();
end
|
1219
|
How can I replace or add an icon at runtime

with Grid1 do
begin
BeginUpdate();
ReplaceIcon('gAAAABgYACEHgUJFEEAAWhUJCEJEEJggEhMCYEXjUbjkJQECj8gj8hAEjkshYEpk8kf8ClsulsvAExmcvf83js5nU7nkCeEcn8boMaocXosCB9Hn09pkzcEuoL/fE+Ok' +
'YB0gB9YhIHrddgVcr9aktZADAD8+P8CgIA==',Null);
ReplaceIcon('C:\images\favicon.ico',OleVariant(0));
(IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column).Def[EXGRIDLib_TLB.exCellValueFormat] := OleVariant(1);
Items.AddItem('Item <img>1</img>');
EndUpdate();
end
|
1218
|
How can I save the changes, such as column's width, order

// Click event - Occurs when the user presses and then releases the left mouse button over the grid control.
procedure TForm1.Grid1Click(ASender: TObject; );
begin
with Grid1 do
begin
Layout := 'Select="0";SingleSort="C0:2";Columns=1';
end
end;
with Grid1 do
begin
BeginUpdate();
Columns.Add('Column');
with Items do
begin
AddItem('Item 1');
AddItem('Item 2');
AddItem('Item 3');
end;
EndUpdate();
end
|
1217
|
How can I add totals to groups without having to go through the AddGroupItem grid function

with Grid1 do
begin
FreezeEvents(True);
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with ConditionalFormats do
begin
with Add('%CT1',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($1);
end;
with Add('%CT2',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2);
end;
with Add('%CT3',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($3);
end;
end;
with Columns do
begin
Add('Description');
with (IUnknown(Add('Qty')) as EXGRIDLib_TLB.Column) do
begin
Editor.EditType := EXGRIDLib_TLB.SpinType;
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
end;
with (IUnknown(Add('Price')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'avg(current,rec,%2)';
Editor.EditType := EXGRIDLib_TLB.SpinType;
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 * %2';
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%3)';
end;
end;
with Items do
begin
r := AddItem('Root');
g1 := InsertItem(r,Null,'Group 1');
h := InsertItem(g1,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(10);
h := InsertItem(g1,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(11);
g2 := InsertItem(r,Null,'Group 2');
h := InsertItem(g2,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(12);
h := InsertItem(g2,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(4);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(13);
ExpandItem[0] := True;
end;
EndUpdate();
FreezeEvents(False);
end
|
1216
|
How can I configure the filters in the text columns to search by content

with Grid1 do
begin
BeginUpdate();
FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible;
HeaderAppearance := EXGRIDLib_TLB.None2;
FilterBarPromptType := EXGRIDLib_TLB.exFilterPromptContainsAll;
Columns.Add('Names');
with Items do
begin
AddItem('Mantel');
AddItem('Mechanik');
AddItem('Motor');
AddItem('Murks');
AddItem('Märchen');
AddItem('Möhren');
AddItem('Mühle');
AddItem('Sérigraphie');
end;
FilterBarPromptPattern := 'a';
EndUpdate();
end
|
1215
|
How can I display the control's captions in Spanish

with Grid1 do
begin
BeginUpdate();
FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible;
HeaderAppearance := EXGRIDLib_TLB.None2;
Description[EXGRIDLib_TLB.exFilterBarAll] := '(todo) ';
Description[EXGRIDLib_TLB.exFilterBarFilterForCaption] := 'filtrar por...';
FilterBarPrompt := '<i><fgcolor=808080>iniciar filtro...</fgcolor></i>';
with (IUnknown(Columns.Add('Names')) as EXGRIDLib_TLB.Column) do
begin
DisplayFilterButton := True;
FilterType := EXGRIDLib_TLB.exPattern;
end;
with Items do
begin
AddItem('Mantel');
AddItem('Mechanik');
AddItem('Motor');
AddItem('Murks');
AddItem('Märchen');
AddItem('Möhren');
AddItem('Mühle');
AddItem('Sérigraphie');
end;
EndUpdate();
end
|
1214
|
How can I zoom in the control

with Grid1 do
begin
BeginUpdate();
s1 := 16;
s2 := FormatABC('2 * value',OleVariant(s1),Null,Null);
ImageSize := s2;
DefaultItemHeight := s2;
HeaderHeight := s2;
SortBarHeight := s2;
Indent := s2;
Font.Size := s1;
FilterBarFont.Size := s1;
ToolTipFont.Size := s1;
FilterBarPromptVisible := EXGRIDLib_TLB.exFilterBarPromptVisible;
HeaderAppearance := EXGRIDLib_TLB.None2;
with (IUnknown(Columns.Add('Names')) as EXGRIDLib_TLB.Column) do
begin
DisplayFilterButton := True;
FilterType := EXGRIDLib_TLB.exPattern;
end;
with Items do
begin
AddItem('Mantel');
AddItem('Mechanik');
AddItem('Motor');
AddItem('Murks');
AddItem('Märchen');
AddItem('Möhren');
AddItem('Mühle');
AddItem('Sérigraphie');
end;
EndUpdate();
end
|
1213
|
Can I set a filter that automatically adds a * before and after the word, so the user can just search for 'cat' and it becomes '*cat*' automatically

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with (IUnknown(Columns.Add('Items')) as EXGRIDLib_TLB.Column) do
begin
DisplayFilterButton := True;
DisplayFilterPattern := True;
Def[EXGRIDLib_TLB.exFilterPatternTemplate] := '*<%filter%>*';
FilterType := EXGRIDLib_TLB.exPattern;
Filter := '1';
end;
with Items do
begin
h := AddItem('Root 1');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
ExpandItem[h] := True;
h := AddItem('Root 2');
InsertItem(h,Null,'Child 1');
InsertItem(h,Null,'Child 2');
end;
ApplyFilter();
EndUpdate();
end
|
1212
|
The fine dotted lines in the control appear much thicker than the standard ones we've been using. How can we fix this

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exAllLines;
GridLineStyle := EXGRIDLib_TLB.exGridLinesGeometric;
ColumnAutoResize := False;
Columns.Add('Column 1');
Columns.Add('Column 2');
Columns.Add('Column 3');
Columns.Add('Column 4');
EndUpdate();
end
|
1211
|
Load data as a tree using a parent-id relationship

with Grid1 do
begin
BeginUpdate();
ColumnAutoResize := False;
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
DrawGridLines := EXGRIDLib_TLB.exVLines;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Select * FROM Employees WHERE 1=0','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.mdb',3,3,Null);
end;
DataSource := (IUnknown(rs) as ADODB_TLB.Recordset);
Columns.Item[OleVariant(0)].Width := 128;
rs := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
with rs do
begin
Open('Employees','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.mdb',3,3,Null);
end;
PutItems(rs.GetRows(Null,Null,Null),';0;17');
Items.ExpandItem[0] := True;
EndUpdate();
end
|
1210
|
Is there a way to change the contents of the drop down editor based on a value in another column

// AddItem event - Occurs after a new Item has been inserted to Items collection.
procedure TForm1.Grid1AddItem(ASender: TObject; Item : HITEM);
begin
with Grid1 do
begin
Items.CellEditorVisible[OleVariant(Item),OleVariant(0)] := EXGRIDLib_TLB.exEditorVisible;
Items.CellEditorVisible[OleVariant(Item),OleVariant(1)] := EXGRIDLib_TLB.exEditorVisible;
end
end;
// EditOpen event - Occurs when the edit operation starts.
procedure TForm1.Grid1EditOpen(ASender: TObject; );
begin
with Grid1 do
begin
with Items do
begin
v := CellValue[OleVariant(FocusItem),OleVariant(0)];
c := CellCaption[OleVariant(FocusItem),OleVariant(0)];
end;
with Columns.Item[OleVariant(1)].Editor do
begin
ClearItems();
AddItem(v,c,Null);
end;
end
end;
with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
GridLineStyle := EXGRIDLib_TLB.exGridLinesGeometric;
with (IUnknown(Columns.Add('DropDownList')) as EXGRIDLib_TLB.Column) do
begin
with Editor do
begin
EditType := EXGRIDLib_TLB.DropDownListType;
AddItem(1,'First',Null);
AddItem(2,'Second',Null);
AddItem(3,'Third',Null);
end;
end;
DrawGridLines := EXGRIDLib_TLB.exAllLines;
(IUnknown(Columns.Add('DropDownList-Related')) as EXGRIDLib_TLB.Column).Editor.EditType := EXGRIDLib_TLB.DropDownListType;
with Items do
begin
CellValue[OleVariant(AddItem(OleVariant(1))),OleVariant(1)] := OleVariant(-1);
CellValue[OleVariant(AddItem(OleVariant(2))),OleVariant(1)] := OleVariant(-1);
CellValue[OleVariant(AddItem(OleVariant(3))),OleVariant(1)] := OleVariant(-1);
LockedItemCount[EXGRIDLib_TLB.exBottom] := 1;
h := LockedItem[EXGRIDLib_TLB.exBottom,0];
ItemDivider[h] := 0;
ItemDividerLineAlignment[h] := EXGRIDLib_TLB.DividerTop;
CellEditorVisible[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exEditorHidden;
CellSingleLine[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exCaptionWordWrap;
CellValueFormat[OleVariant(h),OleVariant(0)] := EXGRIDLib_TLB.exHTML;
CellValue[OleVariant(h),OleVariant(0)] := 'The drop down editor in the second column is filled during the <b>EditOpen event</b>, and the values are based on the selection ' +
'on the first column.';
end;
EndUpdate();
end
|
1209
|
Highlight the editable fields

// Change event - Occurs when the user changes the cell's content.
procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM; ColIndex : Integer; var NewValue : OleVariant);
begin
with Grid1 do
begin
Refresh();
end
end;
with Grid1 do
begin
FreezeEvents(True);
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with ConditionalFormats do
begin
with Add('%CE1',Null) do
begin
Bold := True;
BackColor := $f5f5f5;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($1);
end;
with Add('%CE2',Null) do
begin
Bold := True;
BackColor := $f5f5f5;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2);
end;
with Add('%CE3',Null) do
begin
Bold := True;
BackColor := $f5f5f5;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($3);
end;
end;
with Columns do
begin
Add('Description');
with (IUnknown(Add('Qty')) as EXGRIDLib_TLB.Column) do
begin
Editor.EditType := EXGRIDLib_TLB.SpinType;
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
end;
with (IUnknown(Add('Price')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'avg(current,rec,%2)';
Editor.EditType := EXGRIDLib_TLB.SpinType;
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 * %2';
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%3)';
end;
end;
with Items do
begin
r := AddItem('Root');
g1 := InsertItem(r,Null,'Group 1');
h := InsertItem(g1,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(10);
h := InsertItem(g1,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(11);
g2 := InsertItem(r,Null,'Group 2');
h := InsertItem(g2,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(12);
h := InsertItem(g2,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(4);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(13);
ExpandItem[0] := True;
end;
EndUpdate();
FreezeEvents(False);
end
|
1208
|
Highlight the total fields

// Change event - Occurs when the user changes the cell's content.
procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM; ColIndex : Integer; var NewValue : OleVariant);
begin
with Grid1 do
begin
Refresh();
end
end;
with Grid1 do
begin
FreezeEvents(True);
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with ConditionalFormats do
begin
with Add('%CT1',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($1);
end;
with Add('%CT2',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($2);
end;
with Add('%CT3',Null) do
begin
ForeColor := $808080;
ApplyTo := EXGRIDLib_TLB.FormatApplyToEnum($3);
end;
end;
with Columns do
begin
Add('Description');
with (IUnknown(Add('Qty')) as EXGRIDLib_TLB.Column) do
begin
Editor.EditType := EXGRIDLib_TLB.SpinType;
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
end;
with (IUnknown(Add('Price')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'avg(current,rec,%2)';
Editor.EditType := EXGRIDLib_TLB.SpinType;
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 * %2';
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%3)';
end;
end;
with Items do
begin
r := AddItem('Root');
g1 := InsertItem(r,Null,'Group 1');
h := InsertItem(g1,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(10);
h := InsertItem(g1,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(11);
g2 := InsertItem(r,Null,'Group 2');
h := InsertItem(g2,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(12);
h := InsertItem(g2,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(4);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(13);
ExpandItem[0] := True;
end;
EndUpdate();
FreezeEvents(False);
end
|
1207
|
Highlight the leaf items

with Grid1 do
begin
BeginUpdate();
ConditionalFormats.Add('%CC0=0',Null).ForeColor := $808080;
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with Columns do
begin
(IUnknown(Add('Item')) as EXGRIDLib_TLB.Column).Width := 16;
Add('Desc');
end;
with Items do
begin
hR := AddItem('Root');
CellValue[OleVariant(hR),OleVariant(1)] := 'The root directory /';
ExpandItem[hR] := True;
h := InsertItem(hR,Null,'Home');
CellValue[OleVariant(h),OleVariant(1)] := 'The home directory with user directories Alice and Bob';
InsertItem(h,Null,'Alice');
InsertItem(h,Null,'Bob');
ExpandItem[h] := True;
h := InsertItem(hR,Null,'Etc');
CellValue[OleVariant(h),OleVariant(1)] := 'The etc directory with one configuration file';
h := InsertItem(h,Null,'nginx.conf');
CellValue[OleVariant(InsertItem(hR,Null,'Var')),OleVariant(1)] := 'The var directory';
end;
EndUpdate();
end
|
1206
|
Highlight the parent items

with Grid1 do
begin
BeginUpdate();
ConditionalFormats.Add('%CC0',Null).ForeColor := $ff;
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with Columns do
begin
(IUnknown(Add('Item')) as EXGRIDLib_TLB.Column).Width := 16;
Add('Desc');
end;
with Items do
begin
hR := AddItem('Root');
CellValue[OleVariant(hR),OleVariant(1)] := 'The root directory /';
ExpandItem[hR] := True;
h := InsertItem(hR,Null,'Home');
CellValue[OleVariant(h),OleVariant(1)] := 'The home directory with user directories Alice and Bob';
InsertItem(h,Null,'Alice');
InsertItem(h,Null,'Bob');
ExpandItem[h] := True;
h := InsertItem(hR,Null,'Etc');
CellValue[OleVariant(h),OleVariant(1)] := 'The etc directory with one configuration file';
h := InsertItem(h,Null,'nginx.conf');
CellValue[OleVariant(InsertItem(hR,Null,'Var')),OleVariant(1)] := 'The var directory';
end;
EndUpdate();
end
|
1205
|
Highlight the item being expanded or collapsed

with Grid1 do
begin
BeginUpdate();
ConditionalFormats.Add('%CX0',Null).Bold := True;
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with Columns do
begin
(IUnknown(Add('Item')) as EXGRIDLib_TLB.Column).Width := 16;
Add('Desc');
end;
with Items do
begin
hR := AddItem('Root');
CellValue[OleVariant(hR),OleVariant(1)] := 'The root directory /';
ExpandItem[hR] := True;
h := InsertItem(hR,Null,'Home');
CellValue[OleVariant(h),OleVariant(1)] := 'The home directory with user directories Alice and Bob';
InsertItem(h,Null,'Alice');
InsertItem(h,Null,'Bob');
ExpandItem[h] := True;
h := InsertItem(hR,Null,'Etc');
CellValue[OleVariant(h),OleVariant(1)] := 'The etc directory with one configuration file';
h := InsertItem(h,Null,'nginx.conf');
CellValue[OleVariant(InsertItem(hR,Null,'Var')),OleVariant(1)] := 'The var directory';
end;
EndUpdate();
end
|
1204
|
I am using exTotalColumn. Is there an option to exclude specific cells to display the total

// Change event - Occurs when the user changes the cell's content.
procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM; ColIndex : Integer; var NewValue : OleVariant);
begin
with Grid1 do
begin
Refresh();
end
end;
with Grid1 do
begin
FreezeEvents(True);
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with Columns do
begin
Add('Description');
with (IUnknown(Add('Qty')) as EXGRIDLib_TLB.Column) do
begin
Editor.EditType := EXGRIDLib_TLB.SpinType;
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
end;
with (IUnknown(Add('Price')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'avg(current,rec,%2)';
Editor.EditType := EXGRIDLib_TLB.SpinType;
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 * %2';
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%3)';
end;
end;
with Items do
begin
r := AddItem('Root');
g1 := InsertItem(r,Null,'Group 1');
FormatCell[OleVariant(g1),OleVariant(2)] := '`<average missing>`';
CellEditorVisible[OleVariant(g1),OleVariant(2)] := EXGRIDLib_TLB.exEditorHidden;
CellBold[OleVariant(g1),OleVariant(2)] := True;
CellForeColor[OleVariant(g1),OleVariant(2)] := $ff;
h := InsertItem(g1,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(10);
h := InsertItem(g1,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(11);
g2 := InsertItem(r,Null,'Group 2');
h := InsertItem(g2,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(12);
h := InsertItem(g2,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(4);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(13);
ExpandItem[0] := True;
end;
EndUpdate();
FreezeEvents(False);
end
|
1203
|
How can I add a total column

// Change event - Occurs when the user changes the cell's content.
procedure TForm1.Grid1Change(ASender: TObject; Item : HITEM; ColIndex : Integer; var NewValue : OleVariant);
begin
with Grid1 do
begin
Refresh();
end
end;
with Grid1 do
begin
FreezeEvents(True);
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
HeaderHeight := 24;
LinesAtRoot := EXGRIDLib_TLB.exLinesAtRoot;
with Columns do
begin
Add('Description');
with (IUnknown(Add('Qty')) as EXGRIDLib_TLB.Column) do
begin
Editor.EditType := EXGRIDLib_TLB.SpinType;
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%1)';
end;
with (IUnknown(Add('Price')) as EXGRIDLib_TLB.Column) do
begin
Def[EXGRIDLib_TLB.exTotalColumn] := 'avg(current,rec,%2)';
Editor.EditType := EXGRIDLib_TLB.SpinType;
end;
with (IUnknown(Add('Amount')) as EXGRIDLib_TLB.Column) do
begin
ComputedField := '%1 * %2';
Def[EXGRIDLib_TLB.exTotalColumn] := 'sum(current,rec,%3)';
end;
end;
with Items do
begin
r := AddItem('Root');
g1 := InsertItem(r,Null,'Group 1');
h := InsertItem(g1,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(1);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(10);
h := InsertItem(g1,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(2);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(11);
g2 := InsertItem(r,Null,'Group 2');
h := InsertItem(g2,Null,'Item 1');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(3);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(12);
h := InsertItem(g2,Null,'Item 2');
CellValue[OleVariant(h),OleVariant(1)] := OleVariant(4);
CellValue[OleVariant(h),OleVariant(2)] := OleVariant(13);
ExpandItem[0] := True;
end;
EndUpdate();
FreezeEvents(False);
end
|
1202
|
Is it possible to disable sizing(size) the column
with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
DrawGridLines := EXGRIDLib_TLB.exVLines;
with (IUnknown(Columns.Add('32px')) as EXGRIDLib_TLB.Column) do
begin
Width := 32;
AllowSizing := False;
end;
Columns.Add('Rest');
ColumnAutoResize := True;
EndUpdate();
end
|
1201
|
How can I add two columns of 25% and the third of 50%

with Grid1 do
begin
BeginUpdate();
HeaderAppearance := EXGRIDLib_TLB.Etched;
DrawGridLines := EXGRIDLib_TLB.exVLines;
(IUnknown(Columns.Add('25%')) as EXGRIDLib_TLB.Column).Width := 25;
(IUnknown(Columns.Add('25%')) as EXGRIDLib_TLB.Column).Width := 25;
(IUnknown(Columns.Add('50%')) as EXGRIDLib_TLB.Column).Width := 50;
ColumnAutoResize := True;
EndUpdate();
end
|