la idea es la siguiente , con una func
ion le digo que columna quiero que tenga imagenes .
Code: Select all
HB_FUNC( BRWSETCOLBMP ) // hTableView, nIndex, lOnOff
{
NSTableView * browse = ( NSTableView * ) hb_parnl( 1 );
NSTableColumn * column = [ [ browse tableColumns ] objectAtIndex :(hb_parnl( 2 ) - 1 ) ] ;
NSImageCell *imageCell = [[[NSImageCell alloc] init] autorelease];
[column setDataCell : imageCell ] ;
}
Code: Select all
- ( id ) tableView : ( NSTableView * ) aTableView objectValueForTableColumn : ( NSTableColumn * ) aTableColumn row : ( NSInteger ) rowIndex
{
if( symFMH == NULL )
symFMH = hb_dynsymSymbol( hb_dynsymFindName( "_FMH" ) );
hb_vmPushSymbol( symFMH );
hb_vmPushNil();
hb_vmPushLong( ( LONG ) hWnd );
hb_vmPushLong( WM_BRWVALUE );
hb_vmPushLong( ( LONG ) aTableView );
hb_vmPushLong( ( ( TableColumn * ) aTableColumn )->id );
hb_vmPushLong( rowIndex );
hb_vmDo( 5 );
NSString * string = [ [ [ NSString alloc ] initWithCString: ISCHAR( -1 ) ? hb_parc( -1 ) : "" ] autorelease ];
NSInteger * type = [[aTableColumn dataCell ] type ] ;
if( type == NSImageCellType ) return [ [ NSImage alloc ] initWithContentsOfFile : string ] ;
return [ [ NSImage alloc ] initWithContentsOfFile : string ] ;
return string ;
}
@end
Code: Select all
NSInteger * type = [[aTableColumn dataCell ] type ] ;
if( type == NSImageCellType ) return [ [ NSImage alloc ] initWithContentsOfFile : string ] ;