Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Active-X control to overlap the form it is on

Status
Not open for further replies.

DevonTaig

Programmer
May 2, 2001
73
0
0
US
I have created an Active-X control (MyNewCombo.ocx) that is similar to a standard combo-box. Everything seems to work fine during testing except if the control is placed near the bottom of a form. When I expand MyNewCombo (when it is near the bottom of the form), it does not properly overlap the bottom of the form (the form acts to clip the control). I have tried setting zOrder, but to no avail. Any ideas?
 
Hi

Drop-downs near the bottom of a form often cause problems (not just custom ones).

Solutions to consider are:
Reposition the control
Limit the number of items that can appear in the list
Use a standard list, rather than a drop-down one
Use a smaller font

Probably not what you wanted to read

Regards

sadcow
 
Make the dropdown another form. When you click the dropdown button, display that form as a modal form. Check for the available screen space and position the form accordingly. If you are stuck up somewhere, I can send you the control that i made, but how can i upload a zip file here?

All the best, Praveen Menon
 
How are you duplicating the action of the combobox? Do you include a genuine one in the user control, or one of your own making?

I ask because, if a roll-your-own, you need to know something about the dropdown part of comboboxes: their parent window is set to the desktop so as to avoid the clipping problem.
 
Thanks for the suggestions. Using the modal form idea seems to be on the right track, however, I have one small problem with that approach. I can accurately position the left side of the new modal form just fine, but the top of the new modal form is off just a bit because the border width (the border of the form that typically has a minimize, maximize, and close button) of the parent form is unknown. Is there some way of getting that value? I could estimate it, but that wouldn't be good.

Also, in order to get the placement of my usercontrol on the parent form, I am using a really lame work-around that involves cycling through all of the controls on the parent form (I need that information to place the new modal form)...is there a better way to do this?

Just an FYI...The combo-box is of my own making...basically, it is a text box with a small command button flush to the right. When you click the command button another text box appears with the items in a vertical list(there is a vertical scroll bar so that it looks almost exactly like a real combo box). This virtual combo box only ever has a few items in it, but will appear to the user to have thousands. The reason I made the control is that it is much, much faster at loading large numbers of items (say more than 10,000 items) than the microsoft combo-box is. I've also implemented a sort property that the user of the control can use at run-time.

 
I would suggest to put both the textbox and flush button in an activex control a a container for both. In addition you should us a form with no borders (like the splash screen example). Then you need only to obtain a standard window handle of the textbox control, and use that handle together with the Win32 API function GetWindowRect, which will return the position and size of the textbox in pixel screen coordinates. You could than position your borderless form with the combo items either directly below or above (you should consider that, if the combo is within a form that is to close to the lower screen border, in order to show the entire combo below the textbox, without running out of the screen) the textbox.

By OpenWater
 
kieren,

what happened to the sample i provided? did it work? Praveen Menon
pcmin@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top