iOS Question B4XSeekBar in CustomListView ios

red30

Well-Known Member
Licensed User
Longtime User
B4XSeekBar is very difficult to use in CustomListView as you only need to move your finger in a straight line, otherwise the list will move.
I already asked this question, but for Android and Erel I made an excellent solution. Is it possible to do the same in ios?
 

red30

Well-Known Member
Licensed User
Longtime User
I get an error:
B4X:
Object was not initialized (UIView)
Stack Trace: (
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 1157612
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 120016
  result               -[B4IObjectWrapper object] + 136
  result               -[b4i_mod6 _removeclickrecognizer:] + 632
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 1175856
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 8656
  result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
  result               -[B4IShell runMethod:] + 448
  result               -[B4IShell raiseEventImpl:method:args::] + 1648
result               -[B4IShellBI raiseEvent:event:params:] + 1580
result               +[B4IObjectWrapper raiseEvent:::] + 300
result               __30-[B4IPanelView layoutSubviews]_block_invoke + 900
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 393880
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 397952
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 65628
CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 632288
CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 608904
CoreFoundation       CFRunLoopRunSpecific + 572
GraphicsServices     GSEventRunModal + 160
UIKitCore            CC6E5AC7-8248-35F6-8B42-2E25C93DCF0A + 11723508
UIKitCore            UIApplicationMain + 164
result               main + 128
libdyld.dylib        0B475C78-3C12-3121-B7F8-2B95B83DAF44 + 5480
)
My code:
B4X:
clv.Add(CreateForm4("Name"),"")

Sub CreateForm4(Text As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, clv.AsView.Width, HeightPage*0.35)
    p.LoadLayout("SeekBar")
    lblTitle4.Text=Text
    SB4.Tag=SB4
    SB4.Value=50
    RemoveClickRecognizer(p)
    Return p
End Sub
Perhaps this is due to the fact that I use Layout with several elements including B4XSeekBar
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
You are doing something wrong. Best if you create a small project with the list and the relevant code.
Here's a little code to demonstrate this:
B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: B4i Example
    #Version: 1.0.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait, LandscapeLeft, LandscapeRight
    #iPadOrientations: Portrait, LandscapeLeft, LandscapeRight, PortraitUpsideDown
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 8
#End Region

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 lblforSB4 As Label
    Private SB4 As B4XSeekBar
    Private clv As CustomListView
    Private lblTitle4 As Label
End Sub

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

Private Sub Page1_Resize(Width As Int, Height As Int)
    For i=1 To 10
        clv.Add(CreateForm4("Card "&i),"")
    Next

End Sub

Sub CreateForm4(Text As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, clv.AsView.Width, Page1.RootPanel.Height*0.35)
    p.LoadLayout("Page2")
    lblTitle4.Text=Text
    SB4.Tag=SB4
    SB4.Value=50
    RemoveClickRecognizer(p)
    Return p
End Sub

Private Sub RemoveClickRecognizer (pnl As B4XView)
    Dim no As NativeObject = pnl.Parent
    Dim recs As List = no.GetField("gestureRecognizers")
    For Each rec As Object In recs
        no.RunMethod("removeGestureRecognizer:", Array(rec))
    Next
End Sub
I get the error I wrote about above
 

Attachments

  • testSB.zip
    170.5 KB · Views: 242
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
You should call it after the panel is added to the CLV (see line 52 in the code you posted):
B4X:
Dim p As B4XView = CreateForm4("Card "&i)
clv.Add(p,"")
RemoveClickRecognizer(p)

However it doesn't improve the behavior.

Maybe show a dialog with the seekbar when the user clicks on the item.
Is it possible to do on the capture and move B4XSeekBar so that the CLV move is blocked? Although this probably will not help with the fact that the finger can jump a little up or down ...

I used the B4XSeekBar to keep it consistent with Android and is a very handy element in general.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is it possible to do on the capture and move B4XSeekBar so that the CLV move is blocked? Although this probably will not help with the fact that the finger can jump a little up or down ...
Not without a more complex touch handling. You can see an example in CLVSwipe, but it is a bit complicated.

I used the B4XSeekBar to keep it consistent with Android and is a very handy element in general.
I meant that you can show the B4XSeekbar with B4XDialog.
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
Not without a more complex touch handling. You can see an example in CLVSwipe, but it is a bit complicated.
I meant that you can show the B4XSeekbar with B4XDialog.
Thanks for the info. I'll probably try to replace the B4XSeekbar element with something else ...
 
Upvote 0
Top