Imagelist : Icon and Bitmap from Resource

Post Reply
User avatar
Jimmy
Posts: 1737
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Imagelist : Icon and Bitmap from Resource

Post by Jimmy »

hi,

to load Resource into Imagelist i use

Code: Select all | Expand

   iIcon := LoadIcon( GetResources(), "ICOUP" )
   iIcon := LoadIcon( GetResources(), "ICODOWN" )

   iImage := ILADDICON( ::oImageLHeader:hImageList, iIcon )
and

Code: Select all | Expand

   iIcon := LoadBitmap( GetResources(), "GRID_ASC" )
   iIcon := LoadBitmap( GetResources(), "GRID_DSC" )

   iImage := ILADD( ::oImageLHeader:hImageList, iIcon )
it work with Icon but fail(?) on Bitmap that Way :(

---

when use "File"-Icon i use

Code: Select all | Expand

   iTemp_0 := Icon_Read( ::cPath + cFile, 32 )
   ILADDICON( ::oImageListSmall:hImageList, iTemp_0 )
and

Code: Select all | Expand

   aBitmaps := ::oWnd:ReadImage( ::cPath + cFile, { ::nIcoSmall + 8, ::nIcoSmall + 8 } )
   iTemp_0 := aBitmaps[ 1 ]
   ILADD( ::oImageListSmall:hImageList, iTemp_0 )
 
here both work

what can be the Problem that Bitmap from Resource seems not to work :?:
it there another Way to load Bitmap Resource into Imagelist :?:
greeting,
Jimmy
Natter
Posts: 1233
Joined: Mon May 14, 2007 9:49 am

Re: Imagelist : Icon and Bitmap from Resource

Post by Natter »

There is such a file \source\function\Imgtxtio.prg
In it the function FW_ReadImage() - look at it
User avatar
Jimmy
Posts: 1737
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Post by Jimmy »

hi,

do you mean that i can use FW_ReadImage() also for Resource :?:

if yes, how is the Syntax to get Bitmap from Resource :?:
greeting,
Jimmy
Natter
Posts: 1233
Joined: Mon May 14, 2007 9:49 am

Re: Imagelist : Icon and Bitmap from Resource

Post by Natter »

FW_ReadImage(nil, "aaa")
User avatar
Jimmy
Posts: 1737
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Post by Jimmy »

hi,
Natter wrote:FW_ReadImage(nil, "aaa")
thx for Answer

i have try it and same Result :(
it must be something else in my CODE

CODE come from HMG where i have to change some HB_FUNC() for FiveWin
it have to do with Imagelist where Fivewin have a CLASS while HMG use it "in" HB_FUNC()

---

under HMG it work with Bitmap and i have spend a lot of Time under Fivewin before had Idea to use Icon :roll:
as i use Fivewin Imagelist also for File-Icon and Bitmap i know CLASS TImagelist() does work with Bitmap in Grid

but it fail in Grid-Header where i use up/down Arrow to show how it is "sort"

i need to look deeper why HB_FUNC for Fivewin does only work with Icon and not with Bitmap in Grid-Header
greeting,
Jimmy
User avatar
Jimmy
Posts: 1737
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Imagelist : Icon and Bitmap from Resource

Post by Jimmy »

hi,

found out what is going on with TImagelist()

Code: Select all | Expand

Method AddIcon( oIcon )
   if ValType( oIcon ) == "C"
      ...
   else
      oIco = oIcon
   endif
so both Object or String can be used

Code: Select all | Expand

METHOD Add( oBmpImage, oBmpMask )
want to have a Object so LoadBitmap() or ReadImage() fail as they return hBITMAP Handle

so i made this

Code: Select all | Expand

   DEFINE BITMAP oBMP RESNAME "GRID_ASC"
   iImage := ::oImageLHeader:Add( oBMP )
   DeleteObject( oBMP )
now i got Bitmap in Grid-Header :D

... but Icon look better ... Transparency of Bitmap is not working ...
Image
greeting,
Jimmy
Post Reply