From bf53a167ecce7dc34e87c11aace971f216023bae Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Thu, 25 Mar 2010 23:04:14 +0000 Subject: [PATCH] Lua Fix radio buttons that can't be re-checked if they are at top of inputbox git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1421 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- share/grafx2/scripts/_tst_Settings.lua | 6 +++--- src/factory.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/share/grafx2/scripts/_tst_Settings.lua b/share/grafx2/scripts/_tst_Settings.lua index 8d968ac1..7f5bfe6f 100644 --- a/share/grafx2/scripts/_tst_Settings.lua +++ b/share/grafx2/scripts/_tst_Settings.lua @@ -13,13 +13,13 @@ messagebox( ok, w, h = inputbox("Modify brush", + "RGB", 1, 0, 1, -1, + "HSV", 0, 0, 1, -1, + "HSL", 0, 0, 1, -1, "Width", w, -900.0,900.0, 3, "Height", h, -900.0,900.0, 4, "X Flip", 0, 0, 1, 0, "Y Flip", 0, 0, 1, 0, - "RGB", 1, 0, 1, -1, - "HSV", 0, 0, 1, -1, - "HSL", 0, 0, 1, -1, "Degrees",1, 0, 1, -2, "Radians",0, 0, 1, -2 ); diff --git a/src/factory.c b/src/factory.c index 03bdcfdd..3dbcfb40 100644 --- a/src/factory.c +++ b/src/factory.c @@ -592,6 +592,10 @@ int L_InputBox(lua_State* L) Open_window(115+max_label_length*8,44+nb_settings*17,window_caption); + // Normally this index is unused, but this initialization avoids + // any weird behavior if it was used by mistake. + control[0]=0; + // OK Window_set_normal_button( 7, 25 + 17 * nb_settings, 51,14,"OK" , 0,1,SDLK_RETURN); control[Window_nb_buttons] = CONTROL_OK; @@ -725,7 +729,7 @@ int L_InputBox(lua_State* L) if (decimal_places[setting]<0) { byte button; - for (button=0; button<=Window_nb_buttons; button++) + for (button=3; button<=Window_nb_buttons; button++) { if (button != clicked_button && control[button] & CONTROL_CHECKBOX) {