iOS Question [SOLVED] HexMenu & WobbleMenu Not Playing Well Together

Mashiane

Expert
Licensed User
Longtime User
Hi there

On a layout I have a HexMenu + WoobleMenu, the HandleResizeEvent is on. This ensures that everything else resizes itself and shows up. Good.

Individually these components work well, however as soon as I add a wobble menu to a page, the hexmenu crashes.

B4X:
Private Sub Base_Resize (Width As Double, Height As Double)
    Dim mn As Double = Min(Width, Height)
    iv.SetLayoutAnimated(0, Width / 2 - mn / 2, Height / 2 - mn / 2, mn, mn)
    pnl.SetLayoutAnimated(0, iv.Left, iv.Top, iv.Width, iv.Height)
    bc.Initialize(iv.Width, iv.Height)
    bc.FillGradient(Array As Int(0xFFFF000E, 0xFFFFF0A1), bc.TargetRect, "TL_BR")
    GradientBrush = bc.CreateBrushFromBitmap(bc.Bitmap)
    Update
End Sub

On this line:
GradientBrush = bc.CreateBrushFromBitmap(bc.Bitmap)

This is the error

B4X:
Error occurred on line: 101 (HexMenu)
Object was not initialized (NSObject)
Stack Trace: (
  CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 597168
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 937220
  Xpanda               -[B4IObjectWrapper object] + 116
  Xpanda               -[b4i_bitmapcreator _getbitmap] + 820
  Xpanda               -[b4i_hexmenu _base_resize:::] + 1500
  CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 133328
  CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 247208
  Xpanda               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1300
  Xpanda               -[B4IShell runMethod:] + 448
 Xpanda               -[B4IShell raiseEventImpl:method:args::] + 1648
 Xpanda               -[B4IShellBI raiseEvent:event:params:] + 1580
 Xpanda               +[B4IObjectWrapper raiseEvent:::] + 268
 Xpanda               __30-[B4IPanelView layoutSubviews]_block_invoke + 716
 libdispatch.dylib    56AA6E93-8D8E-32FE-AC73-D3E79B1BA2F5 + 405908
 libdispatch.dylib    56AA6E93-8D8E-32FE-AC73-D3E79B1BA2F5 + 410008
 libdispatch.dylib    56AA6E93-8D8E-32FE-AC73-D3E79B1BA2F5 + 67024
 CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 317416
 CoreFoundation       EA9C1DF2-94C7-379B-BF8D-970335B1552F + 45288
 CoreFoundation       CFRunLoopRunSpecific + 572
 GraphicsServices     GSEventRunModal + 160
 UIKitCore            FB5C2D36-6A05-3355-B898-D8D3C163D02E + 5161052
 UIKitCore            UIApplicationMain + 2028
 Xpanda               main + 120
 dyld                 start + 444
)


When HandleResizeEvent if off, no crash happens, however the WobbleMenu does not show at the bottom and the hex is placed further down the page.

Please help.

Thanks.[/code]
 
Solution
I have a fix.
@Erel you need to limit the width and height, if the width or height = 0 then this error happend
Fix:
B4X:
bc.Initialize(Max(1dip,iv.Width),Max(1dip, iv.Height))
Line 93 in the HexMenu.

Mashiane

Expert
Licensed User
Longtime User
can you reproduce it in an example project?

Thanks, please find attached small project. Here is also a video recording as POE.


PS: Please note that this happens in a similar fashion when the layout is also loaded in the B4XMainPage.
 

Attachments

  • XpandaIOS.zip
    173 KB · Views: 109
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
A little heart broken because just this alone is not enabling me to have the same cross platform experience I was hoping and wishing for for both Android and iOS. The android app is awesome and the iOS app I have to use another component for the bottom menu as I currently don't have an idea of how to solve this.

Phew!
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
I have a fix.
@Erel you need to limit the width and height, if the width or height = 0 then this error happend
Fix:
B4X:
bc.Initialize(Max(1dip,iv.Width),Max(1dip, iv.Height))
Line 93 in the HexMenu.
Wow, let me update and check what happens. This is gonna be lit when it work. Thanks Alexander.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
For anyone who might experience the same issues on IOS, please find the updated HexMenu.

1. In the property bag I have added a Multi-Line property - use this if you want to use CRLF on the text that you will insert in the items
2. In the property bag I have added UseCSBuilder property - use this if you want to use CSBuilder on the items creations.
3. Updated the code as above to make the Hex & Wobble Menu to play well together.

1 & 2 - Help credit to Erel
3 - Help credit to Alexander

PS: This hex menu was just updated to meet my IOS needs. Things are different with IOS.

Many thanks to Erel and Alexander.
 

Attachments

  • HexMenu.bas
    5.5 KB · Views: 108
Upvote 0
Top