IonicWind Software

IWBasic => General Questions => Topic started by: Brian on January 10, 2012, 12:30:35 PM

Title: Tooltips
Post by: Brian on January 10, 2012, 12:30:35 PM
Hi,

I'm using Balloon Tooltips in a program. How can I force it to write multiple lines, rather than one long line?

Thanks,

Brian
Title: Re: Tooltips
Post by: LarryMc on January 10, 2012, 01:34:14 PM
does \n create a new line?


LarryMc
Title: Re: Tooltips
Post by: LarryMc on January 10, 2012, 01:39:58 PM
QuoteTo force the ToolTip control to use multiple lines, send a TTM_SETMAXTIPWIDTH message, specifying the width of the display rectangle. Text that exceeds this width will wrap to the next line rather than widening the display region. The rectangle height will be increased as needed to accommodate the additional lines. The ToolTip control will wrap the lines automatically, or you can use a carriage return/line feed combination, \r\n, to force line breaks at particular locations.

LarryMc
Title: Re: Tooltips
Post by: Brian on January 10, 2012, 03:53:36 PM
Larry,

Didn't see that one, after my searching, and \n doesn't work, either

I'll have a look at that message, thanks

Brian
Title: Re: Tooltips
Post by: Andy on January 10, 2012, 11:16:17 PM
Hi Brian,

Larry was on the right lines, this is how you do multiple lines:

CONTROLCMD w1,98,@TBSETTIP,9,"Opens the help file" + "\n" + "2nd line" + "\n" + "3rd line of text"

I amended the 'Loadtoolbar' example program.

So just use "\n" between each line.

Andy.

Title: Re: Tooltips (solved!)
Post by: Brian on January 13, 2012, 12:02:17 PM
Hi,

Larry and Andy set me on the right path, and after many re-compiles, I finally got it!

CONST TTM_SETMAXTIPWIDTH=(0x400+24)

UINT hTooltip=TOOLTIPCONTROL(win,@TTS_ALWAYSTIP|@TTS_NOANIMATE|@TTS_NOFADE|@TTS_BALLOON,0)

TTADDTOOL hTooltip,@TTF_SUBCLASS|@TTF_IDISHWND|@TTF_CENTERTIP,GETCONTROLHANDLE(win,1),win.hWnd,"If you test this, the line will wrap at the nearest space to 150 pixels"

SENDMESSAGE hTooltip,TTM_SETMAXTIPWIDTH,0,150

The above code assumes the main window is called win, and you have a button with an ID of 1

Hope this helps someone,

Brian

Title: Re: Tooltips
Post by: LarryMc on January 13, 2012, 02:43:18 PM
What Andy and I were telling you (use \n ) was correct for toolbars and apparently is the window standard because of the qoute from the SDK.

You are using the standalone ToolTip control from the ControlPak.
Evidently there is an internal difference in the Pak's version.

Either way, glad you got it working.

LarryMc
Title: Tooltips Revisited
Post by: Brian on January 14, 2012, 11:43:56 AM
Larry,

I should have probably said I was using the Control Pak to create the tooltips

Anyways, been messing a bit with them, and rather like this idea. Runs without
a manifest file, but the button and info icon displays a lot cleaner with the manifest

Code and manifest supplied...

Uh oh, you will have to rename "Tooltips Code.exe.txt" to "Tooltips Code.exe.manifest"

Brian

Update: Added some colour to the tooltip background