Happy Boxing Day!
Does anyone have experience with Multiline tooltip text?
Thanks.
Hi Clive,
I just tried some tests using WinFBE which uses Jose's tooltip Afx routines to create the tooltip and assign text. I have not yet found a way for the tooltip to interpret a \n linefeed within the string that should break the text into separate lines.
I am off to bed but hopefully tomorrow I will get an inspiration for something that I am overlooking.
Thank you, Paul!
Looks like you need to set the tooltip max tip with via a sendmessage call otherwise the tooltip will not properly interpret the embedded linefeeds. I used 200 in the example below. I will see how to integrate this into WinFBE's generated code. So far, I got it to work using one of Jose's AfxWindow template sample code.
sendmessage( hTooltip, TTM_SETMAXTIPWIDTH, 0, 200 )
Hopefully this will work for you.... it seems to now work okay within WinFBE's generated visual designer code. The 'problem' is that WinFBE does not expose the window handle for any tooltip control that you assign to a control. It is tracked internally by the WinFBE visual designer code (WinFormsX) but it is not readily available to the user.
I have now added a property that will allow you access the window handle for the tooltip.
You will need to download the attachment which contains the updated WinFormsX files. There are only 2 in the zip file and they both need to be copied to your inc folder. For example: \WinFBE_Suite\FreeBASIC-1.07.2-gcc-5.2\inc\WinFormsX This will overwrite the 2 files that currently exist there.
In your WinFBE visual designer, enable the Load event for your form and you can now set the tooltip code as follows. You may need to play around with the tooltip width depending on the size of your tooltip.
''
''
Function frmMain_Load( ByRef sender As wfxForm, ByRef e As EventArgs ) As LRESULT
dim newText as wstring * 100 = "Button 1 new text" & chr(10) & "Second line" & chr(10) & "third line"
frmMain.Button1.Tooltip = newText
newText = "Label 1 new text" & chr(10) & "Second line" & chr(10) & "third line"
frmMain.Label1.Tooltip = newText
sendmessage( frmMain.Button1.hWindowToolTip, TTM_SETMAXTIPWIDTH, 0, 200 )
sendmessage( frmMain.Label1.hWindowToolTip, TTM_SETMAXTIPWIDTH, 0, 200 )
Function = 0
End Function
Hope this works for you!
That works great, Paul, thanks.
Regular ToolTips work as desired. Balloon ToolTips with more than 1 CR inserted in the text popup properly but with the rounded corners squared off, other than that they also work properly.
Here is all the code needed:
' Form's Load
sendmessage( frmMainJ.lvJournal.hWindowToolTip, TTM_SETMAXTIPWIDTH, 0, 500 )
' ListView MouseMove
' Set tooltiptext.
Dim as long Row, Col
Var HT = sender.HitTest( Row, Col )
If HT = -1 Then
sender.ToolTip = ""
Return 0
End If
Dim newTip As WString * 500 = Trim(js(jdb.RecPtr).Body(row + 1))
sender.ToolTip = newTip
I like the appearance of the squared off BalloonToolTip.