FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour load *.RES into Imagelist() ?
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
load *.RES into Imagelist() ?
Posted: Mon Dec 12, 2022 08:52 AM
hi,

i just get stuck to load *.RES into ImageList.

i can load Resource from File into Imagelist() and also Image when have hBitmap / hIcon
under Xbase++ i can use LoadResource() but need to assign it to Object to get hBitmap / hIcon

how under Fivewin :?:
greeting,

Jimmy
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: load *.RES into Imagelist() ?
Posted: Mon Dec 12, 2022 09:08 AM

Please search for *.prg containing TImageList inside the FWH samples folder.

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: load *.RES into Imagelist() ?
Posted: Wed Dec 14, 2022 11:20 PM
hi Enrico,

i have to specify my Question :
how to "load" Bitmap Resource into Imagelist() :?:

---

CLASS TImageList have
Code (fw): Select all Collapse
   if ValType( oIcon ) == "C"
      if File( oIcon )
         DEFINE ICON oIco FILENAME oIcon
      else
         DEFINE ICON oIco RESOURCE oIcon
      endif
   else
      oIco = oIcon
   endif
but how when using Bitmap :?:
Code (fw): Select all Collapse
DEFINE BITMAP oBmpImage RESOURCE cString
// how about oBmpMask ?
Add( oBmpImage, oBmpMask )
greeting,

Jimmy
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: load *.RES into Imagelist() ?
Posted: Thu Dec 15, 2022 10:43 AM
Dear Jimmy,

You have an example of use in FWH\samples\fivedit.prg
Code (fw): Select all Collapse
   ::oImageListL = TImageList():New()
   ::oImageListL:Add( oBmp1 := TBitmap():Define( "folder",,  ::oWnd ),;
                      oBmp2 := TBitmap():Define( "fldmask",, ::oWnd ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: load *.RES into Imagelist() ?
Posted: Thu Dec 15, 2022 01:49 PM
hi Antonio,

thx for Answer.
i got it work but Result look different
ICON

Bitmap
Code (fw): Select all Collapse
#ifdef Use_Icon
         iImage_0 := oGrid:oImageListSmall:AddIcon( acIcon[ ii ] )
         iImage := MAX( 0, oGrid:oImageListBig:AddIcon( acIcon[ ii ] ) )
#else
         iImage_0 := oGrid:oImageListSmall:Add( oBmp1 := TBitmap():Define( acBitmaps[ ii ],, oDlg ),;
                                                oBmp2 := TBitmap():Define( acBitmaps[ ii ],, oDlg ) )
         iImage := MAX( 0, oGrid:oImageListBig:Add( oBmp1 := TBitmap():Define( acBitmaps[ ii ],, oDlg ),;
                                                    oBmp2 := TBitmap():Define( acBitmaps[ ii ],, oDlg ) ) )
#endif

         LV_ADDITEMS( oGrid:hLv, aItem, iImage )

#ifdef Use_Icon
         DestroyIcon( iImage_0 )
         DestroyIcon( iImage )
#else
         DeleteObject( iImage_0 )
         DeleteObject( iImage )

         DeleteObject( oBmp1 )
         DeleteObject( oBmp2 )
#endif
what i´m doing wrong :?:
greeting,

Jimmy
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: load *.RES into Imagelist() ?
Posted: Thu Dec 15, 2022 02:56 PM

Dear Jimmy,

Are you properly providing it a masked bitmap for each one ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: load *.RES into Imagelist() ?
Posted: Thu Dec 15, 2022 03:05 PM
hi Antonio,
Antonio Linares wrote:Are you properly providing it a masked bitmap for each one ?
i do not know what "masked bitmap" mean ...
"just" have try to use your Sample which use different Bitmap ("folder" / "fldmask")

did i "clean up" wrong as it "seems" all use 1st Bitmap :?:
greeting,

Jimmy
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: load *.RES into Imagelist() ?
Posted: Thu Dec 15, 2022 03:08 PM

Dear Jimmy,

Please review FWH\samples\fldmask.bmp to see what the mask bitmap must contain

Anyhow I don't know why it is repeating it...

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: load *.RES into Imagelist() ?
Posted: Sun Dec 18, 2022 03:53 PM
hi,

i found Solution but not sure "why" ... hm

for my TGrid() i use 2 x ImageList() for "Small" / "Big" like Explorer
Imagelsit() for "Big" are only used in "LVS_ICON" Mode but not for "LVS_REPORT" Mode which i use here

now when NOT add Bitmap to "Big" Imagelist() only to "Small" Imagelist() it display right :D
it might be "Size" of "Big" which i have SET to 256 (normal 32)
greeting,

Jimmy
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: load *.RES into Imagelist() ?
Posted: Mon Dec 19, 2022 07:30 AM
very good!

thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion