Link to home
Start Free TrialLog in
Avatar of gmon
gmon

asked on

tooltip for dropdown combo?

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.

Greg

Avatar of Sweat
Sweat

Greg,

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
Public Const CB_GETDROPPEDWIDTH = &H15F
Public Const CB_SETDROPPEDWIDTH = &H160



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,


Sweat


Avatar of gmon

ASKER

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

Greg
ASKER CERTIFIED SOLUTION
Avatar of Sweat
Sweat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial