load *.RES into Imagelist() ?

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

load *.RES into Imagelist() ?

Post by Jimmy »

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
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: load *.RES into Imagelist() ?

Post by Enrico Maria Giordano »

Please search for *.prg containing TImageList inside the FWH samples folder.
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: load *.RES into Imagelist() ?

Post by Jimmy »

hi Enrico,

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

---

CLASS TImageList have

Code: Select all | Expand

   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: Select all | Expand

DEFINE BITMAP oBmpImage RESOURCE cString
// how about oBmpMask ?
Add( oBmpImage, oBmpMask )
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: load *.RES into Imagelist() ?

Post by Antonio Linares »

Dear Jimmy,

You have an example of use in FWH\samples\fivedit.prg

Code: Select all | Expand

   ::oImageListL = TImageList():New()
   ::oImageListL:Add( oBmp1 := TBitmap():Define( "folder",,  ::oWnd ),;
                      oBmp2 := TBitmap():Define( "fldmask",, ::oWnd ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: load *.RES into Imagelist() ?

Post by Jimmy »

hi Antonio,

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

Code: Select all | Expand

#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
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: load *.RES into Imagelist() ?

Post by Antonio Linares »

Dear Jimmy,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: load *.RES into Imagelist() ?

Post by Jimmy »

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
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: load *.RES into Imagelist() ?

Post by Antonio Linares »

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
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: load *.RES into Imagelist() ?

Post by Jimmy »

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
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: load *.RES into Imagelist() ?

Post by Antonio Linares »

very good!

thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply