Discussion of article "Graphical Interfaces VI: the Checkbox Control, the Edit Control and their Mixed Types (Chapter 1)"

 

New article Graphical Interfaces VI: the Checkbox Control, the Edit Control and their Mixed Types (Chapter 1) has been published:

This article is the beginning of the sixth part of the series dedicated to the development of the library for creating graphical interfaces in the MetaTrader terminals. In the first chapter, we are going to discuss the checkbox control, the edit control and their mixed types.

The Checkbox Control

The checkbox control is designated to managing parameters that can have only two states. A button with two icons is used to identify the current state of the parameter to which the control is attached. The icon with the check symbol means that the parameter is enabled (on). The icon without the check symbol means the parameter is disabled (off). A brief description of the parameter is located near the button. 

This element will be composed of three graphical objects. They are:

  1. Background
  2. Icon (button)
  3. Text label

Fig. 1. Compound parts of the checkbox control.

Fig. 1. Compound parts of the checkbox control.

Author: Anatoli Kazharski

 

Hello sir i am interesting on your Article but i stil newbie about GUI and mql,
can you please  tell me how to get  value of Spin edit so it can be read to the EA.

 

Regards 

 
Hidayat Nur Wahit:

Hello sir i am interesting on your Article but i stil newbie about GUI and mql,
can you please  tell me how to get  value of Spin edit so it can be read to the EA.

Regards 

For example, from an article in CProgram::OnEvent() event handler:

void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
//--- Событие нажатия на текстовой метке
   if(id==CHARTEVENT_CUSTOM+ON_CLICK_LABEL)
     {
      ::Print(__FUNCTION__," > id: ",id,"; lparam: ",lparam,"; dparam: ",dparam,"; sparam: ",sparam);
      //--- Если нажали на первом чекбоксе
      if(lparam==m_checkbox1.Id())
        {
         m_checkbox2.CheckBoxState(m_checkbox1.CheckButtonState());
         m_spin_edit1.SpinEditState(m_checkbox1.CheckButtonState());
         
         Print("m_spin_edit1.GetValue(): ",m_spin_edit1.GetValue());
        }

      if(lparam==m_checkbox3.Id())
        {
         m_checkboxedit1.CheckBoxEditState(m_checkbox3.CheckButtonState());
         
         Print("m_checkboxedit1.GetValue(): ",m_checkboxedit1.GetValue());
        }

      if(lparam==m_checkbox4.Id())
        {
         m_checkcombobox1.CheckComboBoxState(m_checkbox4.CheckButtonState());
        }

      if(lparam==m_checkbox5.Id())
        {
         m_slider1.SliderState(m_checkbox5.CheckButtonState());
         m_dual_slider1.SliderState(m_checkbox5.CheckButtonState());
         
         Print("m_slider1.GetValue(): ",m_slider1.GetValue());
         Print("m_dual_slider1.GetLeftValue(): ",m_dual_slider1.GetLeftValue());
         Print("m_dual_slider1.GetRightValue(): ",m_dual_slider1.GetRightValue());
        }
     }

   if(id==CHARTEVENT_CUSTOM+ON_END_EDIT)
     {
      ::Print(__FUNCTION__," > id: ",id,"; lparam: ",lparam,"; dparam: ",dparam,"; sparam: ",sparam);
      
      if(lparam==m_spin_edit1.Id())
        {
         Print("m_spin_edit1.GetValue(): ",m_spin_edit1.GetValue());
        }
        
      if(lparam==m_checkboxedit1.Id())
        {
         Print("m_checkboxedit1.GetValue(): ",m_checkboxedit1.GetValue());
        }
      
      if(lparam==m_slider1.Id())
        {
         Print("m_slider1.GetValue(): ",m_slider1.GetValue());
        }
        
      if(lparam==m_dual_slider1.Id())
        {
         Print("m_dual_slider1.GetLeftValue(): ",m_dual_slider1.GetLeftValue());
         Print("m_dual_slider1.GetRightValue(): ",m_dual_slider1.GetRightValue());
        }
     }

   if(id==CHARTEVENT_CUSTOM+ON_CLICK_INC || id==CHARTEVENT_CUSTOM+ON_CLICK_DEC)
     {
      ::Print(__FUNCTION__," > id: ",id,"; lparam: ",lparam,"; dparam: ",dparam,"; sparam: ",sparam);
      
      if(lparam==m_spin_edit1.Id())
        {
         Print("m_spin_edit1.GetValue(): ",m_spin_edit1.GetValue());
        }
        
      if(lparam==m_checkboxedit1.Id())
        {
         Print("m_checkboxedit1.GetValue(): ",m_checkboxedit1.GetValue());
        }
     }
  }
 
Anatoli Kazharski:

For example, from an article in CProgram::OnEvent() event handler:

Thank's sir and now it well read the value,and will apply on my EA.

Regard's
 

Dear Anatoli Kazharski, thank you so much for this great library!

I kind of love the look & feel of the resulting interfaces.

When starting to adapt Test Library 10.mq5 to my personal needs I just thought it is worth mentioning that it really helped me to add the method

void CSpinEdit::LabelText(const string new_text)

to the class CSpinEdit doing nothing but deferring any call to CLabel::Description(const string new_text). The reason is that I am using a CSpinEdit for different types of values depending on the state of a CComboBox. After changing label with LabelText(text) and choosing the appropriate edit format the values are displayed as desired after calling

void CSpinEdit::ChangeValue(const double value)

 

Thanks again and Regards 

 
Thomas Schwabhäuser:

...

Thanks for the tip!

I will add this capability. Watch for updates future articles in this series.

Reason: