· Description of cXtraStringGrid · History of cXtraStringGrid · How to use cXtraStringGrid · Note for Version 1.x users · Screenshots of cXtraStringGrid used in a user project · Tip: Go to another marker or movie from a click on the cXtraStringGrid · Tip: How to use V3 objects in the grid? · Tip: Use cXtraStringGrid with a V12 database · Tip: Use cXtraStringGrid with a Valentina database
How to use cXtraStringGrid
Place cXtraStringGrid to your castlib from the Director menu : Insert -> cXtra
-> cXtraStringGrid.
Drag the xtra member to your scenario and adjust the size of the sprite.
| Property |
Type |
Description |
| AlwaysShowEditor |
boolean |
The user can modify the grid datas without using Enter or
F2 key. |
| BackPicture |
string |
You can specify an external .bmp image to set the background of the grid. |
| BorderStyle |
integer |
0 or 1 (0 -> none , 1 -> single) |
| CanSelect |
boolean |
Allow or not the user to make a selection |
| CellsColor |
color (integer) |
Set the cells color |
| ColCount |
integer |
Set the number of columns. |
| ColMoving |
boolean |
Can the user move columns ? |
| ColSizing |
boolean |
Can the user modify the columns size |
| Ctl3D |
boolean |
The component has a 3D look or not |
| Cursor |
string |
The cursor of the grid (see property editor for value list) |
| DecimalSeparator |
string |
The character used as decimal separator |
| DefaultColWidth |
integer |
Get and set the default column width |
| DefaultRowHeight |
integer |
Get and set the default row height |
| EditFilter |
string |
Allowed characters when you use EditFilter 7 |
| Enabled |
boolean |
Enable or disable the grid events |
| FixedColor |
color (integer) |
Fixed cell color. |
| FixedCols |
integer (Show message box if error in the argument) |
Set the number of fixed columns.
When you set it to 0, don't forget to set the color of the column 0 which
is black by default. |
| FixedRows |
integer (Show message box if error in the argument) |
Set the number of fixed rows.
When you set it to 0, don't forget to set the color of the row 0 which is
black by default . |
| FixedFontColor |
color |
Change the color of the text in the fixed cells. |
| FixedFontName |
string |
Set the font in the fixed cells. (The font must be installed in the operating
system) |
| FixedFontSize |
integer |
Set the font size in the fixed cells. |
| FixedFontStyle |
integer |
Change the font style in the fixed cells : Bold = 1, Italic = 2, Underline
= 4, StrikeOut = 8
Example : Bold+Italic : 1+2=3 : Fontstyle=3 |
| FixedHorzLineVisible |
boolean |
The fixed horizontal line in the grid is visible or not |
| FixedVertLineVisible |
boolean |
The fixed vertical line in the grid is visible or not |
| FontColor |
color |
Change the color of the text. |
| FontName |
string |
Set the font. (The font must be installed in the operating
system) |
| FontSize |
integer |
Set the font size. |
| FontStyle |
integer |
Change the font style : Bold = 1, Italic = 2, Underline =
4, StrikeOut = 8
Example : Bold+Italic : 1+2=3 : Fontstyle=3 |
| GridCursor |
string |
Change the mouse cursor
Values can be : "Default", "None", "Arrow", "Cross", "IBeam", "Size", "SizeNESW", "SizeNS", "SizeNWSE", "SizeWE", "UpArrow", "HourGlass", "Drag", "NoDrop", "HSplit", "VSplit", "MultiDrag", "SQLWait", "No", "AppStart", "Help", "HandPoint", "SizeAll"
|
| GridLineWidth |
integer |
The width of the lines |
| HeaderLineColor |
color |
Change the color of the header elements definided by the FixedRow/Col
properties |
| HighlightColor |
color |
Change the color of the selection (default: blue) |
| HighlightTextColor |
color |
Change the text color of the select element (default: white) |
| HorizontalScrollBarVisible |
boolean (readonly) |
Is the horizontal scroll bar visible? (readonly property) |
| HorzLineVisible |
boolean |
The horizontal line in the grid is visible or not |
| ImageListHeight |
integer |
Get or Set the Height of each image of the imageList |
| ImageListWidth |
integer |
Get or Set the Width of each image of the imageList |
| LeftColView |
integer |
Set and read the scroll horizontal view of the stringgrid,
usefull when scrollbar=0 |
| LineColor |
color |
Change the color of the separators lines of the grid (see
HeaderLineColor for fixed row/col) |
| RangeSelect |
boolean |
Allow the user to make multiselection of cells (a rectangle). The ReadOnly property must be set to true to use a range selection. |
| ReadOnly |
boolean |
The stringgrid is readonly ? |
| RowCount
|
integer |
Set the number of lines. |
| RowMoving |
boolean |
Can the user move rows ? |
| RowSelect |
boolean |
The user select a cell or a row |
| RowSizing |
boolean |
Can the user modify the rows size |
| ScrollBar |
integer |
0..3 for ssNone, ssHorizontal, ssVertical, ssBoth |
| SelectedCell |
point(col : integer , row : integer ) |
Get and set the selected cell ( col , row )
Ex: sprite(1).SelectedCell=point(1,2) |
| SelectedCol |
integer |
Get and set the selected column |
| SelectedRect |
Rect |
Get and set the selected rectangle |
| SelectedRow |
integer |
Get the selected row |
| SortCol |
integer (readonly, updated by the Sort method) |
The index of column sorted or sort |
| SortOrder |
integer (readonly, updated by the Sort method) |
0 = None, 1 = Ascending and 2 = Descending |
| Tabs |
boolean |
The user can use Tab and Shift+Tab keys to browse the cells. |
| ThumbTracking |
boolean |
The grid image is refreshed when the user use scrollbars. |
| TopRowView |
integer |
Set and read the scroll vertical view of the stringgrid, usefull
when scrollbar=0 |
| Transparent |
integer (0-100) |
Set the transparency of the color of the cells when your grid has a picture
(value must be between 0 to 100) |
| VerticalScrollBarVisible |
boolean (readonly) |
Is the vertical scroll bar visible? (readonly property) |
| VertLineVisible |
boolean |
The vertical line in the grid is visible or not |
| WordWrap |
|
WordWrap the text in the cells. You should resize the cell after using this property to show the bottom lines. |
| Method |
Arguments |
Return |
Description |
| AddComboItem |
Item1:String, Item2:String, ... |
|
Add items to the "Editor" combobox |
| BuildFromText |
text : string; Separator : string; Quote : String ; {WithoutFixed:boolean=False} |
|
WithoutFixed is an optionnal argument to specify if the method
should fill the fixed rows/columns or not. For example, you can set a fixed
row first and fill the grid with this method, the first row won't be erased.
You can look the example in the page "Tip : Example of text for the BuilfFromText
method". |
| Clear |
ResetRowAndColSize: boolean ; WithHeader: boolean |
|
Clear the grid content Ex: sprite(1).clear() |
| ClearCombo |
|
|
Delete all combobox items |
| ColAutoSize |
column : integer
or () |
|
Resize a column or all columns (with no argument) |
| ConvertHtml |
{FileName : String} |
|
Save a Html Page which represents the grid.
FileName is an optional parameter. If you don't specify it, the file is
saved to TempGrid.htm in the temp windows directory. |
| ConvertRTF |
FileName, CharSet : String |
|
Save a RTF Page which represents the grid.
FileName is an optional parameter. If you don't specify it ( "" ), the file is saved to TempGrid.rtf in the temp windows directory. CharSet is the charset used in the page ( "iso-8859-1" by default ). |
| CopyToClipboard |
separator : string |
|
This method copy the grid data to the clipboard, you can use it to paste the data in Word, Excel, use your custom separator like " " to copy a html table. |
| DateFormat |
Format: String |
|
Set the date format for the DatePicker.
By default, the Windows setting is used. |
| DeleteCol |
column : integer |
result : boolean |
Delete a column |
| DeleteRow |
row: integer |
result : boolean |
Delete a row |
| FindItems |
ListOfItem : string, CaseSensitive, Exactly : boolean, Operator
: string |
String of list of points.
Use the value lingo command to make the result a lingo list |
Find Items in StringGrid. The result is a string list of point(Col,
Row) of match cells.
ListOfItem is a list like : "[" & quote & "Peace" & quote & "]"
The Operator can be "OR" or "AND". |
| GetCellAlignment |
Col, Row : integer |
integer |
Return the Alignment of the Row |
| GetCellDateTime |
|
list |
Return the date or time of the date/time picker in a list format like:
["Year", "Month", "Day", "Hour", "Minute", "Second", "MilliSecond"] |
| GetCellReadOnly |
Col, Row : integer |
readonly : boolean |
Get the readonly property for a cell |
| GetCellText |
(column : integer , row : integer)
or mypoint : point |
text : string |
Get the text of a cell. |
| GetChecked |
ACol, ARow: integer |
boolean |
Is the checkbox specified checked? |
| GetCol |
(Col: integer , {StartRow : integer}, {EndRow : integer}) |
string contening a list |
Get the text of a column.
Example :
mylist=value(sprite(1).getcol(1)) |
| GetColAlignment |
Col : integer |
integer |
Return the Alignment of a column |
| GetColColor |
ACol : integer |
|
Get the color of the column ACol |
| GetColWidth |
ACol : integer |
Width: integer |
Get the width of the column ACol |
| GetDate |
|
string |
Return the date of the DatePicker in the Editor with the "DateFormat property" format |
| GetTime |
|
string |
Return the time of the TimePicker in the Editor with the "TimeFormat property" format |
| GetImageIndex |
Col, Row: integer |
ImageIndex : integer |
Get the index of the image cell in the image list |
| GetRow |
(Row: integer , {StartCol : integer}, {EndCol : integer}) |
string contening a list |
Get the text of a row.
Example :
mylist=value(sprite(1).getrow(1)) |
| GetRowAlignment |
Row : integer |
integer |
Return the Alignment of a row |
| GetRowColor |
ARow : integer; {TextColor:Boolean} |
|
Get the color of the row. ARow. The Textcolor parameter is optionnal. Ex: put sprite(1).GetRowColor(5)
put sprite(1).GetRowColor(5,true) |
| GetRowHeight |
ARow : integer |
Height: integer |
Get the height of the row ARow |
| GridToText |
Separator : char , Quote : char |
text : string |
Get the Grid datas in text format as the BuildFromText method
format |
ImportAscii |
FileName : string; Separator : string; Quote : String; {WithoutFixed:boolean=False} |
|
The same but from a text file |
| InsertCol |
columnindex : integer ; {Text:String} |
result : boolean |
Insert a column at position columnindex, the text argument
(optionnal) is the text of the first row of the inserted column. |
| InsertRow |
rowindex : integer; {Text:String} |
result : boolean |
Insert a row at position rowindex, the text argument
(optionnal) is the text of the first column of the inserted row. |
| LoadFromFile |
filename : string; {With CellStyle:Boolean} |
|
Load datas from a file |
| MoveCol |
FromIndex, ToIndex : integer |
|
Move a column from col FromIndex to ToIndex |
| MoveRow |
FromIndex, ToIndex : integer |
|
Move a row from row FromIndex to ToIndex |
| PointToCell |
(Point : Point)
or (X, Y: integer) |
Point (col,row) |
Convert X,Y point to cell Col, Row (use it with the mouse
lingo command for example) |
| PrintHtml |
{FileName : String} |
|
Print a Html Page which represents the grid.
FileName is an optional parameter. If you don't specify it, the file is
saved to TempGrid.htm in the temp windows directory. |
| Refresh |
|
|
Refresh the stringgrid |
| RowAutoSize |
row: integer
or () |
|
Resize a row or all rows (with no argument) |
| SaveToFile |
filename : string; {With CellStyle:Boolean} |
|
Save datas to file filename |
| ScrollView |
X, Y : integer |
|
Scroll the current view of the stringgrid, usefull when scrollbar=0
|
| SetButtonHere |
Col, Row : integer ; Here : Boolean |
Succes : Boolean |
Place a button in the cell specified if Here = true. Delete the button if Here = false.
Return true if succes. |
| SetCellAlignment |
Col, Row, Alignment : integer |
|
Set the Alignment of a cell. Alignment can be :
0 = Left, 1 = right, 2 = center |
| SetCellReadOnly |
Col, Row : integer; readonly : boolean |
|
Set the readonly property for a cell |
| SetCells |
alistofvalues : string ; {WithoutFixed:boolean=False} |
|
Fill the grid with a list of value like this : (take care
of resizing the grid as you want before)
sprite(1).SetCells( "["FirstName","Name","John","Smith","Super","Man"]")
WithoutFixed is an optionnal argument to specify if the method should fill
the fixed rows/columns or not. For example, you can set a fixed row first
and fill the grid with this method, the first row won't be erased. |
| SetCellStyle |
Col, Row: integer; Color: color; FontName: string, FontSize, FontStyle
: integer; {FontColor: Color}; {MustRepain : boolean} |
|
Set the style of a cell. Color is the background color. If you don't change
the font, set FontName to "". If you want to change the font size, set FontSize to -1. FontColor is optional and don't change if not specified. The background color is made by order: 1. Cell 2. Row 3.Col. MustRepaint forces the cell to be repainted to avoid graphic problems. |
| SetCellText |
(column , row : integer ; text : string)
or (mypoint : point ; text : string) |
|
Set the cell text |
| SetCheckBoxHere |
ACol, ARow: integer; Here:Boolean |
Succes : Boolean |
Place a checkbox in the cell specified if Here = true. The text used is the text of the cell. Delete the checkbox if Here = false.
Return true if succes. |
| SetChecked |
ACol, ARow : integer ; Value: boolean |
|
Set the checkbox to checked or not. |
| SetCol |
(Col: integer , List: string, {StartRow : integer=0} |
|
Set the datasof a column.
Example :
testlist = string( ["Hello","Good","BYE"] )
sprite(1).SetCol(1,testList) |
| SetColAlignment |
Col, Alignment : integer |
|
Set the Alignment of a column. Alignment can be :
0 = Left, 1 = right, 2 = center |
| SetColColor |
ACol : integer ; Color : color; {TextColor:TColor}, {MustRepaint:boolean} |
|
Set the color of the column ACol to Color The TextColor and MustRepaint parameters are optionnal. MustRepaint forces the row to be repainted to avoid graphic problems. The background color is made by order: 1. Cell 2. Row 3.Col. |
| SetColFont |
ACol : integer ; fontname : string ; fontsize,style : integer ; fontcolor
: color |
|
Set the font for a column. (look the SetCellStyle method) |
| SetColWidth |
ACol, NewWidth : integer |
|
Set the width of the column ACol to NewWidth |
| SetDate |
YYYY, MM, DD : integer |
|
Set the date of the DatePicker |
| SetImageIndex |
Col, Row, index : integer |
|
Set the index of the image cell in the image list.
You can use this to remove an image :
sprite(1).SetImageIndex(YourCol,YourRow,-1) |
| SetImageList |
member, castlib : integer |
|
Put images for each node by loading a Bitmap from an image member.
The size of each part of the image should be 16x16 pixels by default or
ImageListWidth * ImageListHeight.
Your bitmap file must be horizontal with all your images.
So your bitmap width will be (ImageListWidth * number of images) like this
:
The first pixel color is the transparent color. |
| SetPicture |
member, castlib : integer or String |
|
Set Background Image of the grid with an image member |
| SetRow |
(Row: integer , List: string, {StartCol : integer=0} |
|
Set the datas of a row.
Example :
testlist = string( ["Hello","Good","BYE"] )
sprite(1).SetCol(1,testList) |
| SetRowAlignment |
Row, Alignment : integer |
|
Set the Alignment of a row. Alignment can be :
0 = Left, 1 = right, 2 = center |
| SetRowColor |
ARow : integer ; Color : color; {TextColor:TColor}, {MustRepaint:boolean} |
|
Set the color of the row ARowto Color. The TextColor and MustRepaint parameters are optionnal. MustRepaint forces the row to be repainted to avoid graphic problems. The background color is made by order: 1. Cell 2. Row 3.Col. |
| SetRowFont |
ARow : integer ; fontname : string ; fontsize,style : integer ; fontcolor
: color |
|
Set the font for a row. (look the SetCellStyle method) |
| SetRowHeight |
ARow, NewHeight : integer |
|
Set the height of the row ARow to NewHeight |
| SetTime |
Hour, Minute, Second, MilliSecond : integer |
|
Set the time of the TimePicker |
| Sort |
ColToSort : integer; TypeCol : integer; Ascending : boolean;
{FromRow: integer}, {ToRow: integer} |
|
Sort the stringgrid. TypeCol can be :
0 = Date; 1 = Time; 2 = DateTime; 3 = Numeric; 4 = CaseString; 5 = NoCaseString |
| TimeFormat |
Format: String |
|
Set the date format for the TimePicker.
By default, the Windows setting is used. |
| Event |
Arguments |
Arguments description |
Description |
| ButtonClick |
ACol, ARow : Integer |
|
Get the cell position of the clicked button |
| CellDblClick |
ACol, ARow : Integer |
|
The user clicks a cell with Double Click. Return the selected cell.
on CellDblClick me, ACol, ARow
alert("User doubleclicks on cell ("&ACol&","&ARow&")")
end |
| CellMouseDown |
Button : integer ; X, Y : integer |
Left button = 0;
Right button = 1;
Middle button = 2 |
The user click, the button is pressed.
on CellDblClick me, Button, X, Y
if Button=0 then thebutton="Left Button"
if Button=1 then thebutton="Right Button"
if Button=2 then thebutton="Middle Button"
put "User clicks on cell ("&X&","&Y&") with"&&thebutton
end |
| CellMouseOver |
Col, Row : integer |
|
The mouse is over the cell at Col, Row
on CellMouseOver me, Col, Row
put "Mouse cursor is over cell ("&&Col&":"&Row&")"
end |
| CellMouseUp |
Button : integer ; X, Y : integer |
Left button = 0;
Right button = 1;
Middle button = 2 |
After the user click, the button is released
on CellMouseUp me, Button, X, Y
put "CellMouseUp "&X&":"&Y
end |
| CellSelected |
ACol, ARow, CurrentCol, CurrentRow : Integer |
|
The user select a cell. ACol, ARow is the new cell selection
and CurrentCol, CurrentRow is the old selection.
on CellSelected me, ACol, ARow, CurrentCol, CurrentRow
put "CellSelected"&&ACol&":"&ARow
end |
| CellSelecting |
NewColSelected, NewRowSelected, ColSelected, RowSelected : Integer |
|
When the user is selecting a cell you can specify if the user can select or not the new cell.
on CellSelecting me, NewColSelected, NewRowSelected, ColSelected, RowSelected
if (NewColSelected = 1) then
Return True -- CanNotSelect
end if
end |
| CellTextChanged |
Text : String ; Col, Row : integer |
Text is the new string in the cell. |
The text of cell ( col , row ) has changed.
on CellTextChanged me, Text, Col, Row
put "CellTextChanged:"&&Text
end |
| CellTextChanging |
Text : string |
|
The user change the current cell value.
on CellTextChanged me, Text
put "CellTextChanged:"&&Text
end |
| CheckedChanged |
ACol, ARow, Checked : integer |
|
Returns the checked box cell position which has been changed and its state |
| GetEditorType |
ACol, ARow : integer |
|
Returns the editor type used in a cell which can be:
Edit = 0
ComboEdit = 1
ComboList = 2
DatePicker = 3
TimePicker = 4
CheckBox = 5
EditNumber = 6 -- allow characters [0-9] + the decimal character (specified in the decimalseparator property)
EditFilter = 7 -- allow characters specified in the EditFilter property
Button = 8 |
| GridKeyDown |
Key, Shift : integer |
|
This event is triggered when the user press down a key. Shift can be
:
Shift =1,
Alt = 2,
Ctrl = 4,
MouseLeft = 8,
MouseRight = 16,
MouseMiddle = 32,
MouseDoubleClick = 64
on GridKeyDown me, Key, Shift
put "GridKeyDown:"&&Key&&Shift
end
|
| GridKeyUp |
Key, Shift : integer |
|
This event is triggered when the user release a key. Shift can be :
Shift =1,
Alt = 2,
Ctrl = 4,
MouseLeft = 8,
MouseRight = 16,
MouseMiddle = 32,
MouseDoubleClick = 64
on GridKeyUp me, Key, Shift
put "GridKeyUp:"&&Key&&Shift
end |
| KeyPress |
KeyPress : char ;
Col, Row : integer |
|
The grid should not be in editor mode.
This event is triggered when the user press a key.
on KeyPress me, KeyPress, Col, Row
put "KeyPress:"&&KeyPress&&"at cell"&&Col&":"&Row
end |
Click here to go to the download section. Click here to order this product.
Copyright © by cXtra - Xtra for Macromedia Director All Right Reserved. Published on: 2003-08-06 (40 reads) [ Go Back ] |