I just started working with ios and got to CustomListView and realized that this element behaves quite differently from Android. Here I have collected all the differences I found from Android.
Using this program as an example, I would like to know:
1) If you do not put "Sleep (100)" before displaying the CLV list, then CLV simply will not be displayed. Why?
2) When I create a CLV element, I would like to change the width of "lblTitle" in the zero element, but I cannot do this in "CreateOkNotOk". I can do this only after displaying the entire list and only if I put "Sleep (100)" before it again. Why?
3) If I try to change the height of the CLV element, for example to hide the "TextView". If I look in debug, then after the line "clv.ResizeItem (index, Page1.RootPanel.Height * 0.09)" the height changes as I want
but after the sub ends, I get this result
Why?
4) When the keyboard appears in the last element, it closes the element itself. How can this be fixed? On Android I used the IME library for this
the code
P.S. I also attach the program code
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 clv As CustomListView
Private lblTitle As Label
Private tv As TextView
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("Page1")
NavControl.ShowPage(Page1)
Sleep(100)'if not add CLV is not displayed
For i=0 To 15
clv.Add(CreateOkNotOk("Item "&i),"")
Next
Sleep(100)'if you don't add CLV, the width of the first element will not be excused
Dim pnl As B4XView = clv.GetPanel(0)
Dim lbl As B4XView = pnl.GetView(0)
lbl.Width=Page1.RootPanel.Width*0.30 'and here it works
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Sub CreateOkNotOk(Text As String) As Panel
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, clv.AsView.Width, Page1.RootPanel.Height*0.25)
p.LoadLayout("Page2")
lblTitle.Text=Text
tv.Color=Colors.White
If Text="Item 0" Then
lblTitle.Width=Page1.RootPanel.Width*0.30 'doesn't work here
End If
Return p
End Sub
Sub lblOk_Click
Dim index As Int = clv.GetItemFromView(Sender)
clv.ResizeItem(index,Page1.RootPanel.Height*0.09) 'as soon as the sub ends the CLV element is redrawn
End Sub
Sub lblNot_Click
Dim index As Int = clv.GetItemFromView(Sender)
clv.ResizeItem(index,Page1.RootPanel.Height*0.25)
End Sub
Private Sub clv_ScrollChanged (Offset As Int)
Page1.ResignFocus
End Sub
1) If you do not put "Sleep (100)" before displaying the CLV list, then CLV simply will not be displayed. Why?
2) When I create a CLV element, I would like to change the width of "lblTitle" in the zero element, but I cannot do this in "CreateOkNotOk". I can do this only after displaying the entire list and only if I put "Sleep (100)" before it again. Why?
B4X:
Sleep(100)
Dim pnl As B4XView = clv.GetPanel(0)
Dim lbl As B4XView = pnl.GetView(0)
lbl.Width=Page1.RootPanel.Width*0.30
but after the sub ends, I get this result
Why?
4) When the keyboard appears in the last element, it closes the element itself. How can this be fixed? On Android I used the IME library for this
the code
B4X:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
clv.Base_Resize(100%x,NewHeight-Activity.Height*0.18)
End Sub