SagePourpre Posted August 1, 2008 Posted August 1, 2008 (edited) Hi. I'm trying to do a script that open a msgbox when I click on a button. But, buttons are created by an array. CODE#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 445, 193, 125) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Dim $button For $i = 1 to 24 $button = GUICtrlCreateButton($i,0+$i*12,0,10,10) GUICtrlSetData(-1,$i) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button for $i = 1 to 24 if $i = $button Then MsgBox(0,"","") EndIf Next EndSwitch WEnd I want each buttons to display something different but i've done something wrong and right now, it don't react ... any idea ? thanks, Sage Pourpre Edited August 2, 2008 by SagePourpre
JFee Posted August 1, 2008 Posted August 1, 2008 Each button should have its own variable... right now you don't even have an array Dim $button[25] For $i = 1 to 24 $button[$i] = GUICtrlCreateButton($i,0+$i*12,0,10,10) GUICtrlSetData(-1,$i) Next And you can set the parameters in the GUICtrlCreateButton to be whatever you want Regards,Josh
SagePourpre Posted August 2, 2008 Author Posted August 2, 2008 Got it.... Using GUICtrlSetOnEvent($BUTTON, "smiley") and Func Smiley() $a = ControlGetText($gui, "", @GUI_CtrlId) ... End Func
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now