Android Question is there option for B4XPreferencesDialog to auto fill fields?

ht_admin

Member
Hi,

I tried to look in the forum for this query, but couldnt find this. So here is my query,
I have to make B4XPreferencesDialog form for B4Xtable, in this case, I have 4 fields, field 1 is the dropbox/select option, and the other three fields are user text input. So in field 1, I have 3 options 1. custom, 2. option A, 3. OptionB. So when the user selects custom, then he will manually enter the remaining 3 fields, but if he selects optionA, then i have to autofill 2 fields, 3rd is NULL(its not required). if he selects optionB then I have to auto-fill the remaining three fields with predefined data.

One more question, i have B4A installed how do i use form builder as I can see it is source files for b4j
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

ht_admin

Member

Show-doesn't work it gives error"Cannot access private member: show", i used showdialog as it was in the example already.

This doesn't help me anyway what I want is for example TablenForm, if the user selects "Canidae", the Name field should have automatically updated to "ABC", Sex " Male" without the user have to enter it. if the user changes the Type: "Felidae", Name field: GOJ, SEX: "Female" this gets auto-filled in the input box.

I believe I will need a callback routine to check the Type selection and fill the Name and Sex input in the program.

Table and form example:
Private Sub ShowDialog(Item As Map, RowId As Long)
    Dim data As Map = CreateMap("Type": "Canidae", "Name": "ABC")
    Wait For (PrefDialog.ShowDialog(data,"OK", "CANCEL")) Complete (Result As Int)
    'Wait For (PrefDialog.ShowDialog(Item, "OK", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dim params As List
        params.Initialize
        params.AddAll(Array(Item.Get("Type"), Item.Get("Name"), Item.Get("Birth Date"), Item.Get("Sex"))) 'keys based on the template json file
        If RowId = 0 Then 'new row
            B4XTable1.sql1.ExecNonQuery2($"INSERT INTO data VALUES("", ?, ?, ?, ?)"$, params)
            B4XTable1.ClearDataView
        Else
            params.Add(RowId)
            'first column is c0. We skip it as this is the "edit" column
            B4XTable1.sql1.ExecNonQuery2("UPDATE data SET c1 = ?, c2 = ?, c3 = ?, c4 = ? WHERE rowid = ?", params)
            B4XTable1.Refresh
        End If
    End If
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…