Here my PM answer (so others can read my answer too):
----------------------------------------------------------------------------
1. In designer a button have a name. for ex btnGo
this name is then automatically copied into the property eventname
2. button becomes the name btnquit and this is also copied to the eventname
You have now two buttons in designer. one with btngo and one with btnquit in the field eventname.... THIS would result in that you have TWO subs for the buttons. btgo_click and btnquit_click
BUT you can set the EVENTNAME in designer to the same eventname as an other button. so i realized this one sub thing...
the button_click in the create just do call this sub. Nothing more...
--------------------------------------------------------------------------
Additional answer:
You can remove this button_click-call from activity_create. At appstart the buttons then have the colors designed in designer...
With the call of this sub the buttons are changed at appstart. nothing more.
How is it possible to DIM the same variables 3 times in one procedure? Any other form of Basic would not even compile that. I really find this language most mysterious.
I can imagine that. The best person who can answer such a question would be Erel i think
But i will try to explain what happen with a example
Imagine in YOUR basic you are reading a texfile.
Each line of this file you want to put into a list
as pseudocode would look like
sub something
dim question as string
dim questions as list
textfile = fopen ("file.txt")
while not eof do
question = readline(textfile)
' on each interation of lines in textfile we now have content of line x in the variable question
questions.add(question)
' we add this content to the list
end
closefile(textfile)
What would you expect to be inside the lists entries if the textfile would contain
Name of Father?
Pet you love best?
Girl you loved first?
Whats inside the list questions after the above pseudocode?
Right; you would expect that the list looks like
questions(0)="Name of Father?"
questions(1)="Pet you love best?"
questions(2)="Girl you loved first?"
right?
In a normal "basic" it would like this, yes. In Basic4Android the values are given as reference
Each "questions.add(question)" will put a reference to the variable question into the list. Not its value.
If you then change the value of question then all references to question have the new value
In reality the pseudocode results in a list questions
questions(0)="Girl you loved first?"
questions(1)="Girl you loved first?"
questions(2)="Girl you loved first?"
"Girl you loved first?" was the last value i the loop reading the file. As all values are put to this list as reference, not as value, all reference got the value "Girl you loved first?".
In basic 4 android the code must be something like
sub something
dim questions as list
textfile = fopen ("file.txt")
while not eof do
dim question as string ' A instance of variable question is generated
question = readline(textfile)
' on each interation of lines in textfile we now have content of line x in the variable question
questions.add(question) ' the given question is the newly generated instance of this variable
' we add this content to the list
end
closefile(textfile)
so every linecontents is now added to the list. question is in each interation a NEW INSTANCE of the string question.
The first dimmed are not usable at the end of the routine, yes. It got new instances of itself... You can only use the last dimmed question, that´s right. But in the list questions all references are stored. And if you iterated trough this list now the references will find the right value.
questions(0)="Name of Father?"
questions(1)="Pet you love best?"
questions(2)="Girl you loved first?"
I´m not sure if i explained it right. I code b4a since 10 month or something. I also have to learn a lot
Maybe guru Erel gives his 5 cent to this
He is the best who could describe it ;-)
Anyway i hope my simple example helps a little bit to understand