come posso passare una EditText a un modulo?
Ho provato:
me.EditText.text =
main.EditText,text=
ma non mi funziona,si puo fare?
grazie!
dim et as editetext
modulo.et = main.editText1
dim et as string
modulo.et = main.editText1.text
Vuoi passare l'oggetto edittext oppure il testo scritto in una edittext ?come posso passare una EditText a un modulo?
Ho provato:
me.EditText.text =
main.EditText,text=
ma non mi funziona,si puo fare?
grazie!
Forse mi son spiegato male!Forse continuro' a spigarmi male scusate!
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
'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
B4X: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
Sub Button1_Click
msgBox(la.semplice,"")
End Sub
Sub Button1_Click
msgBox(la.semplice(EditText1,"")
End Sub
Sub semplice (t as EditText) as string
return t.text
End Sub
è solo un semplice esempio niente di più!!
per creare delle funzioni!
sub semplice( t as text ) as string
dim result as string
if t = pirla then
resutl = "P...a"
else
result ="ok"
end if
return result
end sub
sub Button1_Click()
MsgBox la.semplece("P...a")
end sub
sub Button1_click()
MsgBox la.semplice(EditText.text)
end sub
calma ragazzi, calma.Scusa ma io non ho fatto il maleducato!!!!
Io ho chiesto solo se si può fare?
Scusa ma io non ho fatto il maleducato!!!!
Io ho chiesto solo se si può fare?
Guarda che non ti stava insultato. Ha fatto solo un esempio, sbagliato se vuoi, ma solo un esempio.Scusa ma io non ho fatto il maleducato!!!!
Io ho chiesto solo se si può fare?
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
Sub Process_Globals
End Sub
Sub AddText(edt As EditText, txt As String)
edt.Text = edt.Text & txt
End Sub