[futurebasic] Re: [FB] LaunchingCocoaAppFromCarbonApp

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2016 : Group Archive : Group : All Groups

From: Bernie <bernie.fblist@...>
Date: Sun, 6 Nov 2016 11:38:55 +0000
Steve wrote:

> This demo does not require the extra menubar 'Quit' and seems to work as expected.  An AppDelegate or other classes may be added by including .h and .m files or by programmatically inserting the code between BeginC...EndC constructs.
> 
> /*
>   Demonstrates calling a Cocoa app from a Carbon app.
>   Written by S. Van Voorst   {20120430}
> */
> 
> begin enum 1
> _quitBtn
> end enum
> 
> local fn launchMyCocoaApp
> <…>
> end fn
> 
> local fn buildWindow
> '~'1
> dim as rect                  r
> dim as WindowAttributes   attr
> 
> attr  = _kWindowStandardFloatingAttributes
> attr += _kWindowStandardHandlerAttribute
> attr += _kWindowCompositingAttribute
> 
> _wndW = 440 : _wndH = 280
> 
> SetRect( r, 0, 0, _wndW, _wndH )
> appearance window -1, @"FB App",@r, _kDocumentWindowClass, attr
> 
> SetRect( r, _wndW - 160, _wndH - 60, _wndW - 60, _wndH - 40 )
> appearance button _quitBtn,,,,,@"Quit", @r, _kControlPushButtonProc
> fn SetControlCommandID( button&( _quitBtn ), _kHICommandQuit )
> 
> appearance window 1
> 
> end fn
> 
> fn buildWindow
> fn launchMyCocoaApp
> 
> RunApplicationEventLoop()
> 

Probably my misunderstanding, but I can’t see the use of the buildWindow function and call to RunApplicationEventLoop().