OBJPROP_TOOLTIP has 63 character limit....should be 128 characters.

 

According to https://www.metatrader4.com/en/releasenotes/215, first paragraph

1. Increased the maximum size of custom tooltips for graphical objects to 128 symbols. The tooltips are set using the OBJPROP_TOOLTIP property.


Yet there seems to still be a 63 character limit on the tooltip [per line].  How do you place line breaks so the tooltip text can have multiple lines?

It doesn't seem like 1 line can have all 128 characters


/n doesn't seem to work

 

I have [#1310336].  Are you saying that you cannot have multiple lines in a tooltip?  Or is it a bug?  In addition to the 128 character bug is really only 63 characters?

I'm reaching out to other mt4 users in the hopes that someone else may have experienced the same problem and maybe can provide solution. 

Personally I think that the bug tracker should be public.  In this way, we don't have to wonder if MQ has looked into it or not.

 
4evermaat:

Yet there seems to still be a 63 character limit on the tooltip [per line].  How do you place line breaks so the tooltip text can have multiple lines? 

Both appear to be fixed in build 890. Multiple lines are now handled, and the limit seems to be 256 characters.
 
JC #:
Both appear to be fixed in build 890. Multiple lines are now handled, and the limit seems to be 256 characters.


I am using MT4 on a Windows 11 PC**, build 1380 (24 Mar 2023). 

My testing shows that the limit is 64 characters per line (NOT including the "\n", which is measured by StringLen. but does not count, so far as the MT4 *ling* limit is concerned.

The total character limit is 259 characters, including the minimum of 3 "\n" characters, assuming 64 other-chars-per-line   Without including the 3 "\n", of course that is "256" (which is perhaps a limit one would expect, as 2 * old_128_limit).

Supposing one adds additional "\n" characters, what happens?   The limit including those added characters is still 259!  

The following script works as a 10-line tool tip string, which "StringLen" measures as 259 (including a +3 for the string "259").   Any extra character anywhere breaks it!  Any extra char on a max-64-length line also breaks it!
Since this example has 9 "\n" characters, there are 259 - 9 = 250 other characters that are actually displayed as the tooltip.

// Save & Compile in: Open_Data_Folder-> MQL4\Scripts\test_tooltip_maxlength_script.mq4
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---
   string tooltipDesc = "";
   tooltipDesc=StringConcatenate(tooltipDesc,  "123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 64 max per line, and 0 "\n" = 64
   tooltipDesc=StringConcatenate(tooltipDesc,"\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234567890\n1234"); // 64 chars over many lines, plus 7 "\n" = 71
   tooltipDesc=StringConcatenate(tooltipDesc,"\n123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 64 max, plus 1 "\n" = 65
   tooltipDesc=StringConcatenate(tooltipDesc,"\n123456789 123456789 123456789 123456789Including_NL's=^"); // 55 plus 1 "\n" = 56
   tooltipDesc=StringConcatenate(tooltipDesc,3+StringLen(tooltipDesc)); // 64+71+65+56 + 3 char_string = 259 (including the 9 "\n" chars, which makes for a 10 line tooltip!)
   
   //// Simplest example: 256 characters + 3 "\n" = 259 total. (Works!)
   //string tooltipDesc = "";
   //tooltipDesc=StringConcatenate(tooltipDesc,  "123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 64
   //tooltipDesc=StringConcatenate(tooltipDesc,"\n123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 65 
   //tooltipDesc=StringConcatenate(tooltipDesc,"\n123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 65 
   //tooltipDesc=StringConcatenate(tooltipDesc,"\n123456789 123456789 123456789 123456789 123456789 123456789 1234"); // 65 
   //// 64 + 3*65 = 259 limit (including 3 "\n" chars, which is a 4 line tooltip.  So, 256 total characters actually displayed, on 4 lines)
   
   string objName = "AnyName";
   ObjectDelete(objName);
   ObjectCreate(0,objName,OBJ_LABEL,0,0,0);
   ObjectSetInteger(0,objName,OBJPROP_XDISTANCE,100);
   ObjectSetInteger(0,objName,OBJPROP_YDISTANCE,100);
   ObjectSetInteger(0,objName,OBJPROP_CORNER,CORNER_LEFT_UPPER);
   ObjectSetText(objName,"Hover your mouse cursor over this label to inspect the Tooltip!",12,"Arial",clrRed);
   ObjectSetString(0,objName,OBJPROP_TOOLTIP,tooltipDesc);
}
//+------------------------------------------------------------------+

Tip: By the way, avoid using literal "&" (ampersand) characters because they don't display.

** Would someone with MT4 on a Mac please repeat the test to see if it also handles 64 characters per line, not including the "\n".  It might be that on a Mac, the line limit is only 63 ?? I don't know.

 
pips4life #:

It is not clear from the documentation whether the maximum is 63 or 64. :-(

https://docs.mql4.com/strings/stringconcatenate

Parameters

argumentN

[in]  Any comma separated values. From 2 to 63 parameters of any simple type.

Return Value

Returns the string, formed by concatenation of parameters transformed into string type. Parameters are transformed into strings according to the same rules as in Print() and Comment().

Note

Parameters can be of any type. Number of parameters can't be less than 2 or more than 64.

StringConcatenate - String Functions - MQL4 Reference
StringConcatenate - String Functions - MQL4 Reference
  • docs.mql4.com
StringConcatenate - String Functions - MQL4 Reference
Reason: