Hi,
Like others, I'm not really sure what the issue is and don't think describing how it works will add anything.
In my example I set the button to the element of an array.
In your example you use separate variables for each button:
In these cases, they "work independently of the internal button name ".
In the example by JR, he does use the internal variable name - it works, but I would always prefer to store in a local user variable. This looks like maybe a lucky oversight by JR.
The only time I might consider using the internal name is to access a large number of shapes without referring to user variables, for example removing Turtle lines (that are shapes).
Equally, and proably better would be:
Actually, the following would also work, but clearly is harder to follow:
This is partly why I used arrays to store the buttons in my example.
EDIT
Note the [i] array index in "button[i] = Controls.AddButton("",buttonX[i],buttonY[i]) ", which you missed in your post that confused me a bit.
Like others, I'm not really sure what the issue is and don't think describing how it works will add anything.
In my example I set the button to the element of an array.
Code:
button[i] = Controls.AddButton("",buttonX[i],buttonY[i])
In your example you use separate variables for each button:
Code:
ButtonRed = Controls.AddButton("",10,10)
In these cases, they "work independently of the internal button name ".
In the example by JR, he does use the internal variable name - it works, but I would always prefer to store in a local user variable. This looks like maybe a lucky oversight by JR.
Code:
Button1=Controls.AddButton("My Button1",0,0)
...
If Controls.LastClickedButton = "Button1" then
The only time I might consider using the internal name is to access a large number of shapes without referring to user variables, for example removing Turtle lines (that are shapes).
Equally, and proably better would be:
Code:
Button1=Controls.AddButton("My Button1",0,0)
...
If Controls.LastClickedButton = Button1 then
Actually, the following would also work, but clearly is harder to follow:
Code:
Controls.AddButton("My Button1",0,0)
...
If Controls.LastClickedButton = "Button1" then
This is partly why I used arrays to store the buttons in my example.
EDIT
Note the [i] array index in "button[i] = Controls.AddButton("",buttonX[i],buttonY[i]) ", which you missed in your post that confused me a bit.