ObjectDCL Banner

Grid_AddColumns Method

Description

This method adds columns to a EditableGrid control. Complete control of each column has been provided with this method, the width, justification, and optional image from the image list can or must be specified for each control. Because this method asks you to specify the insertion index, columns don't have to be added at the end, but if necessary can be added in the beginning or the middle of the existing columns.

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.
nColIndex
Integer specifying the column index.
sColText
String specifying the text to display.
nJustification
Integer specifying the justification of the rows for that column, except for the first column. The valid values are:
  • 0 (Left)
  • 1 (Center)
  • 2 (Right)
nColWidth
Integer specifying the width of the column.
nImageListIndex
Integer specifying the index of the image in the list of images tied with the control and set at design.

Return Values

Returns the following according to the situation:

  • T when successful.
  • 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_AddColumns 
		MyControlReference [as Reference]
		(list 
			(list 
				nColIndex [as Integer] 
				sColText [as Integer] 
				nJustification [as Integer]
				nColWidth [as Integer]
				[Optional] nImageListIndex [as Integer]) 
			(list 
				nColIndex [as Integer] 
				sColText [as Integer] 
				nJustification [as Integer]
				nColWidth [as Integer]
				[Optional] nImageListIndex [as Integer]) 
			...
		)
	)

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_AddColumns
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		(list 
			(list 
				nColIndex [as Integer] 
				sColText [as Integer] 
				nJustification [as Integer]
				nColWidth [as Integer]
				[Optional] nImageListIndex [as Integer]) 
			(list 
				nColIndex [as Integer] 
				sColText [as Integer] 
				nJustification [as Integer]
				nColWidth [as Integer]
				[Optional] nImageListIndex [as Integer]) 
			...
		)
	)

Remarks

Because the EditableGrid control was design exclusively for Internet Explorer, the justification for the first column will only display left justification.  We wish this design intent of Microsoft's was not so, but unfortunately this is how Microsoft provides the control.

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
; Define columns
(Odcl_Grid_AddColumns MyProject_MyForm_MyControl
	(list
		(list 0 "Name" 0 150 0) 
		(list 1 "Home Phone" 2 80) 
		(list 2 "Work Phone" 2 80) 
		)
	)

See Also

Grid_CalcColWidth, Grid_DeleteColumn, Grid_GetColumnCount, Grid_GetColumnImage, Grid_GetColumnItems, Grid_GetColWidth, Grid_SetColumnImage, Grid_SetColWidth, Grid_SortNumericItems, Grid_SortTextItems