Bug? dialogs lib in landscape mode no buttons

kohle

Active Member
Licensed User
Longtime User
in landscape dont show buttons, portrait mode is ok



B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

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 Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private DetailsDialog As CustomLayoutDialog
    Private DialogAge As Spinner
    Private DialogLastName As FloatLabeledEditText
    Private DialogFirstName As FloatLabeledEditText
    
    

End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    
    
    
End Sub

Sub btnEnterDetails_Click
    Dim sf As Object = DetailsDialog.ShowAsync("Enter details", "Ok", "Cancel", "", LoadBitmap(File.DirAssets, "form.png"), True)
    DetailsDialog.SetSize(100%x, 400dip)
    Wait For (sf) Dialog_Ready(pnl As Panel)
    pnl.LoadLayout("DetailsDialog")
    '0x00002000 = TYPE_TEXT_FLAG_CAP_WORDS (capitalize first character of each word)
    DialogFirstName.EditText.InputType = Bit.Or(0x00002000, DialogFirstName.EditText.InputType)
    DialogLastName.EditText.InputType = Bit.Or(0x00002000, DialogLastName.EditText.InputType)
    DialogAge.Add("")
    For i = 1 To 120
        DialogAge.Add(i)
    Next
    DetailsDialog.GetButton(DialogResponse.POSITIVE).Enabled = False
    Wait For (sf) Dialog_Result(res As Int)
    'force the keyboard to hide
    DialogFirstName.EditText.Enabled = False
    DialogLastName.EditText.Enabled = False
    If res = DialogResponse.POSITIVE Then
        ToastMessageShow($"${DialogFirstName.Text} ${DialogLastName.Text} is ${DialogAge.SelectedItem} years old"$, True)
    End If
End Sub

Sub DialogAge_ItemClick (Position As Int, Value As Object)
    CheckAllFieldsValid
End Sub

Sub DialogLastName_TextChanged (Old As String, New As String)
    CheckAllFieldsValid
End Sub

Sub DialogFirstName_TextChanged (Old As String, New As String)
    CheckAllFieldsValid
End Sub

Sub CheckAllFieldsValid
    Dim valid As Boolean = DialogAge.SelectedIndex > 0 And DialogFirstName.Text.Length > 0 And DialogLastName.Text.Length > 0
    DetailsDialog.GetButton(DialogResponse.POSITIVE).Enabled = valid
End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

kohle

Active Member
Licensed User
Longtime User
I see, there is is no auto scale .
I changed to DetailsDialog.SetSize(100%x, 80%y)
and it shows only the first field (firstname) in the dialog, but it shows the buttons.

Thats a problem for building an app for various screen sizes.
 

kohle

Active Member
Licensed User
Longtime User
ok, its your demo of the dialogs, the auto scale of the layout is set and for the fields too. When you turn from portrait to landscape the fields are missing.
I will write my own dialog for the app . Thanks
 
Top