Combobox with bitmaps

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Combobox with bitmaps

Post by StefanHaupt »

Hi al,

I found an error using a combox with bitmaps on a folder. The height of the combo is not correctly calculated, if you use it on a folder. Inside a dialog it´s ok. See the picture.

Code: Select all | Expand

// test combobox with bitmaps on a folder
#include "FiveWin.ch"
Function test()
   Local oDlg,oFld
   Local aBitMaps:= {"one.bmp","two.bmp","one.bmp","two.bmp","one.bmp"}
   Local cCombo:= 1, oCombo
   Local aItems := {"One","two","tree","four","five"}

   DEFINE DIALOG oDlg  size 400,400

   @ 2,1 FOLDER oFld PROMPT "Power " ,"Of","Fivewin" OF oDlg     SIZE 100,100
   @ 2,1 COMBOBOX oCombo var cCombo  ITEMS aItems OF oFld:aDialogs[1]  SIZE  80,100 BITMAPS aBitMaps
   @ 1,10 COMBOBOX oCombo var cCombo  ITEMS aItems OF oDlg  SIZE  80,60 BITMAPS aBitMaps

ACTIVATE DIALOG oDlg

RETURN NIL
 


Image

Any suggestions ?
kind regards
Stefan
User avatar
ukoenig
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Combobox with bitmaps

Post by ukoenig »

Stefan,

Yes, I think it is the used BMP-size > 16 x 16
In Your Sample I added 16 x 16 BMP's.
Inside the Folder the Height is not adjusted.
I tested using a BMP 24x24

Tested with TFolderEx
Image

Your Sample ( TFolder )
Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Combobox with bitmaps

Post by StefanHaupt »

Uwe,

yes, it is the bmp-size, but 24x24 bitmaps are working on a normal dialog and it´s not working on a folder dialog, but it should.

I looked over the source of combobox but I didn´t find anything wrong

Antonio, could you check it, please

many thanks
kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 42778
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 116 times
Been thanked: 110 times
Contact:

Re: Combobox with bitmaps

Post by Antonio Linares »

Stefan,

Fixed. Some changes are required:

1. source\winapi\dlogbox.c: changes this way:

Added this new code

Code: Select all | Expand

static UINT itemHeight = 0;

//----------------------------------------------------------------------------//

HB_FUNC( SETOWNERDRAWITEMHEIGHT )
{
   itemHeight = hb_parnl( 1 );
}      


Modified the response to WM_MEASUREITEM:

Code: Select all | Expand

     case WM_MEASUREITEM:
           if( itemHeight != 0 )
              ( ( MEASUREITEMSTRUCT * ) lParam )->itemHeight = itemHeight;
           break;
 


and finally in EndDialog():

Code: Select all | Expand

HB_FUNC( ENDDIALOG )
{
   ...  

   if( itemHeight != 0 )
      itemHeight = 0;
}
 


And in both listbox.prg and combobox.prg, in Method SetBitmaps():

Code: Select all | Expand

METHOD SetBitmaps( acBitmaps ) CLASS TComboBox

   ...

      ...      
      SetOwnerDrawItemHeight( ::nBmpHeight )
   endif

return nil
 


Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Combobox with bitmaps

Post by StefanHaupt »

Antonio,

many thanks for your quick response :D :D

It´s working perfectly now.
kind regards
Stefan
Post Reply