Treeview with Imagelist dont show the bitmap

Treeview with Imagelist dont show the bitmap

Postby yury » Mon Sep 01, 2008 8:13 pm

Hi everyone,

The code above should show the bitmap LOGOFF in prompt Level1 , ARQMIN in prompt Level2 and KEY_UP in prompt Level3...

But only show bitmap in first prompt, in the others show a blank space

Code: Select all  Expand view  RUN
DEFINE WINDOW oWndx FROM 1, 1 TO 31,95 TITLE 'Test' COLOR CLR_BLACK,CLR_WHITE


DEFINE BITMAP oBMP1 RESOURCE "LOGOFF"
DEFINE BITMAP oBMP2 RESOURCE "ARQMIN"
DEFINE BITMAP oBMP3 RESOURCE "KEY_UP"


oImageList = TImageList():New()


oImageList:Add(oBmp1,oBmp1)
oImageList:Add(oBmp2,oBmp2)
oImageList:Add(oBmp3,oBmp3)


oTree = TTreeView():New(0,0,oWndx,CLR_BLACK,CLR_WHITE,.F.,.F.,500,500)


oTree:SetImageList( oImageList )


oAux1 = oTree:Add('Level 1',0)   
oAux2 = oAux1:Add('Level 2',1)
oAux3 = oAux2:Add('Level 3',2)


oWndx:oClient = oTree


ACTIVATE WINDOW oWndx ON INIT (oWndx:SetFocus(),oWndx:Maximize(),oTree:ExpandAll())


Thanks for any help

Regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Postby Antonio Linares » Fri Sep 05, 2008 8:48 am

Yuri,

You are missing to define and use the bitmaps "masks". Here you have a working example:

test.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oWndx, oBmp1, oBmp11, oBmp2, oBmp22, oBmp3, oBmp33, oImageList, oTree, oAux1, oAux2, oAux3

   DEFINE WINDOW oWndx FROM 1, 1 TO 31, 95 TITLE 'Test'

   DEFINE BITMAP oBMP1  FILENAME "folder.bmp"
   DEFINE BITMAP oBMP11 FILENAME "fldMask.bmp"
   
   DEFINE BITMAP oBMP2  FILENAME "new2.bmp"
   DEFINE BITMAP oBMP22 FILENAME "new2mask.bmp"

   DEFINE BITMAP oBMP3  FILENAME "icon.bmp"
   DEFINE BITMAP oBMP33 FILENAME "icomask.bmp"

   oImageList = TImageList():New()

   oImageList:Add(oBmp1,oBmp11)
   oImageList:Add(oBmp2,oBmp22)
   oImageList:Add(oBmp3,oBmp33)

   oTree = TTreeView():New(0,0,oWndx,,,.F.,.F.,500,500)

   oTree:SetImageList( oImageList )

   oAux1 = oTree:Add('Level 1',0)   
   oAux2 = oAux1:Add('Level 2',1)
   oAux3 = oAux2:Add('Level 3',2)

   oWndx:oClient = oTree

   ACTIVATE WINDOW oWndx ON INIT ( oWndx:Center(), oTree:ExpandAll() )

return nil

Here you have the PRG, BMPs and EXE:
http://rapidshare.com/files/142773713/yuri.zip.html

Image
regards, saludos

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

Postby yury » Fri Sep 05, 2008 11:24 am

many thanks for your suport, Mr.Antonio !

I used your example, it's ok, but I believe that found the "problem" in my code:

When the bitmap dont have the same widht and height the imagelist control dont shows in treeview...

In my tests I used the bitmap with 0.48 x 0.42 and dont work, but after I adjust the size for 0.42 x 0.42 it's works fine !

But remains a doubt: which the utility of the bmp masks ?

best regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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