iOS Question [Solved] iSideMenu with B4XPages?

John Naylor

Active Member
Licensed User
Longtime User
I can run the iSideMenu demo project which is a regular B4i app just fine but when I try to implement it in B4XPages I'm struggling.

Errors any time I try to initialize.

Both fail....
B4X:
    smc.Initialize(lp, Root , rp)

' or

    smc.Initialize(lp, Main.NavControl , rp)


I'm looking for a left & right drawer solution that works with B4XPages.

Thanks!
 

John Naylor

Active Member
Licensed User
Longtime User
What happens with the code in line #5? Post the error message.
Error occurred on line: 126 (B4XMainPage)
adding a root view controller <B4INavigationController: 0x102012800> as a child of view controller:<MMDrawerController: 0x102013200>
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
UIKitCore <redacted> + 196
UIKitCore <redacted> + 500
UIKitCore <redacted> + 84
STORYBLOCS -[MMDrawerController setCenterViewController:animated:] + 980
STORYBLOCS -[MMDrawerController initWithCenterViewController:leftDrawerViewController:rightDrawerViewController:] + 128
STORYBLOCS -[B4ISideMenuController Initialize:::] + 264
STORYBLOCS -[b4i_b4xmainpage _b4xpage_created::] + 1904
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
STORYBLOCS +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1300
STORYBLOCS -[B4ICommon CallSubDebug4::::] + 860
STORYBLOCS -[B4ICommon CallSubDebug2::::] + 284
STORYBLOCS -[b4i_b4xpagesmanager _createpageifneeded::] + 1028
STORYBLOCS -[b4i_b4xpagesmanager _showpage::] + 724
STORYBLOCS -[b4i_b4xpagesmanager _addpage:::] + 1292
STORYBLOCS -[b4i_b4xpagesmanager _addpageandcreate:::] + 560
STORYBLOCS -[b4i_b4xpagesmanager _initialize:::] + 1672
STORYBLOCS -[b4i_main _application_start:] + 1508
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
STORYBLOCS +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1300
STORYBLOCS -[B4IShell runMethod:] + 448
STORYBLOCS -[B4IShell raiseEventImpl:method:args::] + 2172
STORYBLOCS -[B4IShellBI raiseEvent:event:params:] + 1580
STORYBLOCS __33-[B4I raiseUIEvent:event:params:]_block_invoke + 52
libdispatch.dylib <redacted> + 24
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1068
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 1924
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 104
UIKitCore UIApplicationMain + 212
STORYBLOCS main + 120
libdyld.dylib <redacted> + 4
)
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
Try to add the side menu in Application_Start, as done here: https://www.b4x.com/android/forum/threads/isidemenu.46914/post-290466
Slightly different but I'm still seeing an error...

Error occurred on line: 94 (Main)
adding a root view controller <B4INavigationController: 0x102812800> as a child of view controller:<MMDrawerController: 0x10201d600>
Stack Trace: (
CoreFoundation <redacted> + 252
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
UIKitCore <redacted> + 196
UIKitCore <redacted> + 500
UIKitCore <redacted> + 84
STORYBLOCS -[MMDrawerController setCenterViewController:animated:] + 980
STORYBLOCS -[MMDrawerController initWithCenterViewController:leftDrawerViewController:rightDrawerViewController:] + 128
STORYBLOCS -[B4ISideMenuController Initialize:::] + 264
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
STORYBLOCS +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1300
STORYBLOCS -[B4IShell runVoidMethod] + 232
STORYBLOCS -[B4IShell raiseEventImpl:method:args::] + 1800
STORYBLOCS -[B4IShellBI raiseEvent:event:params:] + 1580
STORYBLOCS __33-[B4I raiseUIEvent:event:params:]_block_invoke + 52
libdispatch.dylib <redacted> + 24
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1068
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 1924
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 104
UIKitCore UIApplicationMain + 212
STORYBLOCS main + 120
libdyld.dylib <redacted> + 4
)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code is wrong. Carefully go over this code: https://www.b4x.com/android/forum/threads/isidemenu.46914/#post-290466

B4X:
Private Sub Application_Start (Nav As NavigationController)
    Dim nc As NavigationController
    nc.Initialize("nc")
    NavControl = nc
    
    Dim lp As Page
    lp.Initialize("lp")
    lp.RootPanel.Color = Colors.Red
    lp.RootPanel.LoadLayout("test")
    Dim rp As Page
    rp.Initialize("rp")
    rp.RootPanel.Color = Colors.Green
    rp.RootPanel.LoadLayout("test")
    smc.Initialize(lp, NavControl , rp)
    App.KeyController = smc
        
    smc.LeftMenuMaxWidth = 80%x
    smc.RightMenuMaxWidth = 80%x
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(NavControl)
End Sub
 
Upvote 0

John Naylor

Active Member
Licensed User
Longtime User
Your code is wrong. Carefully go over this code: https://www.b4x.com/android/forum/threads/isidemenu.46914/#post-290466

B4X:
Private Sub Application_Start (Nav As NavigationController)
    Dim nc As NavigationController
    nc.Initialize("nc")
    NavControl = nc
   
    Dim lp As Page
    lp.Initialize("lp")
    lp.RootPanel.Color = Colors.Red
    lp.RootPanel.LoadLayout("test")
    Dim rp As Page
    rp.Initialize("rp")
    rp.RootPanel.Color = Colors.Green
    rp.RootPanel.LoadLayout("test")
    smc.Initialize(lp, NavControl , rp)
    App.KeyController = smc
       
    smc.LeftMenuMaxWidth = 80%x
    smc.RightMenuMaxWidth = 80%x
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(NavControl)
End Sub
Thank's as always @Erel! - I see where I was going wrong now!
 
Upvote 0
Top