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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ControlTipText - Wrapping/Carriage Return 2

Status
Not open for further replies.

Aubs010

Technical User
Apr 4, 2003
306
GB
I have set the ControlTipText for a specific control on a form.

How can I get it, so that when a user hovers the mouse over the control, the Tip pops up, but wraped or have a Carriage Return (preferable) in it?

e.g.
This is what I have:
Code:
------------------------------------------------------------------
Enter the details you require. Separate each detail by a return
------------------------------------------------------------------

This is what I want:
Code:
---------------------------------
Enter the details you require.
Separate each detail by a return
---------------------------------

Is there any way to do it in code?

Also, where would I put the code? - I've looked into the VB code, and the only options I have for the text box is:
AfterUpdate
BeforeUpdate
Change
Click
DblClick
Dirty
Enter
Exit
GotFocus
KeyDown
KeyPress
KeyUp
LostFocus
MouseDown
MouseMove
MouseUp
Undo

There isn't one for MouseOver - Any suggestions would be grealy appreciated :)

Aubs
 
Type:
<NameOfBtn>.controltiptext = &quot;Text&quot; & vbnewline & &quot;Text2&quot;
The vbNewLine gives the carriage return
 
Many thanks checkOut, did the trick perfectly (have a
star.gif
on me! :)

To shorten the code, vbCr would do the same as vbnewline

Also another question, I take it you are still confined to 255chrs? - How many is the crlf classed as? 1?

And another!!!

Is there a way of putting in an empty line without having to use:

& vbCr & &quot; &quot; & vbCr

I've tried:
vbcr & vbcr
vbcrlf & vbcrlf
vbnewline & vbnewline

None of them do the trick!

Thanks again for your help :)

Aubs
 
MouseMove is similar to MouseOver:

Private Sub TextBox_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
DateReceived.ControlTipText = &quot;Hey, get the mouse off me&quot; & vbCrLf & &quot;Not that I hate mice...&quot;
End Sub

But...if the tip doesn't change, you can just set it in the properties of the control and use Ctrl+Enter to insert a new line.

It will pop up automatically when you put the mouse pointer over it, no matter of the MouseMove event...

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
I not really use the ControlTipText in the way u use it so I don't know why vbCr & vbCr not working, but I think u easily can use a &quot; &quot; for giving an empty line..
the vbCr is counting 1 char in the 255 chars.

The way I handle kind of problems u describe is the following.
I wrote a form: frmNotice (give it the same look as the controlTipText) with 1 field: txtNotice
So in the mouseOver (as Danvlas describes) put code to open the form with the necc. text. in the txtNotice. So ur very flexible to anything u want.
Greetz Gerard
 
Thanks guys, helped me very much.

DanVlas, thanks for that, didn't think of Ctrl+Enter! Am using it for other tips! (have a
star.gif
too ;-) )

Much appreciated.

Regards,

Aubs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top