OverlayWindowMBS: drawing a delete-'poff' in 64bit crashes

I build for macOS on macOS Sierra 10.12.5 and experience a crash when running a 64bit build.

I used to display a little ‘poff’ cloud animation after deletion of a record, by using this MBS code, which used to work on 32bit, but crashes when running a 64bit version. I’m getting a ‘UnsupportedOperationException’. See log below.

Has anyone an idea how to adapt this code in order to make it run on 64bit (I copied it from a MBS example).

[code]#If TargetCocoa
Dim f As FolderItem
Dim png As PNGpictureMBS
Dim o As OverlayWindowMBS
Dim p,m As Picture
Dim c As CGContextMBS
Dim cp As CGImageMBS
Dim r As CGRectMBS
Dim t,i As Integer

// 128 is full size

Const targetwidth=128
Const targetheight=128

f = App.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“poof.png”)

If f <> Nil And f.Exists Then
png=f.OpenAsPNGMBS(0)

o=New OverlayWindowMBS

If o.Create(x,y,targetwidth,targetheight)=0 Then
  
  o.Show
  
  For i=0 To 4
    c=o.Context
    
    p=New Picture(targetwidth,targetheight,32)
    p.Graphics.DrawPicture png.pict,0,(-128)*i
    
    m=New Picture(targetwidth,targetheight,32)
    m.Graphics.DrawPicture png.mask,0,(-128)*i
    
    cp=CGCreateImageMBS(p,m)
    
    r=CGMakeRectMBS(0,0,targetwidth,targetheight)
    
    c.ClearRect r
    c.DrawPicture cp,r
    
    c.Flush
    
    t=Ticks
    While Abs(t-Ticks)<5
    Wend
  Next
End If

End If
#EndIf[/code]

Crash Log:

[quote]OS = Mac x86
RB Version = 2017r2
Exception Type = UnsupportedOperationException

Stack Trace:
_Z14RaiseExceptionPKcS0_jx
_ZL7wCreateP16REALobjectStructxxxx
OverlayWindowMBS.Create%i8%oi8i8i8i8
im.poff%%i8i8
WindowLinkClass.WindowLinkClass.imLinkPushbuttonDelete_Action%%o<WindowLinkClass.WindowLinkClass>o
Delegate.IM_Invoke%%o
AddHandler.Stub.15%%
_os_activity_initiate_impl
-[NSApplication(NSResponder) sendAction:to:from:]
-[NSControl sendAction:to:]
__26-[NSCell _sendActionFrom:]_block_invoke
_os_activity_initiate_impl
-[NSCell _sendActionFrom:]
-[NSButtonCell _sendActionFrom:]
_os_activity_initiate_impl
-[NSCell trackMouse:inRect:ofView:untilMouseUp:]
-[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
-[NSControl mouseDown:]
XojoFramework$1441
-[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]
-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]
-[NSWindow(NSEventRouting) sendEvent:]
XojoFramework$1789
-[NSApplication(NSEvent) sendEvent:]
XojoFramework$1341
Delegate.Invoke%%
Application._CallFunctionWithExceptionHandling%%op
_Z33CallFunctionWithExceptionHandlingPFvvE
XojoFramework$1341
-[NSApplication run]
RuntimeRun
REALbasic._RuntimeRun
_Main
main
start[/quote]

Just found the original example from MBS (/Examples/MacOSX/Overlay Window/Dock like Poff.xojo_binary_project)

It crashes as well, when built for 64bit.

Any replacement?

it is not crashing. Did you read the message on the exception?

Only supported on Mac OS X with 32 bit. Please use OverlayMBS windows for all new projects.