I would like to explain the issue of internal names in a hopefully understandable way:
AB says:
When creating a button, we assign its internal name to a variable.
The developer assigns the name of this variable himself. He can use the name that is most convenient and understandable to him.
That's correct, but 2 examples don't use the variable !
In litdev's and my demo the variable is used:
button = Controls.AddButton("",buttonX[i],buttonY[i])
If (Controls.LastClickedButton = button[i]) Then
ButtonRed = Controls.AddButton("",10,10)
If Controls.LastClickedButton = ButtonRed then
[i]The programs work independently of the internal button name
The variable is not used in the example by jr
Button1=Controls.AddButton("My Button1",0,0)
If Controls.LastClickedButton = "Button1" then
The string "Button1" is queried and not the content of the variable Button1.
Beginners might ask, why do I have to put the variable in quotation marks?
The variable is not used in the example by whturner
but[bb]=Controls.AddButton("",50*bb,gh-40)
lastbut=Text.GetSubTextToEnd(Controls.LastClickedButton,7)
It is assumed that the 7th position of the internal name always contains 1, 2 or 3.
Very mysterious for beginners.
Both programs assume that the internal name never changes!
This could happen with an update of Small Basic (very unlikely).
But also as in my example, where the buttons have to be removed and recreated so that the text gets a different color.
When a new button is created, the name is continuously incremented. I have expanded the example with a text window output:
[/i][/i][/i][/i]
AB says:
When creating a button, we assign its internal name to a variable.
The developer assigns the name of this variable himself. He can use the name that is most convenient and understandable to him.
That's correct, but 2 examples don't use the variable !
In litdev's and my demo the variable is used:
button = Controls.AddButton("",buttonX[i],buttonY[i])
If (Controls.LastClickedButton = button[i]) Then
ButtonRed = Controls.AddButton("",10,10)
If Controls.LastClickedButton = ButtonRed then
[i]The programs work independently of the internal button name
The variable is not used in the example by jr
Button1=Controls.AddButton("My Button1",0,0)
If Controls.LastClickedButton = "Button1" then
The string "Button1" is queried and not the content of the variable Button1.
Beginners might ask, why do I have to put the variable in quotation marks?
The variable is not used in the example by whturner
but[bb]=Controls.AddButton("",50*bb,gh-40)
lastbut=Text.GetSubTextToEnd(Controls.LastClickedButton,7)
It is assumed that the 7th position of the internal name always contains 1, 2 or 3.
Very mysterious for beginners.
Both programs assume that the internal name never changes!
This could happen with an update of Small Basic (very unlikely).
But also as in my example, where the buttons have to be removed and recreated so that the text gets a different color.
When a new button is created, the name is continuously incremented. I have expanded the example with a text window output:
[/i][/i][/i][/i]