F fraxinus Member Licensed User Longtime User May 20, 2011 #1 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
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 May 20, 2011 #2 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
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.
F fraxinus Member Licensed User Longtime User May 20, 2011 #3 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
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
klaus Expert Licensed User Longtime User May 20, 2011 #4 Following code would do it: Code: Sub Button1_Click Dim miles As Int Dim yards As Int Dim result As Int miles = edtMiles.Text yards = edtYards.Text result = miles + yards edtResult.Text = result End Sub Best regards. Upvote 0
Following code would do it: Code: Sub Button1_Click Dim miles As Int Dim yards As Int Dim result As Int miles = edtMiles.Text yards = edtYards.Text result = miles + yards edtResult.Text = result End Sub Best regards.
F fraxinus Member Licensed User Longtime User May 20, 2011 #5 Newbie Thanks Klauss your a gentleman. Rob Upvote 0
Brad Active Member Licensed User Longtime User May 20, 2011 #6 You forgot to Dim your button under Globals. Without it nothing will happen. Dim Button1 as Button Upvote 0
K kickaha Well-Known Member Licensed User Longtime User May 20, 2011 #7 Brad said: You forgot to Dim your button under Globals. Without it nothing will happen. Dim Button1 as Button Click to expand... As the button is not added in the code and he loads a layout Code: 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 said: You forgot to Dim your button under Globals. Without it nothing will happen. Dim Button1 as Button Click to expand... As the button is not added in the code and he loads a layout Code: Activity.LoadLayout("Velocity") it would be safe to assume the button is on that. In which instance your suggestion will STOP it working :sign0161:
Brad Active Member Licensed User Longtime User May 21, 2011 #8 kickaha said: As the button is not added in the code and he loads a layout Code: Activity.LoadLayout("Velocity") it would be safe to assume the button is on that. In which instance your suggestion will STOP it working :sign0161: Click to expand... 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 said: As the button is not added in the code and he loads a layout Code: Activity.LoadLayout("Velocity") it would be safe to assume the button is on that. In which instance your suggestion will STOP it working :sign0161: Click to expand... If the button is on the layout then he wouldn't need to initialize it. He still needs the Dim statement. :sign0161:
K kickaha Well-Known Member Licensed User Longtime User May 21, 2011 #9 Brad said: If the button is on the layout then he wouldn't need to initialize it. He still needs the Dim statement. :sign0161: Click to expand... 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: May 21, 2011 Upvote 0
Brad said: If the button is on the layout then he wouldn't need to initialize it. He still needs the Dim statement. :sign0161: Click to expand... 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:
Brad Active Member Licensed User Longtime User May 21, 2011 #10 You are correct! I had always thought you needed to declare the views. Upvote 0
K kickaha Well-Known Member Licensed User Longtime User May 21, 2011 #11 Brad said: You are correct! I had always thought you needed to declare the views. Click to expand... One for the beginners tips thread I think. You should add it there as others may think the same.:sign0089: Upvote 0
Brad said: You are correct! I had always thought you needed to declare the views. Click to expand... One for the beginners tips thread I think. You should add it there as others may think the same.:sign0089:
F fraxinus Member Licensed User Longtime User May 21, 2011 #12 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
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