Bug? dialogs lib in landscape mode no buttons

Discussion in 'Bugs & wishlist' started by kohle, Dec 4, 2018.

  1. kohle

    kohle Active Member Licensed User

    in landscape dont show buttons, portrait mode is ok



    Code:
    #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%x400dip)
        
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Maybe the dialog is too tall? The height is set to 400dip.
     
  3. kohle

    kohle Active Member Licensed 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.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    There is nothing special here. You need to use anchors and designer script and set the height correctly. Start a new thread in the questions forum for further discussion.
     
  5. kohle

    kohle Active Member Licensed 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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice