Help Nwbie

fraxinus

Member
Licensed User
Longtime User
I,ve got everything up and running software and hardware.
First project test. Everyhing displaying on device but the Button_Click not working on program.
Any help would be appreciated.
Thanks
Rob

'Activity module
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)
Activity.LoadLayout("Velocity")
End Sub

Sub Button1_Click
Dim miles As Int
Dim yards As Int
Dim result As Int
result = miles + yards
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

klaus

Expert
Licensed User
Longtime User
What do you expect from the Button1_Click event ?
The code you post below will do nothing.
Did you set the values of the miles and yards variables somewhere ?
What do you want to do with the result variable.

The best way to help you would be to post your whole project with 'Export As Zip' in the IDE and attach the zip file.

Best regards.
 
Upvote 0

fraxinus

Member
Licensed User
Longtime User
Newbie

Klauss
The miles yards and result are text boxes.
Basicaly I want to click calculate button when I fill in the amounts to the miles and yards text boxes with the total amount shown in the result text box
Rob
 
Upvote 0

Brad

Active Member
Licensed User
Longtime User
You forgot to Dim your button under Globals. Without it nothing will happen.

Dim Button1 as Button
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
You forgot to Dim your button under Globals. Without it nothing will happen.

Dim Button1 as Button

As the button is not added in the code and he loads a layout
B4X:
Activity.LoadLayout("Velocity")
it would be safe to assume the button is on that.

In which instance your suggestion will STOP it working :sign0161:
 
Upvote 0

Brad

Active Member
Licensed User
Longtime User
As the button is not added in the code and he loads a layout
B4X:
Activity.LoadLayout("Velocity")
it would be safe to assume the button is on that.

In which instance your suggestion will STOP it working :sign0161:

If the button is on the layout then he wouldn't need to initialize it. He still needs the Dim statement. :sign0161:
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
If the button is on the layout then he wouldn't need to initialize it. He still needs the Dim statement. :sign0161:

He does not need to Dim it, as none of his code references any of the buttons properties, but "Dim"ing it would not stop it working as I claimed. It is late :sign0013:
 
Last edited:
Upvote 0

fraxinus

Member
Licensed User
Longtime User
Newie thanks

Can I thank you all for your help. Got my app up and running on my Acer Iconia.
very pleased with Basic4android..
thanks
Rob
 
Upvote 0
Top