XBrowse 2101: bBmpData : enhancment
Posted: Mon Feb 01, 2021 6:25 am
We are aware that we use oCol:bBmpData to return a numeric value, which is an index value into the list of bitmaps already attached to the column with oCol:AddBitmap( aBitmaps ). If the value returned is not numeric or exceeds the length of the bitmap list, no bitmap is painted.
In some cases, it may not be possible to anticipate all the bitmaps that need to be displayed in advance and attach to the column with oCol:AddBitmap() method. We may have to decide the image at the time of runtime.
From FWH2101, bBmpData can either return a number which is an index of the list of bitmaps already loaded or return any other image source.
The image source can be name of any image file, resource, web ref, image buffer, symbol or shape.
The revised fwh\samples\xbrwdisk.prg uses this enhancement to display the icons of the files. If the file is an image file like bmp,jpg,png,gif,ico, etc the image is displayed as icon. If the file is exe, the icon of the exe and in other cases, the icon of the associated program is displayed.
This is how the bBmpData is programmed:
In some cases, it may not be possible to anticipate all the bitmaps that need to be displayed in advance and attach to the column with oCol:AddBitmap() method. We may have to decide the image at the time of runtime.
From FWH2101, bBmpData can either return a number which is an index of the list of bitmaps already loaded or return any other image source.
The image source can be name of any image file, resource, web ref, image buffer, symbol or shape.
The revised fwh\samples\xbrwdisk.prg uses this enhancement to display the icons of the files. If the file is an image file like bmp,jpg,png,gif,ico, etc the image is displayed as icon. If the file is exe, the icon of the exe and in other cases, the icon of the associated program is displayed.
This is how the bBmpData is programmed:
Code: Select all
oBrw:bBmpData := ;
{ || If( Right( oBrw:oTreeItem:cPrompt, 1 ) == ":", 4, ;
If( "D" $ oBrw:oTreeItem:Cargo[ 5 ], ;
If( oBrw:oTreeItem:lOpened, 1, 2 ), ;
oBrw:oTreeItem:Cargo[ 6 ] ; // file name with full path.
) ) ;
}