Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


tooltip for dropdown combo?

Posted on 2003-02-20
Medium Priority
Last Modified: 2011-10-03
I would like to provide a "tooltip" as users scroll over  items in the dropdown list of a select combo box (VB4 32bit).  The problem is that some items in the combo box are too long to see all the characters and I want to display all the characters as a "tooltip" or help tip.

I could use the popup menu feature on a mouse rightclick event but there are no mouse events to trap the mouse movement.

I was also thinking there may be some simple API calls to take care of this.


Question by:gmon
  • 2

Expert Comment

ID: 7988294

To manage the tool tip type help, you'll need to map where each line is in your combo box, I've done it, but it's ugly and it's not always satisfying.  There is, I believe a little easier way.

Using the SendMessage function, you can tell the combo box to display a wider drop down than the un-dropped down control.  That way, when you drop down, the list can appear fully and not just the width of the control.  I believe this should still work in VB4.

Public Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long

Public Const CB_GETLBTEXTLEN = &H149
Public Const CB_SHOWDROPDOWN = &H14F

Call SendMessage(Combo1.hwnd, CB_SETDROPPEDWIDTH, 228, ByVal 0)

Obviously you'll need to substitute your combo box name for Combo1 and the "228" value is the width to display so you'll need to adjust that to fit your requirements.

Hope this helps,



Author Comment

ID: 8006249
Thanks, Sweat.  Where does the Call to SendMessage go?


Accepted Solution

Sweat earned 200 total points
ID: 8009783

Great question, sorry for not including something about placement.

I have this call situated in my Form_Activate event.  But you should load the form and populated the Combo contents before calling it.

That means if you are using a Sub Main(), then you'll do a Load Form1 somewhere and perhaps a call to a routine that will build the contents of the combo box(s) and then when you come back to the Sub Main() you might make a Form1.Show call.  Place a DoEvents next and then make the call to the SendMessage.

If you have no Sub Main() then you too may want to place this in the Form_Activate event as well.

Be aware that I've indicated 228 (as a parameter in the SendMessage function) as *my* value.  Yours may need to be adjusted.



Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question