Sign in to follow this  
Followers 0
wisem2540

GUI with a list of buttons. How can I set their positions with a variable?

2 posts in this topic

#1 ·  Posted (edited)

I have a GUI with a long list of buttons.

Something like this

$button1 = GUICtrlCreateButton("Go", 10, 50, 25, 25)

$button2 = GUICtrlCreateButton("Go", 10, 60, 25, 25)

$button3 = GUICtrlCreateButton("Go", 10, 70, 25, 25)

$button4 = GUICtrlCreateButton("Go", 10, 80, 25, 25)

Notice how they are all 10 spaces apart.  What I would like to do is specify a Variable like this...

$Start = 50 then every time there is a new button, just add 10 to the position.  This way I could move buttons around in the list and not have to manually change the values.  or, I could change the starting 50 value to 20.  Then have the rest fall in line 30, 40, and so on...again without having to change manually....

Edited by wisem2540

Share this post


Link to post
Share on other sites



Global $button[6], $start = 50, $x = 10

For $i = 0 to Uboud($button) - 1
$button[$i] = GUICtrlCreateButton("Button " & $i, 10, $start + $x * $i, 25, 25)
Next

Share this post


Link to post
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
Sign in to follow this  
Followers 0