Jump to content

[...] assign var to buttons created in a array ?


Recommended Posts

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 by SagePourpre
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...