From: sarav.bhatia on
Hello,

I am trying to set the combobox dropdown height on a pocket pc 2003
application. I have tried:

1. MoveWindow(this.Handle, this.Left, this.Top, this.Width, newheight,
true);

and

2. SetWindowPos(this.Handle, HWND_TOPMOST, this.Left, this.Top,
this.Width, newheight, SWP_DRAWFRAME);

Both, do not amount to any change in dropdown height.

I do change the ItemHeight in the combobox when its created
successfully. And, this makes some of the items in my dropdown go
below the fold. There is a vertical scroll that appears but it creates
usability issues that I would like to avoid by increasing the dropdown
height and showing all the items without the need of a scroll.

Would appreciate any contribution,

Sarav
From: George Chen on
Hi Sarav,

If the control is create by the 'Dialog' base resource, please refer the
article http://www.codeproject.com/KB/combobox/combobox_tut.aspx .
I don't know how to change the height in the source code either. maybe a
ownerdraw control is needed.

George Chen

<sarav.bhatia(a)gmail.com> wrote in message
news:966aece1-6d51-45d4-b95f-02fec643d6c7(a)b64g2000hsa.googlegroups.com...
> Hello,
>
> I am trying to set the combobox dropdown height on a pocket pc 2003
> application. I have tried:
>
> 1. MoveWindow(this.Handle, this.Left, this.Top, this.Width, newheight,
> true);
>
> and
>
> 2. SetWindowPos(this.Handle, HWND_TOPMOST, this.Left, this.Top,
> this.Width, newheight, SWP_DRAWFRAME);
>
> Both, do not amount to any change in dropdown height.
>
> I do change the ItemHeight in the combobox when its created
> successfully. And, this makes some of the items in my dropdown go
> below the fold. There is a vertical scroll that appears but it creates
> usability issues that I would like to avoid by increasing the dropdown
> height and showing all the items without the need of a scroll.
>
> Would appreciate any contribution,
>
> Sarav


From: George Chen on
Hi Sarav,

I test SetWindowPos in my testing code. it works.
here is my code: (in MFC way)

CRect rtCombo;
CWnd *pCombo = GetDlgItem(IDC_COMBO1);

pCombo->GetWindowRect(&rtCombo);
rtCombo.bottom = rtCombo.top + 80 + rtCombo.Height();
pCombo->SetWindowPos(NULL, 0, 0, rtCombo.Width(), rtCombo.Height(),
SWP_NOMOVE | SWP_NOZORDER);


George Chen

"George Chen" <george(a)wavesoft.com> wrote in message
news:eMQFoBcmIHA.2328(a)TK2MSFTNGP03.phx.gbl...
> Hi Sarav,
>
> If the control is create by the 'Dialog' base resource, please refer the
> article http://www.codeproject.com/KB/combobox/combobox_tut.aspx .
> I don't know how to change the height in the source code either. maybe a
> ownerdraw control is needed.
>
> George Chen
>
> <sarav.bhatia(a)gmail.com> wrote in message
> news:966aece1-6d51-45d4-b95f-02fec643d6c7(a)b64g2000hsa.googlegroups.com...
>> Hello,
>>
>> I am trying to set the combobox dropdown height on a pocket pc 2003
>> application. I have tried:
>>
>> 1. MoveWindow(this.Handle, this.Left, this.Top, this.Width, newheight,
>> true);
>>
>> and
>>
>> 2. SetWindowPos(this.Handle, HWND_TOPMOST, this.Left, this.Top,
>> this.Width, newheight, SWP_DRAWFRAME);
>>
>> Both, do not amount to any change in dropdown height.
>>
>> I do change the ItemHeight in the combobox when its created
>> successfully. And, this makes some of the items in my dropdown go
>> below the fold. There is a vertical scroll that appears but it creates
>> usability issues that I would like to avoid by increasing the dropdown
>> height and showing all the items without the need of a scroll.
>>
>> Would appreciate any contribution,
>>
>> Sarav
>
>


From: gromit on

<sarav.bhatia(a)gmail.com> wrote in message
news:966aece1-6d51-45d4-b95f-02fec643d6c7(a)b64g2000hsa.googlegroups.com...
> Hello,
>
> I am trying to set the combobox dropdown height on a pocket pc 2003
> application. I have tried:
>
> 1. MoveWindow(this.Handle, this.Left, this.Top, this.Width, newheight,
> true);
>
> and
>
> 2. SetWindowPos(this.Handle, HWND_TOPMOST, this.Left, this.Top,
> this.Width, newheight, SWP_DRAWFRAME);
>
> Both, do not amount to any change in dropdown height.
>
> I do change the ItemHeight in the combobox when its created
> successfully. And, this makes some of the items in my dropdown go
> below the fold. There is a vertical scroll that appears but it creates
> usability issues that I would like to avoid by increasing the dropdown
> height and showing all the items without the need of a scroll.
>
> Would appreciate any contribution,
>
> Sarav

I hope this helps
// resize combo window to get biggest possible list before a scrollbar is
added
itemcount=SendDlgItemMessage(g_hwnd, IDC_COMBOBOX, CB_GETCOUNT ,0,0);
itemheight =SendDlgItemMessage(g_hwnd, IDC_COMBOBOX, CB_GETITEMHEIGHT
,0,0);
RECT rcCombo,rcClient;
GetClientRect(GetDlgItem(g_hwnd,IDC_COMBOBOX), &rcCombo);
GetClientRect(GetDlgItem(g_hwnd,IDC_INPUTVIEW_EDITBOX), &rcClient);

newhite = itemcount*itemheight ;
if (newhite>rcClient.bottom)
newhite=rcClient.bottom+itemheight;
SetWindowPos(GetDlgItem(g_hwnd,IDC_COMBOBOX),HWND_TOP,0,0,
g_comboright,newhite ,SWP_NOMOVE| SWP_NOZORDER );



SendDlgItemMessage(g_hwnd, IDC_COMBOBOX, CB_SHOWDROPDOWN ,TRUE,0);



 | 
Pages: 1
Prev: Language VS2005
Next: ReadAllBytes