This is an archive. | |
See the new ClickWiki at https://clickwiki.github.io. This version is just an archive for the purposes of migrating content to the new structure. |
DataGrid Object
Author | |
Status | Released |
Release Date | Unknown |
Available for | |
Supported Runtimes | |
License | Free |
Attributes | |
Download | |
---|---|
Includes Examples | Yes |
Includes Help Files | Yes |
Links | Included by default. |
The DataGrid object is a grid control designed to present your data in a structured, grid way, like in Excel. The DataGrid object allows extensive control on the layout, editing of the content, and printing.
Contents
- 1 Properties
- 2 Conditions
- 3 Actions
- 4 Expressions
Properties
Array setup
Horizontal titles
Displays the first column as horizontal titles (grayed).
Vertical titles
Displays the first line as vertical titles (grayed).
Line resize
Allows the user to resize the lines with the mouse.
Column resize
Allows the user to resize the columns with the mouse.
Editable
Allows the user to edit the content of each cell, with a double click.
List mode
When list mode is selected, the cells are not selectable, you select a complete line, like in a ListView object.
Sort on click
This option is selectable if the previous one is selected. Automatically sorts the items in alphabetical order when the user clicks on the title of a column.
Title tips
Displays a tip window if the entire text cannot be displayed in a cell.
Allow selection
Allows the user to select the cells with the mouse pointer.
Display
Show vertical lines
displays vertical lines between the columns.
Show horizontal lines
displays horizontal lines between the lines.
Visible at start
makes the object visible when the frame starts.
Border
- No border: avoids drawing a border around the object
- Thin border: draws a thin border (one pixel) around the object
Content of the Datagrid object
A click on the EDIT button will open the content setting dialog box, where you can enter the default content of the object.
The dialog box shows a datagrid ready to be filled with data. Simply click twice on the cell you wish to edit, and enter the text. This dialog box contains a certain number of buttons to control the layout of the datagrid.
New column
Inserts a new column at the current position
Delete column
Deletes the current column.
Set column title
Opens a dialog box to enter the title of the column.
New line
Enters a new line at the current position.
Delete line
Deletes the current line.
Set line title
Opens a dialog box to set the title of the line.
Set number of line
Opens a dialog box asking for a number. This number will be the number of lines of the datagrid object.
Set number of columns
Opens a dialog box asking for a number. This number will be the number of columns of the datagrid object.
Erase
Erases the whole content of the object.
Save
Saves the content of the object into a file.
Load
Loads the content of a previously saved file.
Text
Font color
Click on "choose a new color" to open a color selector. This option will change the color of the selected cells (select the whole array to change the colors of the whole array)
Back color
Click on "choose a new color" to open a color selector. This option will change the color of the background of the selected cells.
Horizontal Alignment
- Left aligned: aligns the text of the selected cells to the left
- Horizontally centered: centers the text in the cell
- Right aligned: aligns the text of the selected cells to the right
Vertical Alignment
- Aligned on the top: displays the text of the cells on the top
- Vertically centered: centers the text vertically in the cell
- Aligned on the bottom: displays the text in the bottom of the cells
Conditions
Click
Clicked with left button.
This condition is true if the user clicks on the object with the left mouse button.
Clicked with right button.
This condition is true if the user clicks on the object with the right mouse button.
Double click.
This condition is true if the user double clicks with the left mouse button on the object.
- Important: for all the above "click" conditions, the object stores in its internal datazone the line and column where the click has happened. You can use specific expressions to get this information later.
Window
Is object visible.
Returns TRUE if the object is visible in the frame.
Is object enabled.
Returns TRUE if the DataGrid control object is enabled (active).
Enumeration
On enumeration.
Use in conjunction with the enumeration actions. Catches the event generated by the enumeration. Please refer to these actions for more information.
Actions
Edit
Insert line
Inserts a new line in the grid. This action will ask for the number of the line where the insertion has to take place, and the text of the title of the line.
Insert column
Inserts a new column in the grid. This action will ask for the number of the column where the insertion has to take place, and the text of the title of the column.
Set line height
Sets the height in pixels of a given line. Asks for the number of the line and the new height.
Set column width
Sets the width in pixels of a given column. Asks for the number of the column, and the new width.
Autosize line
Resizes the line to match the height of the largest cell on the line.
Autosize column
Resizes the column to match the width of the largest cell on the line.
Delete line
Destroys a given line.
Delete column
Destroys a given column.====
Delete all
Destroys the entire content of the grid.
Prints the content of the array.
Grid
Set horizontal grid lines ON / OFF.
Turns on or off the horizontal grid lines on the display.
Set vertical grid lines ON / OFF.
Turns on or off the vertical grid lines on the display.
Display horizontal title line ON / OFF.
Displays the first line of the grid as a title (unselectable).
Display vertical title line ON / OFF.
Displays the first column of the grid as a title (unselectable).
Editable ON / OFF.
Sets the grid editable or not. When editable, a double click on a cell allows you to edit it. ====Enable selection ON / OFF. Allows the user to select more than one cell with the mouse cursor.
Set line resize ON / OFF.
Allows the user to resize the lines with the mouse cursor.
Set column resize ON / OFF.
Allows the user to resize the columns with the mouse pointer.
Cell
Set cell text
Changes the text of a specific cell. Will ask for three parameters, the line and the column of the cell, then the new text.
Ensure cell is visible
Moves the grid to bring a specific cell into view. Asks for two parameters, the indexes of the cell to display.
Select cells
Selects a number of cells. You have to enter the indexes (line and column) of the top left cell of the selection, and the indexes of the bottom right cell of the selection.
Unselect cells
Unselects all the cells on the grid.
Align text on the left
Aligns the text of a cell on the left. Will ask for line and column of the cell.
Center text
Centers the text of a cell Will ask for line and column of the cell.
Align text on the right
Aligns the text of a cell on the right. Will ask for line and column of the cell.
Center text vertically
Centers the text of a cell vertically. Will ask for line and column of the cell.
Allign text on top
Makes the text of a cell start on the top of the cell. Will ask for line and column of the cell.
Set background color
Changes the color of the background of a cell. Will ask for the line and column of the cell, and the new color to use.
Set font color
Changes the color of the font of a cell. Will ask for the line and column of the cell, and the new color to use.
File
Load
Loads the grid from a file. Warning, this action only works with files saved by the Save action (or saved in the setup box of the object). The file format retains all the characteristics of the array, and all the options.
Save
Saves the content of the array into a file. To be loaded with the "Load" action.
Load ascii
Loads the content of a structured ASCII file. An example of file understood by this action is the files saved by Excel in text mode. Each line of text represents a line, and the different cells are separated by TABs or commas. This action will ask for two parameters: the first one is the name of the file to load, the second is a string representing the delimiter used in the file. Enter an empty string to use TAB, or for example "," to use a comma.
Save ascii
Saves the content of the grid into a structured ASCII file. Each cell is delimited by a delimiter and a line of text represents a line in the grid. This action asks for two parameters, first the name of the file to save, then the delimiter itself. You can choose for example to enter "," to use a comma. To use a tabulation, leave the string empty.
Load from array object
Loads a file saved by the array object.
Save to array object
Saves the content of the grid in a format compatible with the array object. This action asks for two parameters, the first is the name of the file to save, the second determines how to save the data: 0 will save the data as texts, 1 will save the data as numbers (text cells will be converted to zeros).
Enumeration
Enumerate selected cells
Starts the enumeration of the currently selected cells. This action generates an event for each cell. This event can be caught with the condition "On enumerate". It works like the fast loop option in Clickteam Fusion 2.5. Have a look at the DataGrid example to see it at work.
Enumerate all cells
Starts enumerating all the cells of the grid. As for the previous action, this action generates an event for each one of the cell: you should catch this event with the "On enumerate" condition.
Window
Set width
Changes the width of the object.
Set height
Changes the height of the object.
Hide
Hides the grid object.
Show
Shows the grid object if it was hidden.
Enable
Enables the grid object if it was disabled.
Disable
Disables the grid object: it will not respond to any mouse or keyboard input.
Expressions
Note: The expression code provided below assume that the DataGrid object in your frame is named DataGrid Object, which is the default. If it is not, then you must switch it out in your expression code. For example, if your DataGrid object is named hello, then SelLine( "DataGrid Object" ) becomes SelLine( "hello" ).
Indexes
Get selected line
SelLine( "DataGrid Object" )
Returns the number of the currently selected line.
Get selected column
SelColumn( "DataGrid Object" )
Returns the number of the currently selected column.
Get line at click
LineClick( "DataGrid Object" )
Returns the number of the line where the user last clicked. Warning, this value can be different from the one returned by "Get selected line", as the user can use the keyboard to move the selection.
Get column at click
ColumnClick( "DataGrid Object" )
Returns the number of the column where the user last clicked. Same remark as for the previous expression.
Get line at coordinate
Line( "DataGrid Object", >X Coordinate<, >Y Coordinate< )
Returns the number of a line at a given position on the screen. Will ask for the X and Y coordinates of the position to test.
Get column at coordinate
Column( "DataGrid Object", >X Coordinate<, >Y Coordinate< )
Returns the number of the column at a given position on the screen. Will ask for X and Y coordinates of the position to test.
Get cell X left coordinate
dgXLeft( "DataGrid Object", >Line number<, >Column number< )
Returns the left coordinate of a cell's rectangle. The expression asks for two parameters: the number of the line and the number of the column.
Get cell Y top coordinate
dgYTop( "DataGrid Object", >Line number<, >Column number< )
Returns the top coordinate of a cell's rectangle. The expression asks for two parameters: the number of the line and the number of the column.
Get cell X right coordinate
dgXRight( "DataGrid Object", >Line number<, >Column number< )
Returns the right coordinate of a cell's rectangle. The expression asks for two parameters: the number of the line and the number of the column.
Get cell Y bottom coordinate
dgYBottom( "DataGrid Object", >Line number<, >Column number< )
Returns the bottom coordinate of a cell's rectangle. The expression asks for two parameters: the number of the line and the number of the column.
Information
Get cell text
Text$( "DataGrid Object", >Enter line number<, >Enter column number< )
Returns the text contained in a given cell. Will ask for the line and column of the cell.
Get number of lines
NLines( "DataGrid Object" )
Returns the number of lines currently defined in the grid.
Get number of columns
NColumns( "DataGrid Object" )
Returns the number of columns currently defined in the grid.
Get line height
LineSize( "DataGrid Object", >Line number< )
Returns the height of a given line. Asks for the number of the line.
Get column width
ColumnSize( "DataGrid Object", >Column number< )
Returns the width of a given column. Asks for the number of the column.
Enumeration
Get enumerated line
EnumLine( "DataGrid Object" )
Returns the current enumerated cell's line. Use this expression in conjunction with the enumeration actions and conditions.
Get enumerated column
EnumColumn( "DataGrid Object" )
Returns the currently enumerated column. Use this expression in conjunction with the enumeration actions and conditions.
Size
Get width
Width( "DataGrid Object" )
Returns the width of the grid object.
Get height
Height( "DataGrid Object" )
Returns the height of the grid object.
Count
Number of objects
NObjects( "DataGrid Object" )
Returns the number of DataGrid objects currently in the frame.