Ropetin Again Posted July 16, 2007 Share Posted July 16, 2007 I'm not sure if this makes sense or not, but I can't think of any other way to do it. Let me me explain what I'm trying to achieve. I have a text file acting as a 'config' file. Each line contains a single word, which I would like to be made into a button on a GUI. The text file is editable so the button names, and number of buttons can be easily changed by a user without editing the script. The file is read into an array with; _FileReadToArray ( "buttonnames.txt", $aNames ) And I can determine how many buttons I need with; $aNames[0] To create the buttons I could do something to the effect of; For $x = 1 to $aNames[0] ;Code to create button here Next The problem is, to read when a button is pressed, I need to do a; $button = GUICtrlCreateButton (.... But it won't let me use (or I don't know how to use) a variable, in this case $x, as an additional part of the variable name, so I can create $button1, $button2, $button3 etc. Any ideas how I can do this, or any suggestions on a better way of achieving what I'd like to do? Link to comment Share on other sites More sharing options...
Paulie Posted July 16, 2007 Share Posted July 16, 2007 (edited) Try with an array: Dim $Buttons[$aNames[0]+1] For $x= 1 to $aNames[0] $Buttons[$x] = GUICtrlCreateButton($aNames[$x]);skipped rest of parameters. Next Edited July 16, 2007 by Paulie Link to comment Share on other sites More sharing options...
Ropetin Again Posted July 16, 2007 Author Share Posted July 16, 2007 An array, genius, thank you! Link to comment Share on other sites More sharing options...
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