Android Question no calling sub from main or other subs.

howard bassen

Member
Licensed User
Longtime User
in the second program in the Beginners guide is the following:
B4X:
Sub btnAction_Click
IfbtnAction.Text = "O K"Then
IflblResult.Text=""Then
Msgbox("No result entered","E R R O R")
Else
CheckResult
EndIf
Else
New
btnAction.Text = "O K"
lblResult.Text = ""
EndIf
End Sub

there is no calling this sub from main or other subs.

my question:
What is calling this sub other than a button click?

the guide states: only this, whichch does nor answer my question.

"Clicking on an event of a view generates the Sub frame for this event.

B4X:
Sub btnAction_Click
End Sub[/end code]
Click on to generate the references and Sub frames, then .
 

derez

Expert
Licensed User
Longtime User
The sub btnAction_Click is performed when the user presses the button named "btnAction".
You can call it by this name from other places in the program.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The sub btnAction_Click is performed when the user presses the button named "btnAction".
... when the user presses the button which eventname is set to "btnAction"! I must not be the NAME of the button.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
What is calling this sub other than a button click?
Nothing.
It's the Click event routine for the button btnAction.
B4A is event driven.
Each object has properties (like Left, Top, Width, Height), mehtods (like Initialize, RemoveView) and events (like Click, LongClick).
Not all objects have the same properties, methods and events.
Depending on user actions, events are raised by the operating system and the corresponding event routine is run (like the btnAction_Click routine).
 
Upvote 0
Top