XBrowse 2101: bBmpData : enhancment

XBrowse 2101: bBmpData : enhancment

Postby nageswaragunupudi » 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:
Code: Select all  Expand view

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


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse 2101: bBmpData : enhancment

Postby Armando » Mon Feb 01, 2021 4:30 pm

Mr. Rao:

Great job.

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: XBrowse 2101: bBmpData : enhancment

Postby nageswaragunupudi » Wed Feb 03, 2021 8:11 am

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local aZodiac  := { "Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", ;
                       "Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces" }

   local oDlg, oFont, oBrw

   DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0,-32
   DEFINE DIALOG oDlg SIZE 300,720 PIXEL TRUEPIXEL FONT oFont TITLE FWVERSION

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE aZodiac COLUMNS 1 HEADERS "Zodiac" ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nStretchCol   := 1
      :lRecordSelector := .f.
      :lVScroll      := .f.
      :lHScroll      := .f.
      WITH OBJECT :aCols[ 1 ]
         :bBmpData      := { || oBrw:nArrayAt + 93 }
         :nClrBmpBack   := METRO_LIME
         :nHeadBmpNo    := 93
      END
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrowse 2101: bBmpData : enhancment

Postby Silvio.Falconi » Wed Feb 03, 2021 12:40 pm

Finally. very nice
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests