XBrowse 2101: bBmpData : enhancment

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

XBrowse 2101: bBmpData : enhancment

Post by nageswaragunupudi »

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

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
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: XBrowse 2101: bBmpData : enhancment

Post by Armando »

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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: XBrowse 2101: bBmpData : enhancment

Post by nageswaragunupudi »

Code: Select all

#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
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: XBrowse 2101: bBmpData : enhancment

Post by Silvio.Falconi »

Finally. very nice
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
Post Reply