April 26, 2024, 03:00:17 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Tooltips

Started by Brian, January 10, 2012, 12:30:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

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

LarryMc

does \n create a new line?


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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

Andy

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.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

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


LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

January 14, 2012, 11:43:56 AM #7 Last Edit: January 15, 2012, 06:16:30 AM by Brian Pugh
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