FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour LISTBOX Bitmap Resource
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
LISTBOX Bitmap Resource
Posted: Wed Nov 30, 2022 11:41 PM
hi,

i have COMBOBOX where i show Drive-Letter and Bitmap from Resource
now i try to use same CODE for LISTBOX but i get no Image :shock:

COMBOBOX and LISTBOX both use SetItems()/SetBitmaps()
Code (fw): Select all Collapse
   oCombo_Left:SetItems( acItem, .T. )
   oCombo_Left:SetBitmaps( acBitmaps )
Code (fw): Select all Collapse
local aDrives := FillDriveArray()
   oListbox:SetItems( aDrives[1], .T. )
   oListbox:SetBitmaps( aDrives[2] )
for LISTBOX , which is in other *.PRG, i got Array this Way
Code (fw): Select all Collapse
FUNCTION FillDriveArray()
   GetAllDrive()
RETURN {acItem,acBitmaps,nPosiUSB}
Code (fw): Select all Collapse
STATIC FUNCTION GetAllDrive()
LOCAL aDrives := aDrives()
LOCAL ii, cDrive, nType, cLabel, cBitmap
   // Field-wide STATIC
   acItem := {}
   acBitmaps := {}
   nPosiUSB := 0

   FOR ii := 1 TO LEN( aDrives )
      cDrive := SUBSTR( aDrives[ ii ], 1, 1 )
      nType := GETDRIVETYPE( cDrive + ":" )
      cLabel := VOLUMENAME( cDrive + ":\" )
      DO CASE
         CASE nType = DRIVE_UNKNOWN
            cBitmap := "MYUNKNOWN16"
         CASE nType = DRIVE_NO_ROOT_DIR
            cBitmap := "MYFIXDRIVE16"
         CASE nType = DRIVE_REMOVABLE
            IF cDrive $ "AB"
               cBitmap := "MYFLOPPY16"                                // Floppy
            ELSE
               cBitmap := "MYUSBSTICK16"                              // DRIVE_REMOVABLE
               IF EMPTY(nPosiUSB)
                  nPosiUSB := ii
               ENDIF
            ENDIF
         CASE nType = DRIVE_FIXED
            IF cDrive = "C"
               cBitmap := "MYSYSDRIVE16"
            ELSE
               cBitmap := "MYFIXDRIVE16"
            ENDIF
         CASE nType = DRIVE_REMOTE
            cBitmap := "MYNETDRIVE16"
         CASE nType = DRIVE_CDROM
            cBitmap := "MYCDROM16"
         CASE nType = DRIVE_RAMDISK
            cBitmap := "MYRAMDISK16"
         OTHERWISE
            cBitmap := "MYUNKNOWN16"
      ENDCASE
      AADD( acItem, cDrive + ":" + SPACE( 3 ) + cLabel )
      AADD( acBitmaps, cBitmap )
   NEXT

RETURN aDrives
what i´m doing wrong :?:
did somebody have a working LISTBOX Sample which use Image from Resource :?:
greeting,

Jimmy
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: LISTBOX Bitmap Resource
Posted: Thu Dec 01, 2022 06:16 PM
hi,

i have change LISTBOX to COMBOBOX to test if Items/Bitmaps are correct
as i can now "see" Image and Item i´m sure Parameter are correct

btw. when using DIALOG this crash
Code (fw): Select all Collapse
 oListbox := TComboBox() :new( 10, 20,, acItem,, 145, 95, oDlg,,,, BFcolor, BGcolor, .T., oFontDefault,,,, .F., acBitmaps )
it work when change to WINDOW
greeting,

Jimmy

Continue the discussion