473,770 Members | 6,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ToolTip for ListBox-/ComboBox-Items

Hi!

If you move the mouse over an item that's part of a treeview and wider
than the treeview, a tooltip showing the full item text will be
displayed. I try to do this for ListBoxes and ComboBoxes.
For ListBoxes I got it working, but not for the ListBox part of
ComboBoxes. Do you know any sample code?

Thanks in advance!
Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #1
11 18371
* Timo Kunze <TK*********@gm x.de> scripsit:
If you move the mouse over an item that's part of a treeview and wider
than the treeview, a tooltip showing the full item text will be
displayed. I try to do this for ListBoxes and ComboBoxes.

For ListBoxes I got it working, but not for the ListBox part of
ComboBoxes. Do you know any sample code?


Untested: Handle the combobox's 'WM_CTLCOLORLIS TBOX' message. This message will be sent if the listbox part of the combobox is created. In the 'lParam' parameter you will receive the handle to the listbox part, then you can use the 'NativeWindow' class to handle the listbox part's events.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2
Herfried K. Wagner [MVP] schrieb:
Untested: Handle the combobox's 'WM_CTLCOLORLIS TBOX' message. This message will be sent if the listbox part of the combobox is created. In the 'lParam' parameter you will receive the handle to the listbox part, then you can use the 'NativeWindow' class to handle the listbox part's events.


Hello Herfried,

the problem is not to get the listbox handle (I used the DropDown event
and the GetComboBoxInfo api method), but to use it for further
processing. 'NativeWindow' seems the way to go, but can I use the
ToolTip class for NativeWindows? It doesn't seem so - so the next step
probably is writing a custom ToolTip class. Hmmm, smells like work, but
that's life I guess...
I hope .net 2.0 will simplify customizing a ComboBox' list portion.

Thank you!
Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #3
Okay, my ToolTip class is working now. However, there seems to be a hook
eating all messages that the ListBox portion would normally receive.
Neither the ListBox nor the ComboBox receive WM_MOUSEMOVE or any other
mouse message.
I'll set up my own mouse hook now. It's "funny": So much work for such a
small thing. :P

Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #4
Timo,

* Timo Kunze <TK*********@gm x.de> scripsit:
Okay, my ToolTip class is working now. However, there seems to be a
hook eating all messages that the ListBox portion would normally
receive. Neither the ListBox nor the ComboBox receive WM_MOUSEMOVE or
any other mouse message.


I am able to receive the 'WM_MOUSEMOVE' message for the listbox part
using this code (no cleanup code included yet):

\\\
Imports System.Runtime. InteropServices

Public Class ExtendedComboBo x
Inherits System.Windows. Forms.ComboBox

Private Const WM_CTLCOLORLIST BOX As Int32 = &H134

Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
If m.Msg = WM_CTLCOLORLIST BOX Then
Dim n As New Foo()
n.AssignHandle( m.LParam)
End If
MyBase.WndProc( m)
End Sub
End Class

Public Class Foo
Inherits System.Windows. Forms.NativeWin dow

Private Const WM_MOUSEMOVE As Int32 = &H200

Protected Overrides Sub WndProc(ByRef m As System.Windows. Forms.Message)
If m.Msg = WM_MOUSEMOVE Then
Debug.WriteLine ("Foo the bar")
End If
MyBase.WndProc( m)
End Sub
End Class
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #5
Hmmm, well, this makes my mouse hook useless. :)

However, I got all the stuff almost working and have come to the
conclusion that giving the Combo's own listbox portion ToolTips probably
is impossible (at least it's easier to use a custom ListBox as dropdown
window). There're 2 big problems:
1) LB_ITEMFROMPOIN T always returns 0 in the lower 16 Bit, so I've no
clue which item the cursor is over. Since it works for stand-alone
ListBoxes, I asume the ComboBox is eating this message.
2) The ToolTip gets displayed, but it's always covered by the listbox
portion. If I use SetWindowPos to change Z-order, the combobox will
immediately close up.

I'll try some things, but I'll probably take the other way and display
my own dropdown window.

Thanks for your help.
Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #6
Timo,

* Timo Kunze <TK*********@gm x.de> scripsit:
However, I got all the stuff almost working and have come to the
conclusion that giving the Combo's own listbox portion ToolTips
probably is impossible (at least it's easier to use a custom ListBox
as dropdown window). There're 2 big problems:

1) LB_ITEMFROMPOIN T always returns 0 in the lower 16 Bit, so I've no
clue which item the cursor is over. Since it works for stand-alone
ListBoxes, I asume the ComboBox is eating this message.
Can you post the source code (if you still have it)?

Maybe, you can make the combobox ownerdrawn and handle the 'DrawItem'
event to get the highlighted item.
I'll try some things, but I'll probably take the other way and display
my own dropdown window.


<URL:http://vbaccelerator.c om/article.asp?id= 13309>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #7
Herfried K. Wagner [MVP] schrieb:
1) LB_ITEMFROMPOIN T always returns 0 in the lower 16 Bit, so I've no
clue which item the cursor is over. Since it works for stand-alone
ListBoxes, I asume the ComboBox is eating this message.

Can you post the source code (if you still have it)?

http://www.timosoft-software.de/down...oxToolTip2.zip
Look for the TODO in CToolTipListBox .vb.
Maybe, you can make the combobox ownerdrawn and handle the 'DrawItem'
event to get the highlighted item.

I'll try it.

Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #8
I implemented OwnerDraw and now it works in a satisfying way.

Here's the code:
http://www.timosoft-software.de/down...oxToolTip3.zip

Timo
--
www.TimoSoft-Software.de
Stop software patents!
Nov 20 '05 #9
* Timo Kunze <TK*********@gm x.de> scripsit:
I implemented OwnerDraw and now it works in a satisfying way.

Here's the code:
http://www.timosoft-software.de/down...oxToolTip3.zip


Thank you! Is it "by design" that the tooltip is shown /below/ the list
portion of the combobox?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
14037
by: hiroshi ochi | last post by:
Hello, Using MSIE 6.0 and above, with javascript is it possible to display an individual tooltip for each item in a listbox? I need this functionality to show the listitems that are longer than the listbox size. Please refer to this link to get the idea of what I would like to do. Unfortunately this one is for VB.
6
2701
by: Robert | last post by:
Hello. I have been trying out the Lebans ToolTip Classes at http://www.lebans.com/tooltip.htm, to display "balloon" style help tips in a form. The classes I am using are located at http://www.lebans.com/DownloadFiles/A2kTooltip.zip So far the classes work perfectly, except that now I need to extend it to support other controls besides the ones given in the example form. I have gotten it to work with some controls, but not others. I...
6
4004
by: Jim H | last post by:
I have a dialog that I bring up as an options dialog. I have a variable for this dialog as a member of the main application form and I create it in the constructor. I bring up the dialog by calling MyOptionsDialog.ShowDialog(this) and I check the DialogResult in an if statement. The dialog has an owner draw ListBox that contains some UserControls I created. Each of those controls has a TooTip in it. The tool tip works fine the first...
2
5486
by: cd | last post by:
Is it possible to add a tool tip to an asp .net listbox control utilizing javascript or another method? I would like to add a tooltip when the user hovers over the item in the listbox. I was seeking a code sample. Thank you, -- Christopher
4
1532
by: Tim Zych | last post by:
I'm displaying a tooltip related to a listbox based on the selected item. It works well except when I move the cursor away from the listbox and then hover back over it, the tooltip pops up history for each item I have selected. For example, let's say I select an item. The tooltip pops up with the text. Good. Then I select a 2nd item, and the tooltip shows that text. Good. Then, I drag the cursor away from the listbox. The tooltip...
4
7787
by: srichand | last post by:
Hi All, Can somebody help me out in adding a tooltip to a listbox using js....
0
1620
by: LaksM | last post by:
Hi, I need to create a combox/listbox with certain fixed width. In that I need to display large text. I can use Hscroll for list box. But, is there a way to display the text as tooltip/mouse over text ? Need some help.
8
1839
by: amitjaura | last post by:
Can anybody guide me how to use tooltip on listbox
0
1191
by: tshad | last post by:
In VS 2008, is there a way to have the individual list item description to show up in a tooltip when you have your mouse over the list item? I have a list item that has descriptions that are wider that the width of the listbox and you can't always tell what the item says since the last half of the item is cut off. The ToolTip only shows the value of the tooltip for the control itself so it always shows the same thing.
0
1590
Pakmarshal
by: Pakmarshal | last post by:
Hello Everyone, While working with list view control in VB 2005, I observed a behavior that the tooltip for the control is not consistent i.e. if we closely observe that when the tooltip displays then one can find that some time when you move the cursor in the control, tooltip won’t be displayed. For further investigation I tried to observe the behavior of other such controls e.g. Treeview, listbox and textbox (Multiline). I have observed the...
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.