B4J Question B4J page can't fill textfields

DALB

Active Member
Licensed User
hello everyone...
from B4J
from a page which name is 'liste' which contains rows of data from a sqlite database, I send the following command:

page 'liste':
public Sub lblmodifier0_MouseReleased (EventData As MouseEvent)
    'modifier une saisie..retourner à saisie
    If lblid0.Text="" Then Return
    Dim x As Int=lblid0.Text
    B4XPages.ShowPage("saisie")
    B4XPages.ShowPageAndRemovePreviousPages("saisie")
    CallSubDelayed2(page_saisie,"modifierSaisie",x)
End Sub

where lblid0.text is an ID from a table

Now, in the page which name is 'saisie' which receives the 'callsubdelayed2' I have this little code:

page 'saisie':
public Sub modifierSaisie(id0 As Int)
    Sleep(5)
    initialiserLesChamps' initialization of the texfields
    preparerDatabase' preparing the sqlite database
    synt="SELECT * FROM depenses WHERE id=" & id0
    Dim res As ResultSet=sql.ExecQuery(synt)
    txtdate0.Text=res.GetString("date")'not filled
    txtdatev.Text=res.Getint("datev")'not filled
    txtlieu.Text=res.GetInt("idlieu")'not filled
    txtmagasin.Text=res.GetInt("idmagasin")'not filled
    txtsecteur.Text=res.GetInt("idsecteur")'not filled
    txtarticle.Text=res.getstring("article")'not filled
    txtmontant.Text=res.GetDouble("montant")'not filled
    txtmoyen.Text=res.GetInt("idmoyen")'not filled
    txtrem.Text=res.GetString("remarque")'not filled
    Log(res.GetString("date") & ":" & res.Getint("datev") & ":" & _
    res.GetInt("idlieu") & ":" & res.GetInt("idmagasin") & " voilà")'here the log is ok
End Sub

But I have a big problem: extracting the row from the table, I want to fill all the texfields but they remain empty even after having initalization.

Did I miss something ?
 

LucaMs

Expert
Licensed User
Longtime User
1737999913153.png

You don't need both.

Instead of this:
B4X:
CallSubDelayed2(page_saisie,"modifierSaisie",x)
you could call directly a public Sub of a B4XPage (of an instance of a B4XPage).
In the B4XMainPage:
B4X:
'Class_Globals
Public saisiePage As saisie
'
Sub B4XPage_Created
    saisiePage.Initialize
    B4XPages.AddPage("saisie", saisiePage)
End Sub

From everywhere:
B4X:
B4XPages.MainPage.saisiePage.modifierSaisie(id0)
 
Upvote 0

DALB

Active Member
Licensed User
Wooow, yes, I have forgotten to copy this line. Thanks much, but it doesn't work !
All the textfields remain empty !!!! 😭
 
Upvote 0

DALB

Active Member
Licensed User
Solved...Textfield converted to B4XView
 
Upvote 0
Top