iOS Question [SOLVED] B4XListTemplate reduce height of popup window

mike2ppc

Member
Licensed User
Longtime User
Hello,
I need some help with the B4XListTemplate. I have 3 entries in the list
and I want to reduce the empty space between the list entries (customlistview) and the cancel button.
Is this possible and if yes how ?

Bildschirmfoto 2020-11-08 um 23.04.36.png
 

stevel05

Expert
Licensed User
Longtime User
Like this
B4X:
    Dim DT As B4XListTemplate
    DT.Initialize
    DT.Options.AddAll(Array As String("Item 1","Item 2","Item 3"))
    DT.Resize(DT.mBase.Width,DT.mBase.Height - 100)
    Dialog.Title = "Choose"
    Wait For(Dialog.ShowTemplate(DT,"","","Cancel")) Complete (Resp As Int)
    Log(DT.SelectedItem)
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
Like this
B4X:
    Dim DT As B4XListTemplate
    DT.Initialize
    DT.Options.AddAll(Array As String("Item 1","Item 2","Item 3"))
    DT.Resize(DT.mBase.Width,DT.mBase.Height - 100)
    Dialog.Title = "Choose"
    Wait For(Dialog.ShowTemplate(DT,"","","Cancel")) Complete (Resp As Int)
    Log(DT.SelectedItem)

Hi stevel05,
Thanks for your answer, unfortunately this line of code doesn't solved my problem.
B4X:
DT.Resize(DT.mBase.Width,DT.mBase.Height - 100)
It reduces the height of the element "CustomListView" but does not reduce the empty area between
Customlistview and the "Cancel" button. What a pity, at this point I already tried around.
I also tried to reduce the height of the dialog, but then the "Cancel" button disappears.
Or, I'm doing something wrong...

B4X:
'Code module
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private xui As XUI
    Private b4xList As B4XListTemplate
    Private b4xDLG As B4XDialog
    Private b4xVW As B4XView
    Private Button1 As Button
    Private Items As List
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    b4xVW = Page1.RootPanel
    b4xDLG.Initialize (b4xVW)
    b4xDLG.Title = "XUI Views"
End Sub

Sub Button1_Click
    b4xList.Initialize
    b4xList.Options = Array("Item 1", "Item 2","Item 3")
    b4xDLG.Title= "Choose... "
    Dim varDlg As Object = b4xDLG.ShowTemplate(b4xList, "", "", "cancel")
'    b4xDLG.Base.Top = 200
    b4xList.Resize(b4xList.mbase.width,b4xList.mbase.Height-200)
'    b4xDLG.base.Height = 250
    
    Wait For (varDlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    End If
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
    
End Sub
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
Hi stevel05,
Thanks for your answer, unfortunately this line of code doesn't solved my problem.
B4X:
DT.Resize(DT.mBase.Width,DT.mBase.Height - 100)
It reduces the height of the element "CustomListView" but does not reduce the empty area between
Customlistview and the "Cancel" button. What a pity, at this point I already tried around.
I also tried to reduce the height of the dialog, but then the "Cancel" button disappears.
Or, I'm doing something wrong...

B4X:
'Code module
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private xui As XUI
    Private b4xList As B4XListTemplate
    Private b4xDLG As B4XDialog
    Private b4xVW As B4XView
    Private Button1 As Button
    Private Items As List
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    b4xVW = Page1.RootPanel
    b4xDLG.Initialize (b4xVW)
    b4xDLG.Title = "XUI Views"
End Sub

Sub Button1_Click
    b4xList.Initialize
    b4xList.Options = Array("Item 1", "Item 2","Item 3")
    b4xDLG.Title= "Choose... "
    Dim varDlg As Object = b4xDLG.ShowTemplate(b4xList, "", "", "cancel")
'    b4xDLG.Base.Top = 200
    b4xList.Resize(b4xList.mbase.width,b4xList.mbase.Height-200)
'    b4xDLG.base.Height = 250
  
    Wait For (varDlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    End If
End Sub

Private Sub Page1_Resize(Width As Int, Height As Int)
  
End Sub

OKEY, now it work with your recommendation, after I've adjusted my code a little bit like this.

B4X:
Sub Button1_Click
    b4xList.Initialize
    b4xList.Options = Array("Item 1", "Item 2","Item 3")
    b4xDLG.Title= "Choose... "
    b4xList.Resize(b4xList.mbase.width,b4xList.mbase.Height-100)
    Dim varDlg As Object = b4xDLG.ShowTemplate(b4xList, "", "", "cancel")
'    b4xDLG.Base.Top = 200
'    b4xDLG.base.Height = 250
   
    Wait For (varDlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    End If
End Sub
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
sorry, but I can't test it on b4i, it definitely works on B4j. Did you try putting the resize before dialog.show?
 
Upvote 0

mike2ppc

Member
Licensed User
Longtime User
sorry, but I can't test it on b4i, it definitely works on B4j. Did you try putting the resize before dialog.show?

OKEY, now it work with your recommendation, after I've adjusted my code a little bit like this.

B4X:
Sub Button1_Click
    b4xList.Initialize
    b4xList.Options = Array("Item 1", "Item 2","Item 3")
    b4xDLG.Title= "Choose... "
    b4xList.Resize(b4xList.mbase.width,b4xList.mbase.Height-100)
    Dim varDlg As Object = b4xDLG.ShowTemplate(b4xList, "", "", "cancel")
'    b4xDLG.Base.Top = 200
'    b4xDLG.base.Height = 250
  
    Wait For (varDlg) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
    End If
End Sub
 
Upvote 0
Top