Why doesn't this work?

jschuchert

Active Member
Licensed User
Longtime User
B4X:
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 edittext1 As EditText 
Dim button1 As Button 
Dim somenumbers As Double 
somenumbers=98.23*45.12
End Sub

Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout ("area")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub button1_click
edittext1.text=somenumbers [color=red] nothing appears in edittext1[/color]
End Sub

Doing some experimenting but hit a wall. Stuff like above worked fine before but doesn't now. It matters not whether I put a variable or a literal string to display in the edittext1 box. It remains blank. The 'area' layout was called from the main layout that contains several menu buttons. Here is the code from there:
B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
Dim btnAngDist As Button 
Dim btnArea As Button 
Dim btnCurves As Button
Dim btnEmbed As Button 
Dim btnGrades As Button 
Dim btnInput As Button 
Dim btnList As Button 
Dim btnMapCheck As Button 
Dim btnPerpOffset As Button 
Dim btnRadial As Button 
Dim btnRotate As Button 
Dim btnStakeout As Button 
Dim menu As Panel 
Dim btnembed As Button 
Dim txtTest As EditText 

End Sub

Sub Activity_Create(FirstTime As Boolean)
'File.OpenOutput (
activity.LoadLayout ("menu")

End Sub
Sub btnArea_click
''txtTest.text="You pressed the area button"  [color=red] this is ok in the main module [/color]
removeviews
activity.LoadLayout ("area")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub btnembed_click
removeviews
activity.loadLayout("embed")
 End Sub
 Sub removeviews
 Dim i As Int
 For i=activity.NumberOfViews-1 To 0 Step -1
 activity.removeviewat(i)
 Next 
 ''startactivity("embed")
 End Sub
'Sub btnembed_click
'StartActivity(embed)
'End Sub 
Sub btnMenu_click
generalsubs.removeviews (activity)
activity.LoadLayout ("menu")
End Sub

I suspect it has to do with opening the activity from another activity module but I didn't have that problem before. I must have done something screwy. If someone can see my blunder, I would appreciate your bringing it to my attention. I need to move on. Thank you.

Jim Schuchert
 

jschuchert

Active Member
Licensed User
Longtime User
Thank you, Andy. It was a '"duh" moment after I realized my gaffe. I still have a lot to learn so stay tuned.

Jim
 
Upvote 0

jschuchert

Active Member
Licensed User
Longtime User
Incidentally, is there a way to shut down the T9 keyboard on the emulator other than 'Esc'. It (logically) pops up whenever I click in a text box and covers up other controls? The keypad on the other side is adequate for data entry.
 
Upvote 0
Top