[chronojump] Added method: UtilGtk.ComboCount()



commit d5a447334f2ce162a4ba255b56216cdb946b3dc2
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Apr 30 11:08:07 2021 +0200

    Added method: UtilGtk.ComboCount()

 src/utilGtk.cs | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index be0a2459..9f02d4d6 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -104,6 +104,18 @@ public class UtilGtk
                return ComboMakeActive(myCombo, ComboGetActive(myCombo));
        }
 
+       public static int ComboCount(ComboBox myCombo) {
+               int count = 0;
+               TreeIter iter;
+               myCombo.Model.GetIterFirst(out iter);
+               do {
+                       count ++;
+               } while (myCombo.Model.IterNext (ref iter));
+
+               return count;
+       }
+
+
 
        //this is better than the below method, because this search in current combo values
        //if we use a predefined set of values (like below method), we can have problems 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]