?
Solved

tooltip for dropdown combo?

Posted on 2003-02-20
3
Medium Priority
?
427 Views
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.

Greg

0
Comment
Question by:gmon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:Sweat
ID: 7988294
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


0
 

Author Comment

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

Greg
0
 
LVL 2

Accepted Solution

by:
Sweat earned 200 total points
ID: 8009783
Greg,

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.

Sweat


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

764 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