Newline in tooltip control

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

Newline in tooltip control

Post by Lembasts »

Hi,
According to: https://www.sapien.com/blog/2014/01/30/ ... p-control/
..all I need do for a new line in my tooltip is add a backtick n (`n).
I have done that on a tooltip and it does not generate a newline and simply display the text `n.
What am I missing please?
Thanks
David
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Newline in tooltip control

Post by jvierra »

The string must be in double quotes.

$tip = "this is one line `n and this is two lines"
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

Re: Newline in tooltip control

Post by Lembasts »

Thanks.
I also discovered that you cannot set that tootltip text directly in the controls properties.
You have to use the settooltip method.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Newline in tooltip control

Post by jvierra »

That is correct. You cannot easily use the tooltip property on a control. It is just there to display a defult tip.

Attached is a demo of how to use a tooltip without any code.

Read the following very carefully to learn how ToolTips work.

https://www.sapien.com/blog/2014/01/30/ ... p-control/
Attachments
test-tootip.psf
(24.34 KiB) Downloaded 138 times
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Newline in tooltip control

Post by jvierra »

Lembasts wrote: Tue May 28, 2019 7:31 pm Thanks.
I also discovered that you cannot set that tootltip text directly in the controls properties.
You have to use the settooltip method.
My example shows how to use the tooltip set on the control.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked