DecoratorFawn82
Member
Hi there! I am new to B4A and is still running the trail version of B4A and I should actually buy full version.
This is the best program for creating apps that I have found compared with some other programs.
But I do not understand how to use CallSub function. My program I am trying to write is a quiz game and for every quiz I want the program to clear the screen so you can't see what the previous quiz was I tried to write:
Code for the Main file
And the code for Module1 is:
Please can someone help how to do this. An example of this is Bike Race when you starts up Bike Race it first gives you two choices multiplayer and singleplayer and if you chose someone of them you gets a new cleared screen on your phone with challenges to do for the game.
:sign0085:
This is the best program for creating apps that I have found compared with some other programs.
But I do not understand how to use CallSub function. My program I am trying to write is a quiz game and for every quiz I want the program to clear the screen so you can't see what the previous quiz was I tried to write:
Code for the Main file
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim CheckBox1 As CheckBox
Dim CheckBox2 As CheckBox
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Msgbox("Welcome to the quiz game!", "Quiz Game")
Activity.LoadLayout("Layout1")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
If CheckBox1.Checked = True Then
CheckBox1.Checked = False
Else
CheckBox1.Checked = True
Msgbox("The quiz has begun!", "Started Quiz")
CallSub(Module1, "NextModule")
End If
If CheckBox2.Checked = True Then
CheckBox2.Checked = False
End If
End Sub
Sub Button2_Click
If CheckBox2.Checked = True Then
CheckBox2.Checked = False
Else
CheckBox2.Checked = True
Msgbox("You where not ready to start quiz", "User Not Ready")
End If
If CheckBox1.Checked = True Then
CheckBox1.Checked = False
End If
End Sub
And the code for Module1 is:
B4X:
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
Msgbox("Welcome", "Quiz Game")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Please can someone help how to do this. An example of this is Bike Race when you starts up Bike Race it first gives you two choices multiplayer and singleplayer and if you chose someone of them you gets a new cleared screen on your phone with challenges to do for the game.
:sign0085:
Last edited: