load *.RES into Imagelist() ?

load *.RES into Imagelist() ?

Postby Jimmy » Mon Dec 12, 2022 8: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: load *.RES into Imagelist() ?

Postby Enrico Maria Giordano » Mon Dec 12, 2022 9:08 am

Please search for *.prg containing TImageList inside the FWH samples folder.
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: load *.RES into Imagelist() ?

Postby Jimmy » 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: Select all  Expand view
  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 view
DEFINE BITMAP oBmpImage RESOURCE cString
// how about oBmpMask ?
Add( oBmpImage, oBmpMask )
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: load *.RES into Imagelist() ?

Postby Antonio Linares » Thu Dec 15, 2022 10:43 am

Dear Jimmy,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: load *.RES into Imagelist() ?

Postby Jimmy » Thu Dec 15, 2022 1:49 pm

hi Antonio,

thx for Answer.
i got it work but Result look different
ICON
Image
Bitmap
Image
Code: Select all  Expand view
#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
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: load *.RES into Imagelist() ?

Postby Antonio Linares » Thu Dec 15, 2022 2:56 pm

Dear Jimmy,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: load *.RES into Imagelist() ?

Postby Jimmy » Thu Dec 15, 2022 3: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: load *.RES into Imagelist() ?

Postby Antonio Linares » Thu Dec 15, 2022 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: load *.RES into Imagelist() ?

Postby Jimmy » Sun Dec 18, 2022 3: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
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: load *.RES into Imagelist() ?

Postby Antonio Linares » Mon Dec 19, 2022 7:30 am

very good!

thanks for sharing it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 84 guests