Board index » Visual Studio » CComboBox problem

CComboBox problem

Visual Studio310
Hi,

I need to make CComboBox edit control stretchable with the mouse,

something like in IE address box, that user can drag the right corner e.g.

more to the right. Is it hard to do?

thanks


-
 

Re:CComboBox problem

It's not hard. You can change the size (width only) of a combo box by

calling SetWindowPos() or MoveWindow(). The harder part is intercepting the

events that indicate the window must be resized and handling all that

correctly.



--

Jonathan Wood

SoftCircuits Programming

www.softcircuits.com">www.softcircuits.com



"azuro" <ad@yahoo.com>wrote in message

Quote
Hi,

I need to make CComboBox edit control stretchable with the mouse,

something like in IE address box, that user can drag the right corner e.g.

more to the right. Is it hard to do?

thanks







-

Re:CComboBox problem

One way to handle this is to implement a WM_SETCURSOR override for the subclass of the

combo box. Then look at where the cursor is; if it is over the edge (which you can get

via GetWindowRect and using values such as ::GetSystemMetrics(SM_CYEDGE) to compute fudge

factors) you set a resize cursor (there's one of these images in the images subdirectory

of the VS install directory). Then you have to handle the WM_LBUTTONDOWN handler, or

maybe the WM_NCLBUTTONDOWN handler, to catch the mouse click. If the mouse click is not

on one of the edges, send it to the superclass; otherwise, SetCapture and then use the

OnMouseMove handler to deal with the resizing.



This is a cute idea...I may take a shot at it.

joe



On Tue, 1 Aug 2006 15:35:08 -0600, "Jonathan Wood" <jwood@softcircuits.com>wrote:



Quote
It's not hard. You can change the size (width only) of a combo box by

calling SetWindowPos() or MoveWindow(). The harder part is intercepting the

events that indicate the window must be resized and handling all that

correctly.

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-

Re:CComboBox problem

I believe the IE address box is in a Rebar pane which might make this easier

for you if you want to do that same thing in a toolbar.



Tom



"azuro" <ad@yahoo.com>wrote in message

Quote
Hi,

I need to make CComboBox edit control stretchable with the mouse,

something like in IE address box, that user can drag the right corner e.g.

more to the right. Is it hard to do?

thanks







-

Re:CComboBox problem

thanks guys for tips, I'll try.

I was hoping that there is something more automatic though in that control

:)





"Joseph M. Newcomer" <newcomer@flounder.com>wrote in message

Quote
One way to handle this is to implement a WM_SETCURSOR override for the

subclass of the

combo box. Then look at where the cursor is; if it is over the edge

(which you can get

via GetWindowRect and using values such as ::GetSystemMetrics(SM_CYEDGE)

to compute fudge

factors) you set a resize cursor (there's one of these images in the

images subdirectory

of the VS install directory). Then you have to handle the WM_LBUTTONDOWN

handler, or

maybe the WM_NCLBUTTONDOWN handler, to catch the mouse click. If the

mouse click is not

on one of the edges, send it to the superclass; otherwise, SetCapture and

then use the

OnMouseMove handler to deal with the resizing.



This is a cute idea...I may take a shot at it.

joe



On Tue, 1 Aug 2006 15:35:08 -0600, "Jonathan Wood"

<jwood@softcircuits.com>wrote:



>It's not hard. You can change the size (width only) of a combo box by

>calling SetWindowPos() or MoveWindow(). The harder part is intercepting

>the

>events that indicate the window must be resized and handling all that

>correctly.

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm





-

Re:CComboBox problem

I use it in toolbar but I have already CComboBox impemented.

thanks



"Tom Serface" <tserface@msn.com>wrote in message

Quote
I believe the IE address box is in a Rebar pane which might make this

easier for you if you want to do that same thing in a toolbar.



Tom



"azuro" <ad@yahoo.com>wrote in message

news:O8tHe$atGHA.1888@TK2MSFTNGP03.phx.gbl...

>Hi,

>I need to make CComboBox edit control stretchable with the mouse,

>something like in IE address box, that user can drag the right corner

>e.g. more to the right. Is it hard to do?

>thanks

>









-

Re:CComboBox problem

Send me email, I'll send some code, providing I get it before I leave; otherwise, I'll

send it Sunday or Monday when I return.

joe



On Tue, 01 Aug 2006 22:23:14 -0400, Joseph M. Newcomer <newcomer@flounder.com>wrote:



Quote
One way to handle this is to implement a WM_SETCURSOR override for the subclass of the

combo box. Then look at where the cursor is; if it is over the edge (which you can get

via GetWindowRect and using values such as ::GetSystemMetrics(SM_CYEDGE) to compute fudge

factors) you set a resize cursor (there's one of these images in the images subdirectory

of the VS install directory). Then you have to handle the WM_LBUTTONDOWN handler, or

maybe the WM_NCLBUTTONDOWN handler, to catch the mouse click. If the mouse click is not

on one of the edges, send it to the superclass; otherwise, SetCapture and then use the

OnMouseMove handler to deal with the resizing.



This is a cute idea...I may take a shot at it.

joe



On Tue, 1 Aug 2006 15:35:08 -0600, "Jonathan Wood" <jwood@softcircuits.com>wrote:



>It's not hard. You can change the size (width only) of a combo box by

>calling SetWindowPos() or MoveWindow(). The harder part is intercepting the

>events that indicate the window must be resized and handling all that

>correctly.

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

Joseph M. Newcomer [MVP]

email: newcomer@flounder.com

Web: www.flounder.com">www.flounder.com

MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm

-