Discussion of article "Graphical Interfaces X: Text Edit box, Picture Slider and simple controls (build 5)" - page 4

 
Artyom Trishkin:
Why is the empty string in the text input field not "" but " " "? For a long time I couldn't figure out why the check for an empty string didn't work....

I don't know why. It is initialised with an empty string (""). You can make sure of it yourself by looking in the constructor of CTextEdit class:

//+------------------------------------------------------------------+
//| Constructor|
//+------------------------------------------------------------------+
CTextEdit::CTextEdit(void) : m_edit_value(""),
                             m_reset_mode(false),
                             m_show_text_pointer_mode(false),
                             m_align_mode(ALIGN_LEFT),
                             m_text_edit_state(true),
                             m_area_color(clrNONE),
                             m_icon_x_gap(0),
                             m_icon_y_gap(3),
                             m_icon_file_on(""),
                             m_icon_file_off(""),
                             m_label_text(""),
                             m_label_x_gap(0),
                             m_label_y_gap(4),
                             m_label_color(clrBlack),
                             m_label_color_hover(C'85,170,255'),
                             m_label_color_locked(clrSilver),
                             m_edit_y_size(20),
                             m_edit_x_gap(50),
                             m_edit_y_gap(0),
                             m_edit_color(clrWhite),
                             m_edit_color_locked(clrWhiteSmoke),
                             m_edit_text_color(clrBlack),
                             m_edit_text_color_locked(clrSilver),
                             m_edit_text_color_highlight(clrRed),
                             m_edit_border_color(clrSilver),
                             m_edit_border_color_hover(C'85,170,255'),
                             m_edit_border_color_locked(clrSilver)

  {
//--- Save the name of the element class in the base class
   CElementBase::ClassName(CLASS_NAME);
//--- Set priorities for left mouse button pressing
   m_area_zorder  =1;
   m_label_zorder =0;
   m_edit_zorder  =2;
  }
 
Anatoli Kazharski:

I don't know why. It is initialised with an empty string (""). You can see for yourself by looking in the constructor of the CTextEdit class:

...

Yes, I did. That's why I couldn't understand why the condition of checking for "" doesn't work after initialisation. Then I noticed that when the cursor is placed inside the input field, a wide space is created there - exactly the size of a space (approximately like this: ). I checked for " " and everything worked.
 
Pavel Kolchin:

gives this error when connecting (it does not interfere with work)

cannot load custom indicator 'C:\MetaTrader\MT5 demo\MQL5\Experts\new_menue_fc_1.00.ex5::Indicators\SubWindow.ex5' [4802]

CWndEvents::DetermineSubwindow > Ошибка при получении хэндла индикатора в директории ::Indicators\SubWindow.ex5 !

I'm using this version of the library, the menus are in the main graphics.

where it is connected in the files, I can't find it
 
Pavel Kolchin:
where it is connected in the files, I can't find it

In the main file of the MQL application you are testing, delete this line:

//+------------------------------------------------------------------+
//|TestLibrary05.mq5 |
//| Copyright 2016, MetaQuotes Software Corp. | |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2016, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
//--- Connection of the indicator for the "Expert in subwindow" mode
#resource "\\Indicators\\SubWindow.ex5"
 
Anatoli Kazharski:

In the main file of the MQL-application you are testing, delete this line:

#resource "\\Indicators\\SubWindow.ex5"
That's the thing, it's deleted
 
Pavel Kolchin:
That's the thing, it's deleted

In the Defines.mqh file, set the EXPERT_IN_SUBWINDOW parameter to false:

//+------------------------------------------------------------------+
//|Defines.mqh |
//| Copyright 2015, MetaQuotes Software Corp. | |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
//--- Expert in window mode
#define EXPERT_IN_SUBWINDOW false
 
Anatoli Kazharski:

In the Defines.mqh file, set the EXPERT_IN_SUBWINDOW parameter to false:

 
Pavel Kolchin:
Great! )
 
Is there any reason for the "expert in sub window" mode has changed to true as default in Defines.mqh?
//--- "Expert in subwindow" mode
#define EXPERT_IN_SUBWINDOW true

This cause errors when expert is not used in sub window.
I changed to false in Defines.mqh and everything seems to work correctly until now. 

 
Dear Anatoli, congratulations, your interface is very useful, easy and awsome. I adopted for my EAs and Indicators. Really thank you for all. Please, go on and on!