radio button indices should start at 1 (Cocoa)

Thu, 17 Apr 2025 10:33:05 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 17 Apr 2025 10:33:05 +0200
changeset 568
797b73c2c883
parent 567
4ee3e4ce03ad
child 569
5c06bb9ea458

radio button indices should start at 1 (Cocoa)

ui/cocoa/button.m file | annotate | diff | comparison | revisions
--- a/ui/cocoa/button.m	Thu Apr 17 10:27:49 2025 +0200
+++ b/ui/cocoa/button.m	Thu Apr 17 10:33:05 2025 +0200
@@ -252,17 +252,17 @@
     int64_t index = 0;
     for(UiRadioButton *b in buttons) {
         if([b cell].state != 0) {
-            i->value = index;
+            i->value = index + 1;
             break;
         }
         index++;
     }
-    return index;
+    return i->value;
 }
 
 void ui_radiobuttons_set(UiInteger *i, int64_t value) {
     NSMutableArray *buttons = (__bridge NSMutableArray*)i->obj;
-    int64_t index = 0;
+    int64_t index = 1;
     for(UiRadioButton *b in buttons) {
         if(index == value) {
             [b cell].state = NSControlStateValueOn;

mercurial