Important alert: (current site time 7/16/2013 3:01:42 AM EDT)
 

winzip icon

DropDownControlContainer

Email
Submitted on: 2/2/2003 7:35:28 AM
By: ULLI 
Level: Advanced
User Rating: By 39 Users
Compatibility: VB 6.0
Views: 23632
author picture
(About the author)
 
     This little container OCX works like dropdown combo exept that it can contain other controls. Dropdown and Collapse can be set to occur either on MouseEnter/Exit or on TitleClick. For those of you interested in how to use Mouse Tracking this is a good example because it uses Subclassing and the Windows MouseLeave and MouseHover system messages to control it's behavior. Try it, download is only 8.5 kB. Tested (and probably works on) Win32 only!

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 111 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

2/2/2003 9:53:47 AM_Merlin_

Now this is what I call some code!
Nice going Ulli, 5 mouseballs comming your way! ;)
(If this comment was disrespectful, please report it.)

 
2/2/2003 1:26:21 PMSub-Zero

Another 5 for another wonderful piece of code.
Your the best :)
(If this comment was disrespectful, please report it.)

 
2/3/2003 2:35:42 AMkps

Brilliant!
(If this comment was disrespectful, please report it.)

 
2/3/2003 5:31:50 AMWill Barden

One slight problem: if you change the backcolor of the control (red), it doesn't show when expanding - the default window backcolor (grey) shows instead whilst it's expanding. To change this, add a UserControl.Refresh in the expand loop.
(If this comment was disrespectful, please report it.)

 
2/3/2003 8:45:51 AMCoite Moss

It's a keeper, very nice ! Vote of Excellent is all yours. Thanks for sharing this.
(If this comment was disrespectful, please report it.)

 
2/3/2003 11:52:20 AMUlli

Will, there's a Dovents in both loops. That should take care of repainting. I cant see it on my PC because it expands and collapses too fast
(If this comment was disrespectful, please report it.)

 
2/3/2003 12:21:52 PMHibiki Tokai

pretty cool!!!
(If this comment was disrespectful, please report it.)

 
2/3/2003 12:59:20 PMMirko Kressmann

This is the same as my MaxStrip-container, but my container has no support for mouse-in ore mouse-out events. On the other side the Maxstrip has support for Childs (Maxstrip´s Childs moves down or up if the container opened ore closed) and support for Clones (Clones open ore close if the container opened ore close). However... nice code ...

Mirko
(If this comment was disrespectful, please report it.)

 
2/3/2003 5:26:27 PMUlli

Okay, instead of DoEvents put a UserControl.Refresh in the Expand loop and a Parent.Refresh in the Collapse loop
(If this comment was disrespectful, please report it.)

 
2/6/2003 9:46:11 AMORSHEE

Let me give you a piece of advice.
You should use Create
WindowEx API instead of using usercontrol, and create window so it on top of all the others having in mind vertical position ov your new window so when you open the content window is created below or above the visible part.
Loading other controls in your new window is a bit tricky part you could find challenging for you and there are very good examples here on PSC on that topic.
Without offense i'll rate this code with 1 globe because it is in advanced category where it doesn't belong for sure and can't agree this is a good learning example.


(If this comment was disrespectful, please report it.)

 
2/6/2003 11:03:41 AMAhmadu Mohammed

Nice work, Five Globes from me
(If this comment was disrespectful, please report it.)

 
2/6/2003 12:21:41 PMUlli

Seems you have not understood what OCXs are for, Orshee. Let me give YOU some advice: they can be compiled separately and put in the toolbox, together with the other controls. And then you can simply paste them into the form you're developing, without any further ado about calling any API functions, just as you would paste in a frame or a textbox.
(If this comment was disrespectful, please report it.)

 
2/12/2003 7:48:06 PMORSHEE

If you look at the previous month contest winner list you'll see a familiar name with SuperGrid OCX.
So don't tell me what OCX controls are.
When time comes you'll understand what i was talking about.
Obvius example of bad funcionality of your code can be seen when comparing it with combo in critical situations, when for ex: you have a control close to the bottom border of a form, try to put a combo and your control, and you'll se what i'm talking about.
(If this comment was disrespectful, please report it.)

 
2/22/2003 8:03:05 PMTroy Rabel

Nice work Ulli, 5,555 Globes !!!
(If this comment was disrespectful, please report it.)

 
2/27/2003 7:50:31 AMOcX-Girl

Nice idea, but your controls Z-Order should be as orshee said, combo like, on top of all windows.
(If this comment was disrespectful, please report it.)

 
4/12/2003 7:44:20 AM{ pHroZeN GeeK }

nice code. would be great if u can add fading effect as a customizable option, where the control fades in as it drops down... and maybe "Easy in" where the control drops quickly initially and slowly stops in the end
(If this comment was disrespectful, please report it.)

 
4/12/2003 11:10:17 PMKris Bennett - (i00 Productions)

This is the worst piece of code that i have ever seen that has made it to the top in the coding contest ... I gave you 1 globe .. and thats only because u can not give 0! VB Accelerator have a much better user control for this!
(If this comment was disrespectful, please report it.)

 
5/1/2003 10:54:52 AMDream

mouseover events are unreliable, also its 'sticky', I agree Kriss shouldnt be up top
(If this comment was disrespectful, please report it.)

 
5/11/2003 11:16:57 AMPhred

I had to use a click event to open and close after changing background color. Mouseover just wouldnt work anymore.
Even though there are more ways to skin a cat, I have not seen any submissions using those. I think this is a great way to increase information on a form and I am using it.

(If this comment was disrespectful, please report it.)

 
5/14/2003 11:02:49 AMHenrik Alsing Pedersen

took me some time to get it work (about 10 min), but when i worked i saw it's power!
5 globes...
(If this comment was disrespectful, please report it.)

 
8/15/2003 1:21:48 AMCarl Bartlett

5 globes for the fact of the mysubclass which allows me to track mouseevents.
A note about the ptinrect, in and code for determining if the point is in the rect... for some reason it didn't work. The ptinrect api says that it returns true if the point is ontop of or to theleft of the rect... that is not is... and I kept getting out of rect when i moved the mouse quickly over my control... I wrote my own inrect function and it works perfect now!

thx for the trackmouse event code!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.