preventing combobox dropdown box from showing

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Is there anyway to prevent the white box that drops down when you do a
combobox dropdown from showing? I am trying to make a custom combobox which
requires showing a custom form in its place, but the white box shows up
still ontop of the new form that is taking its palce even though there is no
items in the white box. Any windows messages or anything you can trap or
whatnot? thanks!
 
I don't know of a way to prevent the combo box extending, but a
different way to come at the problem might be to not inherit from the
combo box but create a control containing a textbox and your custom
drop down.

I found a design along these lines on CodeProject.com when I was
looking for a dropdown combo that contained a treeview instead of a
list. (search for TreeView Combo)

As a design concept it seemed to work well.

Alan.
 
If I understand your requirements, you want a control that looks like a
combo box, but when the down arrow is clicked, a separate form is
displayed (modally I suppose).

With some experimenting you could inherit from a combo box and find a
way to get the functionality you are after.

However I think that you would be trying to fit a square peg into a
round hole. How about just putting a text box control on the form,
then place a button control next to it that has a down arrow image on
it ? Then on the 'on click' event of the button show the form.
 
"Brian Henry" <[email protected]>'s wild thoughts
were released on Wed, 20 Jul 2005 11:06:43 -0400 bearing the
following fruit:
Is there anyway to prevent the white box that drops down when you do a
combobox dropdown from showing? I am trying to make a custom combobox which
requires showing a custom form in its place, but the white box shows up
still ontop of the new form that is taking its palce even though there is no
items in the white box. Any windows messages or anything you can trap or
whatnot? thanks!

You would make a usercontrol inherited from the combobox
then capture the messages to the combo box and intercept any
message that would result in the combobox showing it's
dropdown and instead show your own. So you'll need to
capture mouseclicks and the f4 key being pressed.

If you implement IMessageFilter you can capture the F4 key
and use Sub WndProc to capture the mouse events. I can't
remember why you can't capture the F4 key here too.

Sorry I can't be of more help, I can't find the article I
read about this so I'm going from memory.






Jan Hyde (VB MVP)

--
A man is incomplete until he is married.
After that, he is finished.

(Zsa Zsa Gabor)

[Abolish the TV Licence - http://www.tvlicensing.biz/]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top