[futurebasic] Re: [FB] Sandboxing

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

From: Robert Covington <artlythere@...>
Date: Wed, 9 Nov 2011 22:42:40 -0500
On Nov 9, 2011, at 7:07 PM, Robert Purves wrote:
> 
> Perhaps someone would show us how to do that in FB, perhaps with BeginCXxxxx/EndC.
> 
> Robert P. 


> Brian wrote
> "Bernie and I posted such demos in early December (4th/5th) 2010 with the subject: [FB] FILES$(_FSSpecOpen ). "
> 

Here's a Steve Van Voorst post (thanks Steve) of something? Dec. 5, 2010


Bernie,

<< The sheet and window may become detached.>>
If you use a Cocoa window instead of Carbon, the sheet works as it should.

The following code is a hybrid between Chisnall's example and your recent post:

'-------------------
//Reference "Cocoa Programming Developers Handbook", Chisnall, © 2010, p. 215.

toolbox fn NSApplicationLoad = Boolean
fn NSApplicationLoad()

BeginCFunction
void WindowWithSheet( void )
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSRect wndRect = NSMakeRect( 400.0, 600.0, 600.0, 400.0 );
NSUInteger style = NSResizableWindowMask | NSClosableWindowMask ¬
| NSTitledWindowMask ;
NSWindow *window = [ [ NSWindow alloc ] 
                       initWithContentRect:wndRect 
                       styleMask: style
                       backing:NSBackingStoreBuffered
                       defer:NO];

[window setTitle: @"WindowWithSavePanel" ];
[window makeKeyAndOrderFront:nil]; 

NSSavePanel *sp = [NSSavePanel savePanel];
     //[sp  setRequiredFileType : @"pdf"];
     [sp  setRequiredFileType : @"jpg"];
     [sp beginSheetForDirectory:nil
                                           file:nil
                    modalForWindow: window
                        modalDelegate: nil
                        didEndSelector:nil contextInfo:nil];

[pool drain];
}
EndC

toolbox WindowWithSheet()
WindowWithSheet()

RunApplicationEventLoop()

'------------

Steve Van Voorst


--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...