Code: Select all
HB_FUNC( MSGYESNO ) // cMsg --> lYesNo
{
NSString * msg;
NSString * msg2;
NSString * cIcon;
CocoaInit();
ValToChar( hb_param( 1, HB_IT_ANY ) );
msg = [ [ [ NSString alloc ] initWithCString: ISCHAR( -1 ) ? hb_parc( -1 ) : "" ] autorelease ];
ValToChar( hb_param( 2, HB_IT_ANY ) );
msg2 = [ [ [ NSString alloc ] initWithCString: ISCHAR( -2 ) ? hb_parc( -2 ) : "" ] autorelease ];
cIcon = [ [ [ NSString alloc ] initWithCString: ISCHAR( -3 ) ? hb_parc( -3 ) : "" ] autorelease ];
// hb_retl( NSRunAlertPanel( @"Please select", msg, @"No", @"Yes", NULL, NULL ) == NSAlertAlternateReturn );
NSAlert *alert = [[NSAlert alloc] init];
int choice = 0 ;
[alert addButtonWithTitle:@"No"];
[alert addButtonWithTitle:@"Yes"];
[alert setMessageText: msg ];
[alert setInformativeText: msg2 ];
[alert setIcon: cIcon ];
[alert setAlertStyle:NSWarningAlertStyle];
choice = [ alert runModal] ;
[alert release];
kb_retl(choice == 0) ;
}