I am going crazy trying to get my grid to behave as i want it to. I'm sure I'm forgetting something simple and obvious, but for the life of me I can't spot it.
OpenDCL 6.0.2.5 on AutoCAD 2006 SP1 and Windows XP SP3
(defun c:QuickTest()
(command "_OPENDCL")
(if (dcl_Project_Load "QuickTest")
(setq Result (dcl_Form_Show QuickTest_Form1))
)
)
(defun c:QuickTest_Form1_OnInitialize (/)
(while (dcl_Grid_DeleteColumn QuickTest_Form1_Grid1 0))
(dcl_Grid_Clear QuickTest_Form1_Grid1)
(dcl_Control_SetRowHeader QuickTest_Form1_Grid1 T)
(setq dbfieldlist (list "Dwgnumber" "DwgTitle" "Dwgname" "Dwgissue"))
(dcl_Grid_AddColumns QuickTest_Form1_Grid1 (list (list "" 0 20 0) (list "" 0 20 0) (list "DatabaseField" 0 140 0)))
;(dcl_Control_SetColumnStyleList QuickTest_Form1_Grid1 0 1 36)
;(dcl_Control_SetColumnListItems QuickTest_Form1_Grid1 (list nil nil dbfieldlist))
(dcl_Grid_DeleteColumn QuickTest_Form1_Grid1 3)
(dcl_Grid_InsertRow QuickTest_Form1_Grid1 1 "" "" "DwgNumber1")
(setq combodatalist (append (list "Dwgnumber1") dbfieldlist))
(dcl_Grid_SetCellStyle QuickTest_Form1_Grid1 1 2 36)
(dcl_Grid_SetCellDropList QuickTest_Form1_Grid1 1 2 combodatalist)
)
The Form is just a modal dailog box with a grid component only.
If I run it like this it will not set the type to 36. a call to getcelltype will return as 36, but it is not in the actual form. Please educate me as to what I am doing wrong. If I uncoment out the 2 lines above that sets the column default and the coulm default list value it works but I am unable to modify the list to append the current value. any help is greatly appreciated.
Hi, without knowing if it solves your problem I'd call dcl_grid_AddRow instead of InsertRow. InsertRow means to insert a new row between existing rows. I prefer to do it this way:
(setq lstItems '("Line1" "Line2"))
(foreach strItem lstItems
(if (setq intRow (dcl_Grid_AddRow myGrid strItem "" ""))
(progn
(dcl_Grid_SetCellStyle myGrid intRow 2 36)
(dcl_Grid_SetCellDropList myGrid intRow 2 lstItems)
(dcl_Grid_SetCellDropList myGrid intRow 2 strItem)
); progn
); if
); foreach
Regards, Fred
Fred,
THANKS! This works perfect. That makes sense. I was essentially always insertinga row and then modifying a different row, so i guess my setstyle or list settings were never getting applied to the correct cell. using the add method works like a charm.
Danke, das ist sehr gut!
Thank you and have a great day,