I'm almost new to ASM. And i don't know where really to search for an answer to this problem. So I'll ask you guys ;)
How can I make a multiline Tooltip?
Have I use a special character for the linebreak? <- tried already some, but don't work. :(


PS: Excuse my poor english.
Posted on 2002-01-08 09:16:25 by Wolf_HFS
Hi !


They are talking about multi-line tooltips there ! :alright:

Multiline ToolTips

Multiline ToolTips allow text to be displayed on more than one line. They are supported by version 4.70 and later of the common controls. Your application creates a multiline ToolTip by responding to a TTN_GETDISPINFO notification message. To 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.

Note that the text buffer specified by the szText member of the NMTTDISPINFO structure can accommodate only 80 characters. If you need to use a longer string, point the lpszText member of NMTTDISPINFO to a buffer containing the desired text.

Posted on 2002-01-08 09:55:52 by JCP
Oh. Yeah. MSDN.:stupid:


Posted on 2002-01-08 09:59:12 by Wolf_HFS
Wolf_HFS i thought since your new that you might not understand why you might be getting an assembly error trying to get your tooltip size modified. it appears that the NMTTDISPINFO STRUCT in the windows.inc file is bugged. its actually not the NMTTDIPINFO which holds error but it appears to be the NMHDR STRUCT that causing the error. you probably wont be needing to use this line in the NMTTDIPINFO STRUCT:

;hdr NMHDR <>

so just disable it with a semi-colon in front and it should elimated the error. well hopefully the info im providing is accurate info. just thought this may help.
Posted on 2002-01-08 10:57:59 by smurf
Don't really want to change the size directly using TTM_SETMAXTIPWIDTH message, cause I thinng the "\r\n"-way is the better one.
But I tryed to use the \r\n combination and no one work.
Tried both ways:

test db "1st line\r\n2nd line",0 ; -> Tooltip: "1st line\r\n2nd line"
test db "1st line",13,10,"2nd line",0 ; -> Tooltip: "1st line##2nd line" // where # is a square (illegal character)

Any idea?

Posted on 2002-01-08 13:57:43 by Wolf_HFS
>"They are supported by version 4.70 and later of the common controls."

What version of windows do you have?
Posted on 2002-01-08 16:45:27 by -T-
I'm using Win XP. So I thing it must be 6.0.

Posted on 2002-01-09 01:07:53 by Wolf_HFS
Maybe somone else could try to create a multiline Tooltip by using the \r\n-Syntax and could tell me if it works, and then maybe post this little piece of code?
Cause I doesn't really know how to implement the other way with the TTN_GETDISPINFO notification message. :(

Posted on 2002-01-09 04:40:04 by Wolf_HFS
maybe the TTM_SETMAXTIPWIDTH is needed also with "\r\n" breaks?

Did you check the version number of comctl32.dll? Some programs replace it with older versions, maybe windowsXP uses another dll for newer features
Posted on 2002-01-09 09:58:01 by beaster
TTM_SETMAXTIPWIDTH couldn't be the thing i need, cause I'm using more then one tooltip and I wanne break them at different positions (at the \r\n-Point ;)).

In my System-Dir this file is in version 4.72.3110.1
In my System32-Dir this file is in version 5.82.2600.0
So it should work.

Posted on 2002-01-09 11:27:12 by Wolf_HFS

Nope. TTM_SETMAXTIPWIDTH isn't needed for "\r\n" breaks, cause I tryed it and it doesen't work.

CDTip2 db "Gr??e der CD \r\n(650MB = 74Min && 700MB = 80Min)",0
invoke SendMessage,hTool,1048,0,30 ;TTM_SETMAXTIPWIDTH to 30

Result is a Tooltip with 6 lines text and not replacing the \r\n by a line break.:mad:
I'm going mad.

What i'm doing wrong? I know that it must work, cause I can read that @ MSDN. And there stands that \r\n alone will also do it.

So. Any other sugestions? Plz

Posted on 2002-01-09 11:54:02 by Wolf_HFS
\r\n maybe 0Dh,0Ah try like below

CDTip2 db "Gr??e der CD",0dh,0ah,"(650MB = 74Min && 700MB = 80Min)",0
invoke SendMessage,hTool,1048,0,30 ;TTM_SETMAXTIPWIDTH to 30
Posted on 2002-01-09 13:28:51 by LaptoniC
really wired !!
I tried it with the MS "Control Spy" tool, but same effect.

cause I can read that @ MSD

... this is not always a guarantee that it works ...

Do you also give the text as response on TTV_GETDISPINFO? Maybe it does not work if you set the text initially?

Otherwise I'm out of any more idea :(
Posted on 2002-01-09 13:31:07 by beaster
Finaly i got it

It is a mix of almost all what is standing here. But it's really confusing.
The solution of the problem is that I have to send a TTM_SETMAXTIPWIDTH message to the Tooltip with a width of SHRT_MAX! Then I'm able to use \n (which means character number 13) as a linebreak. Every other width-parameter will do what's the real porpose of that message: set the maximum size of the tooltip to iWidth.

So here is my finaly code

CDTip2 db "Gr??e der CD",13,"(650MB = 74Min - 700MB = 80Min)",0
invoke SendMessage,hTool,1048,0,32767 ;TTM_SETMAXTIPWIDTH to SHRT_MAX

(had to use the final values for the constants, cause my masm doesen't know them :confused: )

Posted on 2002-01-09 13:43:29 by Wolf_HFS
Just creating your buffer with CRLF's makes the tooltip multiline. I created a buffer like so:

MultiLine BYTE "1. First Line",0dh,0ah
BYTE "2. Second Line",0dh,0ah
BYTE "3. Third Line",0dh,0ah,0

and it appears like this:

Posted on 2002-01-09 16:20:16 by rdaneel
I don't know why, but this one doesen't work for me.
But tnx anyway.

Posted on 2002-01-10 01:05:10 by Wolf_HFS
Post a fragment of your source that "should" be working (via. code braces), or attach your source so we can have a look at it.

Its probably a simple mistake that takes another to see first.

(( I wasted 6 hrs yesterday debugging PIC Asm code, and realized a 1 shoulda been a 2!! ))

Posted on 2002-01-10 02:17:07 by NaN
Take a look at my 3rd post in this thread.
That's the code that should work.

Posted on 2002-01-10 04:25:14 by Wolf_HFS
Sorry, my error. I somehow got it in my head that you weren't able to get *anything* going, while others can.

However, I personally would follow something like rdaneel's approach. But if your looking to use a mask like \n\r for 13,10 codes, you *could* save yourself the headache and just define a typedef:

$LR typedef <,13,10,>

use it as:

TipText db "1) This is Line One" $LR "2) and this is line 2..",0

It doesnt solve your problem, but in the most part it accomplishes the same task. (Trying to make up for my earlier act of stupidity here ;) )

Posted on 2002-01-10 06:43:45 by NaN
Tnx for the tip. As a Newbie I dosen't know that I can make such helpfull things. :)

Posted on 2002-01-10 09:32:25 by Wolf_HFS