[MQL4/MQL5] How to show ampersand character (&) in tooltip text

 

This is just an information, not a question. Since I can't find the documentation in MQL4/MQL5 site, I decided to write it at here.

If you try to show an ampersand character (&) in object's tooltip text like this:

ObjectSetString(0,obj_name,OBJPROP_TOOLTIP,"A & B");

It won't work, the "&" character will produce nothing, so you will see "A B".

If you write double ampersand characters ("&&") instead, the next character will get underlined. For example, "&&A" will produce A. It's just like the menu access key in Windows platform. Not sure what is the purpose of this in MT4/MT5's tooltip text.


To show an ampersand character in tooltip text, you have to write triple ampersand characters like this:

ObjectSetString(0,obj_name,OBJPROP_TOOLTIP,"A &&& B");

But it's interesting that if you want to show double ampersand characters (&&), you only need to write five ampersand characters instead of six ampersand characters:

ObjectSetString(0,obj_name,OBJPROP_TOOLTIP,"A &&&&& B");

This will show "A && B" in the tooltip text.

 
xtemer: This is just an information, not a question. Since I can't find the documentation in MQL4/MQL5 site, I decided to write it at here.
Thank you for the information!
 
Comments that do not relate to this topic, have been moved to "Off Topic Posts".