Combobox with bitmaps

Combobox with bitmaps

Postby StefanHaupt » Tue Mar 27, 2012 8:04 am

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 view
// 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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Combobox with bitmaps

Postby ukoenig » Tue Mar 27, 2012 3:12 pm

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Combobox with bitmaps

Postby StefanHaupt » Wed Apr 04, 2012 12:18 pm

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Combobox with bitmaps

Postby Antonio Linares » Wed Apr 04, 2012 3:32 pm

Stefan,

Fixed. Some changes are required:

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

Added this new code
Code: Select all  Expand view
static UINT itemHeight = 0;

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

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


Modified the response to WM_MEASUREITEM:
Code: Select all  Expand view
     case WM_MEASUREITEM:
           if( itemHeight != 0 )
              ( ( MEASUREITEMSTRUCT * ) lParam )->itemHeight = itemHeight;
           break;
 


and finally in EndDialog():
Code: Select all  Expand view
HB_FUNC( ENDDIALOG )
{
   ...  

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


And in both listbox.prg and combobox.prg, in Method SetBitmaps():
Code: Select all  Expand view
METHOD SetBitmaps( acBitmaps ) CLASS TComboBox

   ...

      ...      
      SetOwnerDrawItemHeight( ::nBmpHeight )
   endif

return nil
 


Image
regards, saludos

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

Re: Combobox with bitmaps

Postby StefanHaupt » Thu Apr 05, 2012 10:12 am

Antonio,

many thanks for your quick response :D :D

It´s working perfectly now.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 144 guests