iOS Question Adjust position of PreferencesDialogs incl. sub dialogs permanently e.c. Top = 300 ?

mike2ppc

Member
Licensed User
Hello, could someone help me out in this question, is it possible to adjust the position of "b4xviews/PreferencesDialog"
permanently for example the parameter "top = 300" and including sub dialogs / b4xtemplates too ?

In my example I've created a preferences dialog with different types of fields in use.
The main dialog (first shown) with parameter top = 300 works well, but after click on
field date and show the AddDateItem view the top parameter will set back to original, and after
return to the main dialog top parameter too. See my screenshot story and example code.

Bildschirmfoto 2020-11-09 um 21.28.23.png

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private xui As XUI
    Private xview As B4XView
    Private prefdlg As PreferencesDialog
    Private prefdlgdata As Map
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    prefdlg_Create
End Sub

private Sub prefdlg_Create
    Dim varList As List
    varList.Initialize
    varList.Add("Item 1")
    varList.Add("Item 2")
    varList.Add("Item 3")
    varList.add("Item 4")  
    prefdlgdata.Initialize
    prefdlg.Initialize(Page1.RootPanel,"New entry",300dip,250dip)
    prefdlg.AddOptionsItem("event","Event",varList)
    prefdlg.GetPrefItem("event").Required=True
    prefdlg.AddDateItem("date","Date")
    prefdlg.AddTimeItem("time","Time")
    prefdlg.AddTextItem("note","Note")
End Sub

Sub Button1_Click
    Dim varPdlg As Object = prefdlg.ShowDialog(prefdlgdata, "insert", "cancel")
    prefdlg.Dialog.Base.Top = 300
    Wait For (varPdlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
The reason that the pref dialog appears at the top is to provide room for the keyboard. Test it on a real device and click on the Name field and you will see that it is better to push it to the top.

You can extract PreferencesDialog code (b4xlib = zip file) and modify the Show method to set the dialog position as you need.
 

mike2ppc

Member
Licensed User
The reason that the pref dialog appears at the top is to provide room for the keyboard. Test it on a real device and click on the Name field and you will see that it is better to push it to the top.

You can extract PreferencesDialog code (b4xlib = zip file) and modify the Show method to set the dialog position as you need.
Hi Erel, thank you for your quick response. I had tried it on an "iPhone pro" device and the user experience that with Top +100 it is a good mix of fade in keyboard and good one-handed operation. The standard position is a bit too high for one-handed operation. I will follow your suggestion and adjust it in the library.
Best regards
Michael
 
Top