Discussion of article "Graphical Interfaces X: Word wrapping algorithm in the Multiline Text box (build 12)" - page 2

 

Alexander:
...

In this regard, can you tell me what changes should be made to the previous examples to make them work or maybe it has already been described in some article? Specifically, I want to make a panel based on the example from the Article 7 TestLibrary05 folder. Thank you.

Download the example from the archive. It has examples of almost all library controls in one panel.

Files:
 
The downloaded example from the archive compiled, but when loading it on the chart, the log shows the entry " 2017.04.15 12:58:14.715 TestLibrary01 (USDRUB_TOM,D1) invalid pointer access in 'WndContainer.mqh' (430,38) ". and after loading it does not react to anything at all and even close it is impossible, I had to delete the chart. I have MT5 of the latest build 1580 dated 10 April.
 
Alexander:
The downloaded example from the archive compiled, but when loading it on the chart, the log shows the entry " 2017.04.15 12:58:14.715 TestLibrary01 (USDRUB_TOM,D1) invalid pointer access in 'WndContainer.mqh' (430,38) ". and after loading it does not react to anything at all and even close it is impossible, I had to delete the chart. I have MT5 latest build 1580 dated 10 April.

Unfortunately, I have not been able to reproduce your problem yet. I have no problems when testing this Expert Advisor (the same build of the terminal). It is not the first time I have encountered the fact that different users can get different results when testing the same MQL-application. In general, I will keep in mind. I will put an additional check. Thank you for the message.

When such an error occurs, the programme is deleted from the chart, and all graphical objects created in it remain on the chart, so you should delete them manually by Ctrl + B.

 
The strangest thing is that the programme is not uninstalled, probably because not even the EA icon appears in the top right corner, and there is none in the list of objects.
 
Alexander:
The strangest thing is that the programme is not uninstalled, probably because not even the EA icon appears in the top right corner, and there is none in the list of objects.
If there is no Expert Advisor icon, it means that the programme has already been uninstalled. Click the 'All' button in the'Object List' window (Ctrl + B).
 
Thank you Anatoly!
Very instructive example!
Especially nice that it works in MT4 as well.
My hat is off to you once again.
Your persistent and painstaking work is admirable.
All the best and good mood!
Happy Holidays.
 
Mikhail Dovbakh:
...
It is especially nice that it works in MT4 as well.
...

Be careful with MT4, as I don't test the library in this terminal at all since some time.

 

Anatoly, is there a typo here?

   for(uint s=1; s<symbols_total; s++)
     {
      //--- Count if (2) дошли до конца строки или (2)  нашли пробел (конец слова)
      if(s+1==symbols_total || (m_lines[l].m_symbol[s]!=SPACE && m_lines[l].m_symbol[s-1]==SPACE))
         words_counter++;
     }
//--- Return word count
   return(words_counter);

If not, please explain the logic of it

 
Rashid Umarov:

Anatoly, is there a typo here?

If not, explain the logic, please

Typo. (1) (2)

The logic is simple. We count words in the current line. A word here is a continuous sequence of characters (without a space).

  1. If we have reached the end of the string, we increase the word counter.
  2. If the current character is not a space, but the previous space, then increase the word counter.
 
If I add new lines programmatically, then I call UpdateTextBox(), but the scrollbars and wordwrapping is not getting applied. I need to press some key. How to trigger this without pressing any key?