Thanks Dennis

I sort of worked something like that out looking at the D4 source code for the Combo 
Box. I came up with this bit of code below.

I was doing this as part of my new Open Dialogs for a project. The project adds 
combos, checkboxs, and groups to the open dialogs.

In order to get a dialog recource editor I had to install Microsoft Visual C++ which 
is over 300 meg, so I have a 300 meg resource editor. It is such a pity Borland did 
not think that Delphi developers would like such a tool, instead of providing such 
rubbish in a product called ImageEditor which has the same bugs since about D2, and 
does not edit or create resources anyway, except images and does that badly as well.

Cheers

Chris


    1019 : { Put File Dir }
           begin
             if (HiWord(WPARAM) = CBN_DROPDOWN) then
               begin
                  Handle := GetDlgItem(Wnd, cmd);
                  ControlHeight := SendDlgItemMessage(Wnd,1019, CB_GETITEMHEIGHT, -1, 
0);
                  ItemHeight := SendDlgItemMessage(Wnd,1019, CB_GETITEMHEIGHT, 0, 0)+1;
                  ItemCount  := SendDlgItemMessage(Wnd,1019, CB_GETCOUNT, 0, 0);
                  GetWindowRect(Handle, fRect);
                  Width := fRect.Right-fRect.Left;
                  if ItemCount > DropDownDirectoryCount then
                     ItemCount := DropDownDirectoryCount;
                  if ItemCount < 1 then
                     ItemCount := 1;

                  SetWindowPos(Handle, 0, 0, 0, Width, ItemCount * 
ItemHeight+ControlHeight+4, SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE + SWP_NOREDRAW 
+ SWP_HIDEWINDOW);
               end;
             SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + 
SWP_NOZORDER + SWP_NOACTIVATE + SWP_NOREDRAW + SWP_SHOWWINDOW);
             GetDlgItemText(Wnd,cmd, Buffer, 255);
             XPutFileDir := StrPas(Buffer);
           end;

Christopher Crowe (Software Developer)
Microsoft MVP, MCP

Byte Computer & Software LTD
P.O Box 13-155 
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Dennis Chuah
> 
> It seems like you are using the standard Windows combobox.  If this is the
> case, the height of the dropdown list is dependent on the height of the
> combobox control.  The combobox works by creating 3 controls, 1. the
> combobox control (invisible), 2. the edit control, and 3. the listbox
> control.  The listbox control is normally invisible.  When the combobox
> control is first created, the height of the listbox control is 
> set to height
> of (1) - height of (2).
> 
> 

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to