Go to Cxgrid Property description
Tcxgrid CONTROLS:
Property:
Activelevel: Current Layer
BorderStyle: Window style
Color: Colors
Focusedview: Current View;
Font: Fonts
Leveltabs: Similar to Pagecontrols header settings
Captionalgnment: Title Alignment
Images: Icon
Style: Styles
Levels:
Rootleveloptions: Layer Options
Detailtabsposition: Similar to Pagecontrols head display position;
Tabsforemptydetails: If the data is empty show tabs
Tcxgridlevel components:
Property:
Active: Read-write activates the layer;
Controls: Read-write pointing tcxgrid;
Canbevisible: Whether the read can be set to be visible;
Count: Reads the number of sub-layers;
Displaycaption: Read layer header;
IsMaster: Reads whether the cxgrid is the topmost;
Items: Read Layer Group, example: Items[0] access the first layer;
Level: Reads the number of levels;
Visiblecount: Read the number of visible layers
Visibleindex: Read the number of visible indexes
VisibleItems: Reading a visible layer group, example: Visibleitems[0] Accessing the first visible layer
Caption: Read-write layer title;
GridView: Specifies or reads the grid display of the layer;
ImageIndex: Read-write icon index
Options:tcxgridleveloptions Options
Detailframecolor: Read or write a schedule color
Detailframwidth: Reading or writing a schedule
Detailtabsposition: Read or write tab position, similar to Pagecontrolstabs
Styles: Style
tab: Read or Set tab style
Tabsbackground: Read or set tab background style
Visible: Read or set whether visible
Method:
Add: Add a level;
Levels[i]. Add: Add a sub level;
Tcxgriddbbandedtableview components:
Property:
Backgroundbitmaps: Background Image options
Background: Background map
Bandbackground: With background image
Bankheader: Lead Background
Content: Detail Area background
Filterbox: Filter Area background
Footer: Footnote background
Group: Background
Header: column header background
Preview: Background of the previewing area
Bands: With List
Datacontroller: Data Control
DataSource: Data source
Detailkeyfieldnames: Setting fine table key field names when master-slave table
Keyfieldnames: Setting key field names when Master and slave tables
Masterkeyfieldnames: Set primary table key field name when Master-slave table
Summary: Total Group
Footersummaryitems: footnote definition
Footersummaryitems: Group Foot definition
Filterbox: Filter Box
Customizedialog: Whether to customize filter conditions
Position: Filter Box display location
Visible: Show Filter box
Navigatorbuttons: Navigation bar settings
Append: Add button settings
Enabled: Whether the button is disabled
Visible: Whether the button is displayed
ImageIndex: Icon ID
Cancel: Cancels the button setting, the specific setting with append;
Confirmdelete: Whether to confirm prompt when deleting
Delete: Specific settings with append;
Edit: Specific settings with append;
First: specific settings with append;
Insert: Specific settings with append;
Last: Specific settings with append;
Next: Specific settings with append;
Filter: Specific settings with append;
Gotobookmark: Specific settings with append;
NextPage: Specific settings with append;
Post: Specific settings with append;
Prior: Specific settings with append;
Priorpage: Specific settings with append;
Refresh: Specific settings with append;
Savebookmark: Specific settings with append;
Optionsbehavior: Behavior Options
Alwaysshoweditor: Whether the edit bar is always displayed
Bandheaderhints: Whether to take the lead shows the prompt
Cellhints: Whether a cell displays a hint
Columnheaderhints: Whether the column header displays a hint
Copycaptionstoclipboard: Whether to allow copying of headers to the Clipboard
Copypreviewtoclipboard: Whether to allow copy preview content to clipboard
Expandmasterrowondblclik: Whether to allow double-click lines to display details
Focusfirstcellonnewrecord: Whether the focus points to the first column of cells when new records are added
Gotonextcellonenter: Press ENTER to automatically jump to the next cell
Navigatorhints: whether to show navigation bar hints
Optionscustomize: Custom Options
Bandhiding: Whether to show the band
Bandmoving: Whether to allow dragging with
Columnfiltering: Whether column filtering is allowed
ColumnGrouping: Whether column grouping is allowed
Columnhiding: Whether the column header is hidden
Columnhorzsizing: Whether to allow column widths to be adjusted
Columnmoving: Whether column dragging is allowed
Columnsorting: Whether column sorting is allowed
Columnvertsizing: Whether to allow column height adjustment
Datarowsizing: Whether to allow data row height adjustment
Groupbysorting: Whether groups are allowed to sort
Grouprowsizing: Whether to allow adjustment of group row height
Optiondata: Allow data manipulation
Appending: whether to allow additional
Cancelonexit: Whether to cancel the modification automatically when exiting
Deleting: whether to allow deletion
Deletingconfirmation: Whether to remove prompt
Editing: whether to allow editing
Inserting: whether to allow insertion
Optionsselection: Cell manipulation
Cellmultiselect: Whether to allow multiple cells to be selected
Cellselect: Select whether to enter the cell
Invertselect: Whether to allow conversion selection
MultiSelect: Whether to allow multi-line selection
Hidefocusrectonexit: Move away to hide focus
Unselectfocusedrecordonexit: Remove to allow cancellation of focus
Optionsview: Table Options
Bandcaptionsincolumnalternatecaption: Whether to allow joins to be modified with caption
Bandheaderheight: Lead Height
Bandheaderlinecount: Take the lead to display the number of rows
Bandheaders: Whether to show the lead
Cellautoheight: Whether the cell is automatically height
Celltextmaxlinecount: Maximum number of cell text lines
Columnautowidth: column is automatic width
Datarowheight: Data row height
Footer: Whether to allow footnotes to be displayed
Footerautoheight: Footnotes are automatically adapted to height
Footermultisummaries: Whether to allow multiple footnotes
GridlineColor: Table row Line Color
GridLines: Show table row line type
Groupbybox: Whether to allow grouping by dragging columns to the grouping area
Groupfooters: Show group pin type
Header: Whether to display column headers
Headerautoheight: Whether the column header automatically adapts to height
Headerheight: column Header height
Indicatorwidth: Whether to display the left indicator bar
Indicatorwidth: Indicator Bar width
Navigator: Whether the navigation bar is displayed
Navigatoroffset: Navigation bar offset position
Showcolumnfilterbuttons: Whether column filter button is displayed
Showeditbuttons: Whether the Edit button is displayed
Preview: Previewing options
Autoheight: Whether to automatically adapt to height
Column: Columns to preview, only one column is selected
LeftIndent: Left indent points
Maxlinecount: Maximum number of rows displayed
RightIndent: Right Indent points
Visible: Preview is visible
PopupMenu: Popup Menu
Styles: Style or style group
BackGround: Background style
Content: Detail Style
Footer: Footnote style
Group: Style
Groupsummary: Group total area Style
Header: Head style
Indicator: Indicator Area Style
Preview: Previewing area style
Selection: Select Zone style
StyleSheet: Style group, automatically set each area style when selected
method or function:
Createcolumn:
Parameters: none;
Function: Create a new column;
Return: Returns the column type result;
Getcolumnbyfieldname:
Parameters: Field name string;
Function: Gets the specified field column;
Return: Returns the column type result;
Example: Mytv.getcolumnbyfieldname (' first '). Visible: = False;
Cleaaritems:
Parameters: none;
Function: Clear all displayed columns;
return: None
CreateItem:
Parameters: none;
Function: Build a display column;
Return: Column type value
Storetoinifile: Exporting layouts to INI files
Storetoregistry: Exporting layouts to the registry
Storetostream: Export layout to fluid
Restorefrominifile: Restore layout from INI file
Restorefromregistry: Restoring layouts from the registry
Restorefromstream: Restoring layout from fluid
Finditembyid: Find columns by ID number
Finditembyname: Finding columns based on column names
Finditembytag: Find columns by tag
Indexofitem: Returns the ordinal of a column
Createviewinfo: Build Form
Tcxgrid Usage Guide
Assume that the following variables have been set
Mycxgrid:tcxgrid;
Mycxgridlevel:tcxgridlevel;
Mytv:tcxgriddbtableview;
Mydatasource:tdatasource;
Method:
1, build and layer views
Mycxgrid: = Tcxgrid.create (self);
Mycxgridlevel: = MYCXGRID.LEVELS.ADD; Build Layer
mytv:= Tcxgriddbtableview (Mycxgrid.createview (Tcxgriddbtableview));//Build View
Mycxgridlevel.control: = mycxgrid;//Specify relationship
Mycxgridlevel.gridview: = mytv;//The specified view
Tcxgriddatacontroller (Getdetaildatacontroller (focusedrecordindex, 0)). gridview;//get the lower view
2, set the table position and size
Mycxgrid.parentwindow: = self. Handle;
Mycxgrid.top: = 0;
Mycxgrid.height: = 200;
Mycxgrid.width: = 400;
MyTV.Preview.visible: = true;
3, set the data source and assign all fields
MyTV.DataController.DataSource: = myDataSource;
MyTV.DataController.DeleteAllItems; Clear all fields
MyTV.DataController.CreateAllItems; Create all display fields
4. dynamically increase display column and column access
Var
Iindex:integer;
Vcol:tcxgriddbcolumn;
Vimgcom:tcximagecomboboxitem;
I,j:integer;
For i:= 0 to Mydatasource.dataset.fieldcount-1 do
Begin
Vcol: = Mytv.createcolumn;
Vcol.databinding.fieldname:=mydatasource.dataset.fields[i]. FieldName;
if (i = 1) Then
Begin
Vcol.propertiesclassname: = ' tcximagecomboboxproperties '; Divide case
VCol.DataBinding.ValueType: = ' String ';
For J: = 0 to 5 do
Begin
Vimgcom:=tcximagecomboboxproperties (vcol.properties). Items.Add;
Vimgcom.description: = IntToStr (j);
Vimgcom.value: = IntToStr (j);
End
End
End
ShowMessage (Mytv.columns[0]. Caption);//Column header access
ShowMessage (Mytv.columns[0]. Databinding.fieldname);//column Field name access
Mytv.columns[0]. SortIndex: = 0;
Mytv.columns[0]. SortOrder: = soascending; Column Ascending sort
Mytv.columns[0]. SortIndex: =-1;
Mytv.columns[0]. SortOrder: = Sonone; Cancel column Sorting
MyTV.DataController.Search.Locate (Mytv.getcolumnbyfieldname (FieldName). Index, lookup value);//Column Value Search
MyTV.DataController.FocusedRowIndex: = mytv.datacontroller.focusedrowindex-1;//record back, that is prior;
DBView.DataController.FocusedRowIndex: = DBView.DataController.FocusedRowIndex + 1; Record and turn, that is next;
aa:=mytv.datacontroller.values[1,1];//access the value of the second column of the second row
Mytv.columns[0]. Databinding.valuetypeclass: = tcxstringvaluetype;//Sets the column field type,
Other such as integral type [tcxintegervaluetype], float type [tcxfloatvaluetype];
Set the column style:
Myfirstcolumnstyle: = Tcxstyle.create (self);
Myfirstcolumnstyle.color: = Claqua;
Myfirstcolumnstyle.textcolor: = Clblue;
MYTV.COLUMNS[1]. Styles.content: = Myfirstcolumnstyle;
Set column drop-down box select list and type
Var
A:tdatasource:
B:tcxlookupcomboboxproperties;
Begin
A:=tdatasource.create (self);
B:=tcxlookupcomboboxproperties.create (self);
a.dataset:=dic_ry_xb;//Specify the data source here.
b.listdource:=a;//here indicates the Listsource property of the field.
B.keyfieldnames:= ' a '; The key fields of the field are indicated here
B.listfieldnames:= ' B '; The return value of the field is indicated here.
b.listcolumns.items[0].caption:= ' x '; The default here is to create a field, but the displayed header is name, so here it appears as if it were the noon you want.
Mytvc1_sex_code. Properties:=b; The field is indicated here.
End
5. Setting the appearance of columns
MyTV.OptionsView.ColumnAutoWidth: = TRUE//column auto width
MyTV.OptionsView.CellAutoHeight: = TRUE//unit auto Height
MyTV.OptionsView.Footer: = TRUE//table totals row Display
MyTV.OptionsView.Header: = TRUE//table header display
MyTV.OptionsView.Indicator: = TRUE//Display indicator bar
Mytv.optionsview.groupbybox:=true//Show group box
Mytv.preview: = True//Show preview area
6. Setting Table Styles
var Mystylesheet:tcxgridtableviewstylesheet;
Mystyle:tcxstyle;
Begin
Mystylesheet: = Tcxgridtableviewstylesheet.create ();
MyStyle: = Tcxstyle.create (self);
Mystyle.color: = Clblack;
Mystyle.textcolor: = Clwrite;
MyTV.Styles.Background: = MyStyle; Setting the background style
Mystylesheet.addstyles (MyStyle);//Assignment style
Cxstylerepository.createstylesheet (Mystylesheet);
MyTV.Styles.StyleSheet: = cxstylerepository; Assigning styles
End;
7. Setting the Preview column
The precondition is to set the footer=true;
MyTV.Preview.column: = mytvfield1;//Set Preview column
MyTV.Preview.MaxLineCount: = 4;//Sets the maximum number of rows to display in the preview column
MyTV.Preview.LeftIndent: = 150; Show left Indent
MyTV.Preview.RightIndent: =150;//Display Right Indent
8, footer set
Var asummary:tcxdatasummary;
Myfooteritems:tcxdatafootersummaryitems;
Acolumn:tcxgriddbcolumn;
Asummary: = MyTV.DataController.Summary; extracting footer;
Myfooteritems: = Asummary.footersummaryitems; Extracting Footeritems;
Increase Footeritems
With Tcxgriddbtalesummaryitem (Myfooteritems.add) do
Begin
Try
Try
BeginUpdate;
Column: = Tcxgriddbcolumn (mytv.visiblecolumns[0];//footer Display column position
Acolumn: = Tcxgriddbcolumn (Mytv.visiblecolumns[0];
If assigned (acolumn) then
FieldName: = AColumn.dataBinding.FieldName; Footer calculated Fields
Kind: = Tcxsummarykind (sksum);
sknone= none. sksum= total; skmax= Maximum,
skcount=//Record count, skaverage= average
Finally
endupdate;
End;
Except
ShowMessage (' error ');
MYFOOTERITEMS.ITEMS[MYFOOTERITEMS.COUNT-1]. free;//error release just joined the
End;
End;
Delete Footeritems
Myfooteritems: = Tcxgriddbtablesummaryitem (Myfooteritems[0]);
If myfooteritems.fieldbyname<> ' Then
For i:= 0 to Mytv.visiblecolumncount-1 do
Begin
Acolumn: = Tcxgriddbcolumn (Mytv.visiblecolumns[i]);
If AColumn.DataBinding.FieldName = Myfooteritems.fieldname Then
break;
End;
If Assigned (Myfooteritems.column) Then
Myfooteritems.items[0]. Free;
9, Jian band
Var Myband:tcxgridband;
Mybandviewinfo:tcxgridbandviewinfo;
Myband: = MYTV.BANDS.ADD;
Myband.caption: = ' new belt ';
Mybandviewinfo:= Mytv.viewinfo.headerviewinfo.bandsviewinfo[myband.visibleindex];
MyTV.Controller.LeftPos: = MyBandViewInfo.Bounds.right;
10. Master and slave indicate fine nested association settings
Mytv.detailkeyfieldnames: = mastered; Primary table key Columns
Mytv.keyfieldnames: = ID; The child table corresponds to the key column
Masterkeyfieldnames: = id;//the child table's own key column
Indexfieldnames of the child table adoquery: = mastered;
11. Group settings
mytv.datacontroller.groups.fullexpand;//Group expansion
mytv.datacontroller.groups.collapse;//Group Contraction
12. Record operation
mytv.datacontroller.append;//Add record
mytv.datacontroller.insert;//Inserting records
Mytv.datacontroller.values[0.1]:= ' a ';//Cell assignment
mytv.datacontroller.cancel;//Cancel Modification
mytv.datacontroller.post;//Commit Save
mytv.datacontroller.deletefocused;//Delete the current record
MyTV.Controller.Controller.FocusedRow.IsFirst;//whether the first line
MyTV.Controller.Controller.FocusedRow.IsLast;//whether the last line
MyTV.DataController.Options.FocusTopRowAfterSorting: =true;//to the first line after sorting
MyTV.ViewInfo.VisibleRecordCount; number of visible rows
The Cxgrid property description is time consuming and laborious to find at each use.