Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying dynamic ToolTipText in a ListBox 3

Status
Not open for further replies.

foxdev

Programmer
Feb 11, 2000
1,995
US
I have created a ListBox control on a form; the RowSourceType for the ListBox is an Alias.

Due to limited real-estate, the ListBox may not be wide enough for some of the larger values. I want to display the full text of the option currently under the mouse, a la ToolTipText.

I've tried setting the ToolTipText to a variety of things, and generally did not get anything, though sometimes I got something unintentional. I've also toyed with setting the ToolTipText dynamically in the MouseMove method to the ListBox.Value; trouble is, the item under the mouse may not be the value of the control if you haven't clicked it.

Is there a way to have the ToolTipText display the contents of the item under the mouse in a ListBox? [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Robert

This avoids the ToolTipText issue but ...

Use the MouseMove event of the Listbox to reposition and/or laterally expand the Listbox to enable required width view, the MouseMove events of adjacent controls or form to revert Listbox to original position/width.

Chris [sig][/sig]
 
I hadn't thought of that, Chris, and that may well come in handy in the future - its a neat technique. But I think for this particular form it would look...bizarre. The ListBox is at the far left, and if it expanded dynamically, it would overlap a grid. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 

Robert, use ItemTips property of Combobox. Set it to .T. - and thats all... [sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
Aaarrgghhh! Boy, am I a dummy! :cool:

Vlad, you came through again. A star for you! [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
As I was composing my post, Vlad posted his. You snooze, you lose.

BTW, Foxdev, Congratulations on TipMaster of the Week. I'm glad to see someone from the Fox community recognized. [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
 
Well, I figure if I post enough replies, the odds are that one of them will be right.

And a star for you, too, Jon - not for this, but for your all your other great posts. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
How do you give stars? I'll need one on my quesiton I am posting [sig]<p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>ICQ #9466492<br>
ICQ VFP ActiveList #73897253[/sig]
 
Click on
Was this post helpful?
Vote JDurbin TipMaster!


At the bottom of the responce you find helpful.

[sig]<p> Pete<br><a href=mailto:blindpete@mail.com>blindpete@mail.com</a><br><a href= > </a><br>What your mother told you is true! You will go blind! (from moonshine anyway)[/sig]
 
I was using ItemTips today and remembered this question. Finally found it. The ItemTips property isn't working for me. Any reason why? I get zilcho for any Tip. Thanks [sig]<p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>MCP Visual FoxPro<br>
ICQ VFP ActiveList #73897253[/sig]
 
John, ItemTips work for first column only, or for single-column combobox, I guess. [sig]<p>Vlad Grynchyshyn<br><a href=mailto:vgryn@softserve.lviv.ua>vgryn@softserve.lviv.ua</a><br>[/sig]
 
ooh bummer. Any other suggestions? [sig]<p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>MCP Visual FoxPro<br>
ICQ VFP ActiveList #73897253[/sig]
 
Hi John,

I get zilcho for any Tip.

As Vlad eluded to, tips are only shown when column 1 exceeds the length of the control.

ooh bummer. Any other suggestions?

If it's a listbox you are working with, you could try concealing column one, and setting it's value to the remaining columns concatenated into one string.

Example:
MyList.ColumnCount = 3
MyList.ColumnWidths = 0,100
MyList.AddListItem('Column One Value User Sees',1,2)
MyList.AddListItem('Column Two Value User Sees',1,3)
lcTip=MyList.List(1,2)+' | '+MyList.List(1,3)
MyList.AddListItem(lcTip,1,1) && column user sees in tooltip text

Kinda Hokey. [sig]<p>Jon Hawkins<br><a href=mailto: jonscott8@yahoo.com> jonscott8@yahoo.com</a><br><a href= > </a><br>Focus on the solution....Not the problem.[/sig]
 
Jon thanks. I havent gotten back to my code yet but ya, if it already shows the entire item why use a ToolTip. But are you saying you're box have more than 1 column? I'll check it out later today. [sig]<p>John Durbin<br><a href=mailto: john@johndurbin.com> john@johndurbin.com</a><br><a href= </a><br>MCP Visual FoxPro<br>
ICQ VFP ActiveList #73897253[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top