LISTBOX Bitmap Resource

LISTBOX Bitmap Resource

Postby Jimmy » 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:
Image
COMBOBOX and LISTBOX both use SetItems()/SetBitmaps()
Code: Select all  Expand view
  oCombo_Left:SetItems( acItem, .T. )
   oCombo_Left:SetBitmaps( acBitmaps )

Code: Select all  Expand view
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: Select all  Expand view
FUNCTION FillDriveArray()
   GetAllDrive()
RETURN {acItem,acBitmaps,nPosiUSB}

Code: Select all  Expand view
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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: LISTBOX Bitmap Resource

Postby Jimmy » Thu Dec 01, 2022 6: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: Select all  Expand view
oListbox := TComboBox() :new( 10, 20,, acItem,, 145, 95, oDlg,,,, BFcolor, BGcolor, .T., oFontDefault,,,, .F., acBitmaps )

it work when change to WINDOW
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests