iOS Question Dialogs with B4i and B4A

pliroforikos

Active Member
Licensed User
Hello,
I'm trying to convert Β4Α dialog to B4i. But i have some trouble to make them identical.
Below on the left you can see iPhone dialog and right the Android one.



There are 3 float Text Fields in my code and the code is the same

B4A and B4i sub:
Private Sub showDialog
    dlgInsSchool.Initialize(Root)
    dlgInsSchool.Title = textDlgTitle

    dlgInsSchool.TitleBarColor = xui.Color_RGB(83,88,143)
    dlgInsSchool.TitleBarHeight = 50dip
    dlgInsSchool.BorderColor = xui.Color_RGB(83,88,143)
    dlgInsSchool.BorderCornersRadius = 10

    Dim p As B4XView = xui.CreatePanel("")
'    p = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 350dip, 260dip)
    p.LoadLayout("dlgSchool")
    dlgInsSchool.PutAtTop = True 'put the dialog at the top of the screen
   
    fltSchName.HintText = "School"
    fltSchName.HintColor = xui.Color_RGB(83,88,143)
    fltSchName.Update
   
    fltSchAddress.HintText = "Address"
    fltSchAddress.HintColor = xui.Color_RGB(83,88,143)
    fltSchAddress.Update
   
    fltPostOffice.HintText = "POB"
    fltPostOffice.HintColor = xui.Color_RGB(83,88,143)
    fltPostOffice.Update

    Dim rs As ResumableSub = dlgInsSchool.ShowCustom(p, textBtnOK, textBtnNo, textBtnCancel)
    fltSchName.RequestFocusAndShowKeyboard
'    Dim b As B4XView = dlgInsSchool.GetButton(xui.DialogResponse_Positive)
'    b.Height = 30dip
'    ValidateFields(fltSchName.Text, fltSchAddress.Text, fltSchKey.Text)
    Wait For (rs) Complete (result As Int)

    If result = xui.DialogResponse_Positive Then
        mSchool.Initialize
        mSchool.Put("schname", fltSchName.Text)
        mSchool.Put("url", fltSchAddress.Text)
        mSchool.Put("hash", fltPostOffice.Text)
    End If

End Sub


The worst thing is when i click ok button B4i program crash with this message.


So:
1. How can i make to dialogs identical?
2. How to resolve this message?

Thank you very much for your support
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
1. How can i make to dialogs identical?
If you want an identical TextField, then I recommend you my AS_TextFieldAdvanced, that looks the same on all 3 platforms, without you having to adjust anything.
 
Upvote 0

pliroforikos

Active Member
Licensed User

Thank you. I did this:

B4X:
Sub Class_Globals
    Private dlg2 As B4XDialog
    Private txt1 As AS_TextFieldAdvanced
    Private txt2 As AS_TextFieldAdvanced
    Private txt3 As AS_TextFieldAdvanced
' And more variables ...

end sub

'Other code...


Private Sub showDialog2
    dlg2.Initialize(Root)
    dlg2.Title = textDlgTitle

    dlg2.TitleBarColor = xui.Color_RGB(83,88,143)
    dlg2.TitleBarHeight = 50dip
    dlg2.BorderColor = xui.Color_RGB(83,88,143)
    dlg2.BorderCornersRadius = 10

    Dim p As B4XView = xui.CreatePanel("")
'    p = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 350dip, 260dip)
    p.LoadLayout("dlg2")
    dlg2.PutAtTop = True 'put the dialog at the top of the screen
    txt1.Hint.Text = "School"
    txt2.Hint.Text = "Address"
    txt3.Hint.Text = "POB"
    txt1.Refresh
    txt2.Refresh
    txt3.Refresh

    Dim rs As ResumableSub = dlg2.ShowCustom(p, textBtnOK, textBtnNo, textBtnCancel)

    Wait For (rs) Complete (result As Int)

    If result = xui.DialogResponse_Positive Then
        mSchool.Initialize
        mSchool.Put("schname", txt1.Text)
        mSchool.Put("url", txt2.Text)
        mSchool.Put("hash", txt3.Text)
    End If

End Sub

and of course i made the dlg2.bal with designer. But i'm getting the following error when i click on a button to show form:

 
Upvote 0

pliroforikos

Active Member
Licensed User
Check B4XPreferencesDialog.

Thank you Erel. Until now i had B4XPreferencesDialog but i wanted a new "look" for my forms and i couldn't change colors for example Title Bar color or make dialog have rounded corners. Maybe i am wrong
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…