Forse mi son spiegato male!Forse continuro' a spigarmi male scusate!
Io ho bisogno di poter vedere la oggetto editbox in un modulo.
nel activity ho la mia editbox1 dichiarata
ma se nel modulo la scrivo con me or main mi da errore di compilazione!
Compiling code. Error
Error parsing program.
Error description: Undeclared variable 'editbox1' is used before it was assigned any value.
Occurred on line: 80
editbox1.Clear
Sub Process_Globals
End Sub
Sub Globals
Dim EditText1 As EditText
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("c")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
la.semplice
End Sub
Modulo si chiama la:
B4X:
'Code module
'Subs in this code module will be accessible from all modules.
Public 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 semplice
EditText1.text="CIAO"
End Sub
Sub Process_Globals
End Sub
Sub Globals
Dim EditText1 As EditText
Dim Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("c")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
la.semplice
End Sub
Modulo si chiama la:
B4X:
'Code module
'Subs in this code module will be accessible from all modules.
Public 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 semplice
[COLOR="red"]EditText1.text[/COLOR]
End Sub
There is something strange in your explanations, in your post#1 you are referencing to EditText.
In post #4 the error message says 'editbox1' .
How and where did you declare the EditText and with what name ?
Basically you cannot acces directly an activity object like an EditText view from another module.
What you can do is to pass the object as a parameter in the calling routine.
Attached a small test program showing it.
Main module:
B4X:
Sub Globals
'These variables can only be accessed from this module.
Dim edtTest As EditText
Dim btnTest As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
btnTest.Initialize("btnTest")
Activity.AddView(btnTest, 50dip, 50dip, 150dip, 50dip)
btnTest.Text = "Add text"
edtTest.Initialize("edtTest")
Activity.AddView(edtTest, 10dip, 150dip, 300dip, 50dip)
edtTest.Text = "Test"
End Sub
Sub btnTest_Click
Test.AddText(edtTest, " added text")
End Sub
Test code module:
B4X:
'Test Code module
Sub Process_Globals
End Sub
Sub AddText(edt As EditText, txt As String)
edt.Text = edt.Text & txt
End Sub
Grazie ragazzi per l'aiuto tranquilli io non sono arrabiato ,comunque penso che quando uno risponde a un aiuto merita un grazie,io purtroppo spesso non so spiegarmi bene ,e per questo mi scuso!