Board index » cppbuilder » OpenDialog filter list

OpenDialog filter list

Hi,
I have an open dialog with a long filter list.
How do I make the list to show more items?
I want the user to see all filters without having to scroll the list..
thanks in advance!
/totte
 

Re:OpenDialog filter list


One way is as follows

OpenDialog1->Filter = "Multimedia: MPEG AVI ASF MP3 WAV MID |
*.mpeg;*.avi;*.asf;*.mp3;*.wav;*.mid";

Rodolfo

: I have an open dialog with a long filter list.
: How do I make the list to show more items?
: I want the user to see all filters without having to scroll the list..

Re:OpenDialog filter list


Quote
Rodolfo Frino <starcinema2001> wrote in message

news:3d0bb974_2@dnews...

Quote
> OpenDialog1->Filter = "Multimedia: MPEG AVI ASF MP3 WAV MID |
> *.mpeg;*.avi;*.asf;*.mp3;*.wav;*.mid";
> : I have an open dialog with a long filter list.
> : How do I make the list to show more items?
> : I want the user to see all filters without having to scroll the

list..

I like Rodolfo's answer, but I don't think it's what you meant.  Did
you want to make the drop-down list box tall enough to eliminate the
vertical scroll bar?  Here's the way, for a visual (IDE) dialog:

void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
HWND filterbox;
int cnt;  // Item count
int iht;  // Item height in pixels
int wdth; // Width of Combo, used for ComboLBox
RECT r;

filterbox=GetDlgItem(GetParent(OpenDialog1->Handle),cmb1);
cnt=SendMessage(filterbox,CB_GETCOUNT,0,0);
iht=SendMessage(filterbox,CB_GETITEMHEIGHT,0,0);
::GetWindowRect(filterbox,&r);
wdth=r.right-r.left;

if (cnt<1)
 cnt=1;
// Next 2 Lines based on VCL Source for TCustomComboBox.AdjustDropDown
SetWindowPos(filterbox, 0, 0, 0, wdth, (iht+1) * cnt +
    iht + 2, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW
|
    SWP_HIDEWINDOW);
SetWindowPos(filterbox, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |
    SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW | SWP_SHOWWINDOW);

PostMessage(filterbox,CB_SHOWDROPDOWN,true,0); // Optional

Quote
}

// --

Because it's an API combobox, you can't use VCL code to control it.
BTW, I tried changing the style to "Simple", but apparently you can't
do that after the combobox has been created.  The big ComboLBox is
happy to overlap the dialog window, so there's no need to increase the
size of the dialog (which can be done).  I didn't have to include
<dlgs.h> because the VCL included <winuser.h>, which also provides the
dialog id for the filter box, cmb1.

--
Timothy H. Buchman
========================================
City Center Theater, New York NY
mail address tbuchmanPLEASE(at sign)REMOVEcitycenter.org
Search .borland message archive on http://www.mers.com/searchsite.html

Re:OpenDialog filter list


Hello Tim,

I like your approach too.

Rodolfo

Other Threads