Phenom 0 Posted October 13, 2010 I have a lot of information I want to display in a tooltip. I requires several lines. I do not want to have to put all of it in one line, because it's long. If I split the command along multiple lines then it's not recognized. How can this be done? Share this post Link to post Share on other sites
KaFu 295 Posted October 13, 2010 I use this function in SMF... Func _ToolTip_Wrap_Long_String($s_ToolTip_Org) Local $s_ToolTip_Final Local $s_ToolTip_Work = $s_ToolTip_Org Local $i_ToolTip_Max_StringLen = 120 Local $i_ToolTip_Max_Rows = 8 Local $i_ToolTip_Current_Rows = 0 If StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen Then While StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen $s_ToolTip_Final &= StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen) & @LF $s_ToolTip_Work = StringRight($s_ToolTip_Work, StringLen($s_ToolTip_Work) - $i_ToolTip_Max_StringLen) $i_ToolTip_Current_Rows += 1 If $i_ToolTip_Current_Rows = $i_ToolTip_Max_Rows - 1 Then $s_ToolTip_Work = StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen - 4) & " ..." ExitLoop EndIf WEnd $s_ToolTip_Final &= $s_ToolTip_Work Else $s_ToolTip_Final = $s_ToolTip_Work EndIf StringStripWS($s_ToolTip_Final, 7) ToolTip($s_ToolTip_Final) EndFunc ;==>_ToolTip_Wrap_Long_String OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites
Phenom 0 Posted October 13, 2010 I use this function in SMF... Func _ToolTip_Wrap_Long_String($s_ToolTip_Org) Local $s_ToolTip_Final Local $s_ToolTip_Work = $s_ToolTip_Org Local $i_ToolTip_Max_StringLen = 120 Local $i_ToolTip_Max_Rows = 8 Local $i_ToolTip_Current_Rows = 0 If StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen Then While StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen $s_ToolTip_Final &= StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen) & @LF $s_ToolTip_Work = StringRight($s_ToolTip_Work, StringLen($s_ToolTip_Work) - $i_ToolTip_Max_StringLen) $i_ToolTip_Current_Rows += 1 If $i_ToolTip_Current_Rows = $i_ToolTip_Max_Rows - 1 Then $s_ToolTip_Work = StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen - 4) & " ..." ExitLoop EndIf WEnd $s_ToolTip_Final &= $s_ToolTip_Work Else $s_ToolTip_Final = $s_ToolTip_Work EndIf StringStripWS($s_ToolTip_Final, 7) ToolTip($s_ToolTip_Final) EndFunc ;==>_ToolTip_Wrap_Long_String How do you call that? Do you just pass the long string? That's the problem. You have to put the long string all in one line. Share this post Link to post Share on other sites
wakillon 403 Posted October 13, 2010 (edited) It works well with multiple lines ! $_message = 'I have a lot of information ' & @CRLF & _ 'I want to display in a tooltip.' & @CRLF & _ 'I requires several lines.' & @CRLF & _ 'I do not want to have to put all of it in one line, because its long.' & @CRLF & _ 'If I split the command along multiple lines then its not recognized.' & @CRLF & _ 'How can this be done?' Tooltip ( $_message ) Sleep ( 5000 ) Show us how you use tooltip... Edited October 13, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
KaFu 295 Posted October 13, 2010 (edited) I use it like shown belown. Wraps the tooltip and cuts it to a max length, useful if you don't know the length of the string beforehand ... $string = "aaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" $string &= "aaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" $string &= "aaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" _ToolTip_Wrap_Long_String($string) sleep(10000) Func _ToolTip_Wrap_Long_String($s_ToolTip_Org) Local $s_ToolTip_Final Local $s_ToolTip_Work = $s_ToolTip_Org Local $i_ToolTip_Max_StringLen = 120 Local $i_ToolTip_Max_Rows = 8 Local $i_ToolTip_Current_Rows = 0 If StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen Then While StringLen($s_ToolTip_Work) > $i_ToolTip_Max_StringLen $s_ToolTip_Final &= StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen) & @crlf $s_ToolTip_Work = StringRight($s_ToolTip_Work, StringLen($s_ToolTip_Work) - $i_ToolTip_Max_StringLen) $i_ToolTip_Current_Rows += 1 If $i_ToolTip_Current_Rows = $i_ToolTip_Max_Rows - 1 Then $s_ToolTip_Work = StringLeft($s_ToolTip_Work, $i_ToolTip_Max_StringLen - 4) & " ..." ExitLoop EndIf WEnd $s_ToolTip_Final &= $s_ToolTip_Work Else $s_ToolTip_Final = $s_ToolTip_Work EndIf StringStripWS($s_ToolTip_Final, 7) ToolTip($s_ToolTip_Final) EndFunc ;==>_ToolTip_Wrap_Long_String Edited October 13, 2010 by KaFu OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites
Phenom 0 Posted October 13, 2010 It works well with multiple lines ! $_message = 'I have a lot of information ' & @CRLF & _ 'I want to display in a tooltip.' & @CRLF & _ 'I requires several lines.' & @CRLF & _ 'I do not want to have to put all of it in one line, because its long.' & @CRLF & _ 'If I split the command along multiple lines then its not recognized.' & @CRLF & _ 'How can this be done?' Tooltip ( $_message ) Sleep ( 5000 ) Show us how you use tooltip... I just put the string all in one line. I notice that you are using _ to split it into multiple lines. That solves the problem, thanks. Share this post Link to post Share on other sites
wakillon 403 Posted October 13, 2010 @KaFuLooks good !I thought he was talking about the number of lines and not their lengths... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
wakillon 403 Posted October 13, 2010 I just put the string all in one line. I notice that you are using _ to split it into multiple lines. That solves the problem, thanks.I use _ just for display the script more easily, not for split text ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites