Checkboxes in Grid quit working

Started by seej, October 20, 2009, 12:56:45 PM

Previous topic - Next topic


I have a grid with a column of check boxes. For the first 13 or so, I cannot change the check once it has been checked. for the remaining boxes, I can turn them on and off as expected. Here is the code I use to populate the grid along with a sample of the data at the top. This is is on and i tried it on the latest version I could download and it did the same. Is there something I'm doing wrong or is it a bug?

    ;Attr   Width   Just   Title   CheckboxTitle   Checkstate   Order
    ;("ROOM_NUMBER" "1\"" "Left" "ROOM NO." "" 1 "1")

    (dcl_Grid_FillList Schedule-Room_Form1_Grid2 lstOrderList)
    (setq count 0)
    (while (< count (length lstOrderList))
      (dcl_Grid_SetCellCheckState Schedule-Room_Form1_Grid2 count 4 (nth 5 (nth count lstOrderList)))
      (setq count (1+ count))




See if you can reproduce the problem in a new project with just a single grid control and an OnInitialize event handler. If you can, post the .odcl and .lsp files so I can have a look.
Owen Wengerd (Outside The Box) / ManuSoft


OK it is my data that is messing it up. I am feeding the list an integer after the checkbox which I am not supposed to do. It appears if the integer is a zero, it will function still but if the integer is greater than 0, the it locks the checkbox once it is checked. the reason why my data allowed me to check some and not others is that I am setting some as defaults to on and they had a setting of 1, the other were optional and they had a setting of zero.  It was only my default ones that were locked. I need to remove those settings from my fill list. I actually found this when i had a typo with this test code when i was getting it to work. Led me to the conclusion that the data was bad.

So it is my bad data that is locking the checkbox but perhaps we need an error check or something in the ODCL so that people like me don't mess it up. ;D


here is the code.

 (defun c:gridtest_Form1_OnInitialize (/)
   (setq datalist (list 1 1 1 1 1 1 1))  
   (setq filllist (list (list "1" "1\"" "left" "Check 1" "" "1")
          (list "2" "1\"" "left" "Check 2" "" "2")
          (list "3" "1\"" "left" "Check 3" "" "3")
          (list "4" "1\"" "left" "Check 4" "" "4")
          (list "5" "1\"" "left" "Check 5" "" "5")
          (list "6" "1\"" "left" "Check 6" "" 1);;<- this one will lock
          (list "7" "1\"" "left" "Check 7" "" 0);;<- this one will not lock but is also incorrect
          (list "8" "1\"" "left" "Check 8" "" "8")
          (list "9" "1\"" "left" "Check 9" "" "9")
          (list "10" "1\"" "left" "Check 10" "" "10")
          (list "11" "1\"" "left" "Check 11" "" "11")
          (list "12" "1\"" "left" "Check 12" "" "12")
          (list "13" "1\"" "left" "Check 13" "" "13")
          (list "14" "1\"" "left" "Check 14" "" "14")
   (dcl_grid_filllist gridtest_form1_grid1 filllist)
   (setq count 0)
   (while (< count (length datalist))
     (dcl_grid_setcellcheckstate gridtest_form1_grid1 count 4 (nth count datalist))
     (setq count (1+ count))



The integer is interpreted as the optional "ImageIndex" for the cell. A cell's ImageIndex is stored in the cell state, which is also used to track the checked/unchecked state of the cell. It turns out that when you set the image index of a cell to 1, the cell's checked and unchecked cell states then use the same image, so toggling has no effect.

That's a weird one, but I don't see any way to prevent this potential situation without significant changes in how the cell state is tracked. I'm going to leave it the way it is. If this problem happens to someone else, hopefully a search will turn up this thread and they'll know what to look for.
Owen Wengerd (Outside The Box) / ManuSoft