Page 1 of 1

¿ Recambio en mensajes?

PostPosted: Thu Sep 02, 2010 7:25 am
by mastintin
Segun la documentación que he leido de apple NSRunAlertMessage está "Superada" por NSalert y probablemente en futuras versiones de xCode quede "descontinuada" . La forma correcta segun ellos sería algo asi :( no esta probado aún )

Code: Select all  Expand view


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) ;
 
  }
 

Re: ¿ Recambio en mensajes?

PostPosted: Thu Sep 02, 2010 8:57 am
by Antonio Linares
Manuel,

gracias por la información. Si, tendremos que migrar el código de los Msg... a ese nuevo formato :-)