extras/CheckListBox: Added 'IsFullyChecked()'
authorJerome St-Louis <jerome@ecere.com>
Thu, 27 Nov 2014 04:36:50 +0000 (23:36 -0500)
committerJerome St-Louis <jerome@ecere.com>
Mon, 21 Dec 2015 19:23:24 +0000 (14:23 -0500)
- IsChecked() will return true if a check box is partially checked

extras/gui/controls/CheckListBox.ec

index 5e8e035..af784c8 100644 (file)
@@ -345,12 +345,22 @@ class CheckListBox : ListBox
 public:
    bool IsChecked(DataRow row)
    {
-      CheckListBoxButton button = buttonMaps[(uintptr)row];
+      if(IsFullyChecked(row))
+         return true;
+      else
+      {
+         CheckListBoxButton button = buttonMaps[(uintptr)row];
+         // For partially checked because of children:
+         if(button && button.checked)
+            return true;
+      }
+      return false;
+   }
+
+   bool IsFullyChecked(DataRow row)
+   {
       DataRow parent;
       for(parent = row; parent; parent = parent.parent) if(rowChecks.Find(parent)) return true;
-      // For partially checked because of children:
-      if(button && button.checked)
-         return true;
       return false;
    }