2008-02-01 00:33 UTC
[OpenDCL Studio 4.1.2.1]
Hello everyone,
I'm having a hell of a time trying to sort my Grid control. Here are are my issues;
1. Grid control only sorts ascending. I'm using the column click event and to init the sort. I've ried T/nil and 1/0.
2. When the grid does sort (ascending only), it only sorts text cells. It ignores Check Boxes and AcadColor cells. I've used dcl_Grid_SortNumericItems and dcl_Grid_SortTextItems. The AcadColor cell gets all messed up, the colors change.
I've debugged the hell out of my code and confirmed its passing the correct arguments.
Let me know if you've used this control and got it sorting properly. Also let me know if you have had problems with sorting Check Boxes and AcadColor cells.
Thats it. Theres a pic of my grid at the bottom.
Cheers,
JMack
If your wondering about my code, here's a snippet (I don't expect anyone to understand any of it)
[attachment deleted by admin]
Hello everyone,
I'm having a hell of a time trying to sort my Grid control. Here are are my issues;
1. Grid control only sorts ascending. I'm using the column click event and to init the sort. I've ried T/nil and 1/0.
2. When the grid does sort (ascending only), it only sorts text cells. It ignores Check Boxes and AcadColor cells. I've used dcl_Grid_SortNumericItems and dcl_Grid_SortTextItems. The AcadColor cell gets all messed up, the colors change.
I've debugged the hell out of my code and confirmed its passing the correct arguments.
Let me know if you've used this control and got it sorting properly. Also let me know if you have had problems with sorting Check Boxes and AcadColor cells.
Thats it. Theres a pic of my grid at the bottom.
Cheers,
JMack
If your wondering about my code, here's a snippet (I don't expect anyone to understand any of it)
(defun HDF_ODCLGrid_Sort (strFunction strGrid eGrid iColumn / iSortColumn iSortOrder)
(cond
((null iColumn)(HDF_ODCLGrid_InitSort strFunction strGrid eGrid))
((eq 1 (HDF_ODCLGrid_RegGetColumn strFunction strGrid iColumn "sortable"))
(setq
iSortColumn (HDF_ODCLGrid_RegGet strFunction strGrid "SortColumn")
iSortOrder (HDF_ODCLGrid_RegGet strFunction strGrid "SortOrder")
)
(if
(eq iSortColumn iColumn)
(if
(eq iSortOrder 1)
(setq iSortOrder 0)
(setq iSortOrder 1)
)
(setq iSortColumn iColumn iSortOrder 1)
)
(HDF_ODCLGrid_RegPut strFunction strGrid "SortColumn" iSortColumn)
(HDF_ODCLGrid_RegPut strFunction strGrid "SortOrder" iSortOrder)
(HDF_ODCLGrid_InitSort strFunction strGrid eGrid)
)
(T nil);columns not sortable
)
nil
)
(defun HDF_ODCLGrid_InitSort (strFunction strGrid eGrid / iSortColumn iSortOrder)
(setq
iSortColumn (HDF_ODCLGrid_RegGet strFunction strGrid "SortColumn")
iSortOrder (HDF_ODCLGrid_RegGet strFunction strGrid "SortOrder")
)
(HDC_Debug_Print (strcat "\niSortColumn: " (vl-princ-to-string iSortColumn) ", " "iSortOrder: " (vl-princ-to-string iSortOrder)))
(if
(member (HDF_ODCLGrid_RegGetColumn strFunction strGrid iSortColumn "style") (list 1 8 30 31));;is this a numeric column?
(dcl_Grid_SortNumericItems eGrid iSortColumn (eq 1 iSortOrder))
(dcl_Grid_SortTextItems eGrid iSortColumn (eq 1 iSortOrder))
)
nil
)
[attachment deleted by admin]