ObjectDCL Banner

Grid_InsertRow Method

Description

This method inserts a new item anywhere in a EditableGrid control and will also fill in the cells in the entire row according to how many columns have been setup. Using this method the very first cell under the first column can be specified to display an image from the image list.  Use Grid_SetItemImage to set the icons of any column cell.

Parameters

MyControlReference
Reference to the control in the form of MyProject_MyForm_MyControl.
ProjectFile
String identifying the project as it was passed in LoadProject.
DialogName
String identifying the dialog by name.
ControlName
String identifying the control by name.
nInsertRowIndex
Integer specifying the index where to insert the new row.
nImageIndex
Integer specifying the index of the image in the list defined at design for the control.
sTextX
String specifying the text to display.

Return Values

Returns the following according to the situation:

  • Integer identifying the index of the new row.
  • Nil if the control is not found or does not support this function.

AutoLISP Syntax

The recommended convention is passing the control identifier directly:

CopyCode imageCopy Code
(Odcl_Grid_InsertRow 
		MyControlReference [as Reference]
		nInsertRowIndex [as Integer]
		(list 
			[Optional] nImageIndex [as Integer]
			sText1 [as String]
			sText2 [as String]
			...
			sTextN [as String]
		)
	)

An alternative convention is to identify the control by providing the project file, the dialog name and the control name:

CopyCode imageCopy Code
(Odcl_Grid_InsertRow
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		nInsertRowIndex [as Integer]
		(list 
			[Optional] nImageIndex [as Integer]
			sText1 [as String]
			sText2 [as String]
			...
			sTextN [as String]
		)
	)

Remarks

The style of the cell or column only governs the behavior of the cell and what happens when the user clicks on the cell.

For exampleb if you set the style 33 - Linetype Cell, the current selection for the linetype must be correctly set in the Grid_AddString or Grid_AddRow functions. The item may not be changed to correctly display one of the listed items.

Please create lists as follows using the list keyword:

(list (list x y ...) (list x y ...) ...)
		

It seems that ObjectARX does not always handle lists created as follows:

'(x y ...) (x y ...) ...  
		

Applies For

EditableGrid.

Example

CopyCode imageCopy Code
; Insert a new row at the beginning of the list
(setq rValue (Odcl_Grid_InsertRow MyProject_MyForm_MyControl
	0 (list 2 "Debit Card")))

See Also

Grid_AddRow, Grid_Clear, Grid_DeleteRow, Grid_FillList, Grid_GetRowCount, Grid_GetRowItems, Grid_SelCurRow