Code Module Question

ALG460

New Member
Licensed User
Longtime User
This may be the dumbest question ever asked here but I'm so used to VB that even simple things about Basic4android stump me. In the following code below, I want to move the code contained in Sub Activity_Resume into a code module sub. Once I do though its like pnlGraph and XYGraph are no longer recognized. What is the proper way to declare them?
Thanks Tony

#Region Module Attributes
#End Region

'Activity module
Sub Process_Globals

End Sub

Sub Globals
Dim pnlGraph As Panel
Dim XYGraph As Canvas


End Sub

Sub Activity_Create(FirstTime As Boolean)

Activity.LoadLayout("main1")

End Sub

Sub Activity_Resume

XYGraph.Initialize(pnlGraph)
Dim Border etc etc

Dim Rect1 As Rect
Rect1.Initialize(Border,Border,GraphWidth,GraphHeight)
XYGraph.DrawRect(Rect1,Colors.Black,False,2)


End Sub
 

ALG460

New Member
Licensed User
Longtime User
You can pass them as parameters to the sub in the code module.
Also, please use the
B4X:
  tags when posting code.[/QUOTE]

 Thanks. I got it now. I originally tried that but what threw me is that in the code module when I typed the declared names they did not change color in the editor as they do in the main module. I'm having lots of trouble escaping the VB mind set where a global item was truly global and anything placed on any form was available to all modules by  explicitly typing its full name like "Form1.Button1.[I]Whatever[/I]". Thanks again

Tony
 
Upvote 0
Top