FormattedText in an UltraToolTip

Posted by ChUIMonster on 13-Mar-2009 10:45

I've carefully read as much documentation as I can find on UltraToolTips and one really neat feature that I'd like to use is to have a multi-line tool tip.

I can get this to work by embedding ~ r~ n in the ToolTipTextFormatted. Stuff like:

ultraToolTipManager1:GetUltraToolTip( n ):ToolTipTextFormatted = "abc~ r~ n123".

works fine. (There is really a properly placed tilde in the code but PSDN doesn't like that...)

However... this is crude and ugly. And the very helpful Infragistics Documentation shows a nice example of formatting a tool tip by embedding HTML inside it. That sounds really, really good! According to the docs I should be able to do stuff like:

ultraToolTipManager1:GetUltraToolTip( n ):ToolTipTextFormatted = "[p>abc[br />123[/p>".

(the "["s should be "<"s -- how are you supposed to post anything about HTML on PSDN?)

Except that it doesn't seem to work The tags come out as plain text.

(Yes, ToolTipTextStyle = Infragistics.Win.ToolTipTextStyle:Formatted.)

So I'm either doing something horribly wrong or there is a bug.

Does anyone have any ideas?

All Replies

Posted by Peter Judge on 13-Mar-2009 11:54

(the "["s should be "<"s -- how are you supposed to

post anything about HTML on PSDN?)

Use the [ pre ] and [ /pre ] tags (and remove the spaces)

So I'm either doing something horribly wrong or there

is a bug.

Does anyone have any ideas?

I've attached some working code, which doesn't look dissimilar to your example. (Run form2 and press the button to get the "fancy" tooltips on the fillins/editors).

I don't set

Maybe that's the trick, which is somewhat counter-intuitive to me. But if if works ...

ultraToolTipManager1:GetUltraToolTip( n

So that makes me wonder what "n" is, and whether it's returning a valid value.

If that's correct, then I don't know - although if you run the TooltipsManager sample on the Doc CD, you can also see the non-formatting behaviour.

As an aside, I don't know if you came across this in your documentation searches; it's a listing of the supported HTML.

http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WinFormattedLinkLabel_Formatting_Text_and_Hyperlinks.html

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/form2.cls:550:0]

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/form2.resx:550:0]

-- peter

Posted by ChUIMonster on 13-Mar-2009 13:29

You sample does indeed work. Frustratingly there really doesn't seem to be any difference between what you do and what I do.

Ok... I took out the ToolTipTextStyle = ToolTipTextStyle:Formatted. That made no difference.

And I was using SetUltraToolTip() to initialize them but, apparently, that isn't necessary. Taking it out didn't change anything either.

>> ultraToolTipManager1:GetUltraToolTip( n

>

So that makes me wonder what "n" is, and whether it's returning a valid value.

It is the control that the ToolTipInfo belongs to. It works -- the text does get assigned to it, it just doesn't get formatted.

This seems like it must be really simple and obvious!

BTW -- in your example you have:

USING Infragistics.Win.*.

USING Infragistics.Win.UltraWinEditors.*.

USING Infragistics.Win.UltraWinToolTip.*.

USING Infragistics.Win.FormattedLinkLabel.*.

Aren't the last 3 redundant? (Adding them had no impact on my issue.)

The .resx file was also unneeded

Posted by Peter Judge on 13-Mar-2009 13:50

You sample does indeed work. Frustratingly there

really doesn't seem to be any difference between what

you do and what I do.

My code's (more) scared of me? The Secret Progress Bit? Weird.

This seems like it must be really simple and

obvious!

You'd think so. And Mike F will probably come along in about 20 seconds with an explanation that will have us both slapping our foreheads.

Although it does sounds like a bug - and an Infragistics one at that.

BTW -- in your example you have:

USING Infragistics.Win.*.

USING Infragistics.Win.UltraWinEditors.*.

USING Infragistics.Win.UltraWinToolTip.*.

USING Infragistics.Win.FormattedLinkLabel.*.

Aren't the last 3 redundant? (Adding them had no

impact on my issue.)

No, the USING statement doesn't recurse downwards (if that's the right word). So you can't refer to something in Infragistics.Win.UltraWinToolTip with the USING Infragistics.Win.*. line.

This won't compile:

Iin order for things to work you need to say:

-- peter

Posted by ChUIMonster on 13-Mar-2009 13:52

I may have found something...

Apparently the time that you assign text to a tool tip it will parse and format according to the HTML tags.

After that no dice. Updates will honor embedded CR and LF but not much else.

I tried fooling it by setting the tool tip to "" but that didn't work

So now I'm thinking that I need to delete the ToolTipInfo and recreate it from scratch That seems painful. And speculative

Posted by Peter Judge on 13-Mar-2009 14:16

I may have found something...

Apparently the first time that you assign text

to a tool tip it will parse and format according to

the HTML tags.

After that no dice. Updates will honor embedded CR

and LF but not much else.

This works for me (I see the incremement).

I tried fooling it by setting the tool tip to "" but

that didn't work

So now I'm thinking that I need to delete the

ToolTipInfo and recreate it from scratch That

seems painful. And speculative

-- peter

Posted by ChUIMonster on 13-Mar-2009 14:39

I added some changes to your example and, sure enough, yours works. Mine still doesn't.

Dispose() followed by new() and then SetUltraToolTip() got me nowhere.

Reset*() was no better.

I did manage a case where the initial value was parsed. But I cannot get it to parse afterwards.

Posted by Peter Judge on 13-Mar-2009 14:43

I added some changes to your example and, sure

enough, yours works. Mine still doesn't.

On the theory that more sets of eyes are better than one, you mind posting your example for me/us to look at? .cls, assemblies.xml, .resx should do it.

Actually, the assemblies thing shouldn't make a difference, since you're using yours for both forms.

-- peter

Posted by ChUIMonster on 13-Mar-2009 15:06

I wouldn't particularly mind but it's kind of complicated and probably way too much to post. And not exactly a model of "proper" modern coding practice...

I might be getting somewhere though. I currently have some tooltips that seem to behave properly. Which is a big improvement.

I got that to happen by making sure that they are all initialized using ToolTipTextFormatted.

And I think I know why the ones that aren't working are broken... stay tuned

Posted by ChUIMonster on 13-Mar-2009 15:28

Soooo... it would appear that having an "

Ultimately it looks like the whole problem was the embedded "

On the bright side I learned from Peter's example that I didn't need to be creating individual ToolTipInfo controls which removes a few steps from each field initialization which is nice.

Posted by Peter Judge on 13-Mar-2009 15:32

Soooo... it would appear that having an "

in the formatted text is a really bad idea. Happily

the "& lt ;" type of syntax works to replace that.

Ultimately it looks like the whole problem was the

embedded "

From that link I posted earlier, it seems like the "br" tag is the problem - the formatted tooltip doesn't support it - it looks like there are only 10 or so tags supported. Actually, re-reading that page, I'm not sure whether the "br" tag is supported or not. It's not in the table, but is in the description. The evidence would suggest not.

-- peter

This thread is closed