Gallery of UIs written in MQL - page 14

 
//+------------------------------------------------------------------+
//|                                                Язык разметки KIB |        
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//---------------------------------
//УРОК 1.   
//---------------------------------

//---------------------------------
//СОДЕРЖАНИЕ:
//---------------------------------
1.   СОЗДАНИЕ ФОРМЫ ОКНА.

2.   ПРАВИЛА СОЗДАНИЯ ГРУПП ЭЛЕМЕНТОВ.

3.   ПРАВИЛА СОЗДАНИЯ ЭЛЕМЕНТОВ.

4.   ТИПЫ ЭЛЕМЕНТОВ.
//---------------------------------



//--------------------------------------------------------------------------------------------------+
//1. СОЗДАНИЕ ФОРМЫ ОКНА: 
//--------------------------------------------------------------------------------------------------+ 
ПОСЛЕДОВАТЕЛЬНОСТЬ КОММАНД:

1. ОБЪЯВЛЯЕМ НОВОЕ ОКНО: NEW_WINDOW,

2. ИМЕНУЕМ ОКНО:         W_NAME, "Window 1",

3. ВЫБИРАЕМ ИКОНКУ ОКНА ИЗ ОКНА ИКОНОК КОНСТРУКТОРА (ВЫЗЫВАЕТСЯ ДАБЛ-КЛИКОМ НА ГРАФИК) И ПРОПИСЫВАЕМ : W_LABEL, "::Images\\some_icon.bmp", 

4. УСТАНАВЛИВАЕМ ТИП ОКНА -  W_TYPE, SETTINGS, (ИЛИ DINAMIC, MENU, DIALOG).

//--------------------------------------------------------------------------------------------------+ 
NEW_WINDOW,     W_NAME, "Window 1",      W_LABEL, "::Images\\some_icon.bmp",       W_TYPE, SETTINGS,
//--------------------------------------------------------------------------------------------------+

5. ПОСЛЕ ОБЪЯВЛЕНИЯ ОКНА, ЗАВЕРШАЕМ ЕГО КОММАНДОЙ END_WINDOW,
//--------------------------------------------------------------------------------------------------+


//---------------------------------------------------------------------------------------------------
ОБЪЯВЛЕНИЕ ГРУПП ЭЛЕМЕНТОВ:
//---------------------------------------------------------------------------------------------------
1. ВСЕ ЭЛЕМЕНТЫ СУЩЕСТВУЮТ ТОЛЬКО В СВОИХ ГРУППАХ.

2. ВСЕ ГРУППЫ ОБЪЯВЛЯЮТСЯ КОММАНДОЙ GROUP И ОБЯЗАНЫ ИМЕТЬ ИМЯ. (ЕСЛИ ИМЯ НЕСУЩЕСТВЕННО, СТАВИТЬ А. без кавычек)

   GROUP, "Main tabs", или GROUP, A,


3. ВСЕ ГРУППЫ ЗАВЕРШАЮТСЯ КОММАНДОЙ END_GROUP.

4. ПОСЛЕ END_GROUP ПИШЕТСЯ ПОЗИЦИЯ ГРУППЫ И СВОЙСТВА ЭЛЕМЕНТОВ.

5. ГРУППА ОБЯЗАНЫ БЫТЬ ПОЗИЦИОНИРОВАНА. ДЛЯ ЭТОГО ИСПОЛЬЗУЕТСЯ ПРОСТОЙ МЕТОД:

i,(символ группы), AT, (ПОЗИЦИЯ) _Х2 Х, (ТИП ПРИВЯЗКИ)  "name", (ИМЯ ОБЪЕКТА ПРИВЯЗКИ) 0 (ПОПРАВКА) И ТОЖЕ САМОЕ ДЛЯ ОСИ Y. 
//--------------------------------------------------------------------------------------------------+ 
         i, AT, _X2X, "MF", 5, _Y2Y, "MF",5,   ("MF" - ОЗНАЧАЕТ MAIN FRAME ОКНА,  5 - ПОПРАВКА)
//--------------------------------------------------------------------------------------------------+   
       
//--------------------------------------------------------------------------------------------------+
ПРИНЦИПЫ ПОСТРОЕНИЯ ГРУПП:

1. ЖЕЛАТЕЛЬНО, СТРОИТЬ ТАБЛИЧНУЮ РАСКЛАДКУ ЭЛЕМЕНТОВ ВНУТРИ ГРУПП - СТАВИТЬ РАВНОЕ КОЛИЧЕСТВО ЭЛЕМЕНТОВ В РЯДУ, - ОДНАКО, МОГУТ БЫТЬ ИСКЛЮЧЕНИЯ.

2. СТРОКА ОБЪЯВЛЕНИЙ ЭЛЕМЕНТОВ - ЭТО РЯД. (Ряд начинается со знака __,). 

3. КАЖДЫЙ ЭЛЕМЕНТ ОБЯЗАН ИМЕТЬ ИМЯ. ЭТО МОЖЕТ БЫТЬ ИМЯ СОБСТВЕННОЕ ИЛИ АБСТРАКТНОЕ A. ИМЯ СОБСТВЕННОЕ СТАВИТСЯ В КАВЫЧКИ. 

4. ВНУТРИ СТРОКИ ОБЪЯВЛЯЕНИЯ ЭЛЕМЕНТОВ, МОЖНО ПРОПИСЫВАТЬ УСТАНОВКИ ИХ ИНДИВИДУАЛЬНЫХ СВОЙСТВ. 

5. ПРИ УСТАНОВКИ СВОЙСТВ ВНУТРИ СТРОКИ ЭЛЕМЕНТОВ, СВОЙСТВА ПЕРЕЧЕСЛЯЮТСЯ ЧЕРЕЗ ЗНАК _, КОТОРЫЙ ОТСЫЛАЕТ КОНСТРУКТОР К НУЖНОМУ ЭЛЕМЕНТУ. 

__, M_ITEM, "M_ITEM 1", N_LABEL,"::Images\\some_icon.bmp", _,N_COLOR,(int)clrWhite,_,NB_COLOR,(int)clrWhite,_,AB_COLOR,(int)clrWhite, _,KC_TEXT,"Cntrl+Shift",

   В ИТОГЕ ПОЛУЧАЕТСЯ ЦЕПОЧКА СВОЙСТВ. ЕЕ МОЖНО ПЕРЕНОСИТЬ МЕЖДУ ЭЛЕМЕНТАМИ ИЛИ КОПИРОВАТЬ.
   
6. ДЛЯ ЗАДАНИЯ ДИСТАНЦИИ МЕЖДУ ЭЛЕМЕНТАМИ В ГРУППЕ ИСПОЛЬЗУЙТЕ СЛОВА X_GAP, Y_GAP. СТАВЬТЕ ИХ ПОСЛЕ ЗАВЕРШЕНИЯ ГРУППЫ.
//-------------------
   i, X_GAP, 5,
   i, Y_GAP, 5,
//-------------------  
//--------------------------------------------------------------------------------------------------+

 !!! КРАЙНЕ ВАЖНО: ЗАПРЕЩЕНО ДАВАТЬ ЭЛЕМЕНТАМ ОДИНАКОВЫЕ НАЗВАНИЯ ВНУТРИ ОДНОГО ОКНА. 
                   ЗАПРЕЩЕНО ДАВАТЬ ГРУППАМ ОДИНАКОВЫЕ НАЗВАНИЯ ВНУТРИ ОДНОГО ОКНА.
                   
                   ИСПОЛЬЗОВАНИЯ A ВМЕСТО ИМЕНИ НЕ ПРИВОДИТ К СОВПАДЕНИЮ ИМЕН.
                   //----------------------------------------------------------------
                   
 ПРИМЕР ПОСТРОЕНИЯ ГРУППЫ:                   
//--------------------------------------------------------------------------------------------------+
GROUP, A,

__, CHECKBOX, "Checkbox 1",  CHECKBOX, "Checkbox 2", 

__, CHECKBOX, "Checkbox 3",  CHECKBOX, "Checkbox 4",

__, CHECKBOX, "Checkbox 5",  CHECKBOX, "Checkbox 6",

__, CHECKBOX, "Checkbox 7",  CHECKBOX, "Checkbox 8",  

END_GROUP,
//--------------------------
i, AT, _X2X, "MF", 10, _Y2Y, "MF", 10,
i, X_GAP, 30,
i, Y_GAP, 20,
//--------------------------------------------------------------------------------------------------+


!!! НЕ ЗАБЫВАЙТЕ ЗАВЕРШАТЬ ОКНА КОММАНДОЙ END_WINDOW И ГРУППЫ END_GROUP.
 

Example of a simple code:

//----------------------------------------------------------------------------------
NEW_WINDOW,                               //Объявление окна. (Писать ОБЯЗАТЕЛЬНО)

W_NAME, "Demo window 1",                  //Название окна. (Тоже ОБЯЗАТЕЛЬНО)

W_ICON, "::Images\\16x16\\Database.bmp",  //Иконка окна. (Указывать необязательно)

W_TYPE, SETTINGS,                         //Тип окна.(ОБЯЗАТЕЛЬНО)

OOI,                                      //Флаг открытия окна при инициализации.(Указывать необязательно)

MARGINS, 30,30,                           //Правый и нижний отступ рамки окна. (Указывать необязательно)
//----------------------------------------------------------------------------------
GROUP, A,  //Объявление группы элементов. Абстрактное имя (А). Писать обязательно.                           

__, CHECKBOX, "Some checkbox 1",      D_LIST, "Some list 1",              //Ряд 1

__, R_BUTTON, "Some radio button 1",  R_BUTTON, "Some radio button 2",    //Ряд 2


END_GROUP,    //Завершение группы элементов. Ставить обязательно.
//--------------------------
i, AT, _X2X, "MF", 10, _Y2Y, "MF", 10,     //Позиция всех группы элементов в окне относительно левого верхнего края.
i, X_GAP, 30,                              //Промежутки между элементами по оси Х.
i, Y_GAP, 30,                              //Промежутки между элементами по оси Y.  
//----------------------------------------------------------------------------------


GROUP, A,

__,L_ITEM, "L_ITEM  1",       
__,L_ITEM, "L_ITEM  2",
__,L_ITEM, "L_ITEM  3",
__,L_ITEM, "L_ITEM  4",
__,L_ITEM, "L_ITEM  5",
__,L_ITEM, "L_ITEM  6", ON,  //Включаем один из элементов списка по умолчанию.
__,L_ITEM, "L_ITEM  7",
__,L_ITEM, "L_ITEM  8",
__,L_ITEM, "L_ITEM  9",
__,L_ITEM, "L_ITEM  10",
__,L_ITEM, "L_ITEM  11",
__,L_ITEM, "L_ITEM  12",
__,L_ITEM, "L_ITEM  13",
__,L_ITEM, "L_ITEM  14",
__,L_ITEM, "L_ITEM  15",

END_GROUP,
//-------------------------
i, IN,"Some list 1",        //Указание в каком списке будут находиться элементы.
i, AT, LEFT_TOP, 0,0,       //Флаг позиции элементов группы наканвасе(Писать ОБЯЗАТЕЛЬНО)
i, Y_GAP, 2,                //Дистанция между пунктами списка. Есть значение по умолчанию. Можно явно задавать свое.
//----------------------------------------------------------------------------------


END_WINDOW, //(Писать ОБЯЗАТЕЛЬНО)



 
Реter Konow #:

Anything once started has to be finished. Even if nobody needs it. That's the principle.

You do. If the interface can not only be drawn, but used. I hope so.

 
Edgar Akhmadeev #:

Need. If the interface can not only be drawn, but used. Hopefully.

Absolutely. That's what I'm working on.

 
Can this pointless thread be deleted? What's with the Russian code in the German forum? Besides, there is zero added value behind it
 
Is it possible to delete this message? And close the German forum?
 
Hi Pyotr.
Here, by the way, is a serious disadvantage of using names in Russian. It cuts off more than 90% of non-Russian-speaking programmers at once. After all, they see some quasi-labels. Duplicating this branch in several languages is a tough test, of course, for non-Russian speakers.
Looking ahead, can I ask you a couple of questions?
Since your GUI is created without using classes, several uncertainties arise at once.
After all, what, first of all, should be the requirements to the GUI as a product?
It is convenience and intuitiveness of creating a GUI, as well as its convenient use in the process of work.
In this regard:


Question 1

What mechanism is there for a programmer to handle event handling on the part of your GUI?
For example, in my GUIs, when creating a control, I add a pointer to a handler function when a change event occurs on that control.
Example code:

typedef void      (*TFuncSlider)(double);
typedef void      (*TFuncCheckList)(int);
typedef void      (*TFuncButton)(bool);
class Slider {
  ...
  TFuncSlider func;
  ...
}
class CheckList{...}
class CheckBox{...}
class Button{...}
class Menu{
  Slider sliders[];
  CheckList check_list[];
  CheckBox check_boxes[];
  Button buttons[];

..... 

menu.AddSlider(1,3,37.5,52,1.5,"Channel width = ",0,4,k_can,3,true,false,SetWidth,false); // Создание конкретного слайдера при формировании GUI, где SetWidth - указатель на функцию 


.....

void SetWidth(double wid) { // функция обработчик измениения состояния конкретного слайдера, которую пишет программист
   k_can = wid;
   ReDrawPol();
}



Question 2

How can a programmer get access to the state of a particular GUI element?
For example, in my GUI I can get the state of checkbox (bool) like this:
.
if (menu1.check_boxes[ch.N].checked) {
  ....
}
else {
  ....
}

but I use nested classes.
How do you do it?

 
Nikolai Semko control, I add a pointer to a handler function when a change event occurs on that control.
Example code:



Question 2

How can a programmer get access to the state of a particular GUI element?
For example, in my GUI I can get the state of checkbox (bool) like this:

but I use nested classes.
How do you do it?

Nicholas hi!

I'll answer in order:


1. The user DOES NOT (from the word at all) interact with my code. It is not necessary. Further you will understand why. The user needs ONLY the markup language. (I've emphasised this several times before, but I always get this recurring question from programmers. ) The reason is that the user only "initialises" the array using language keywords that are defined by defines in the constructor code. The interpreter (indicator) sends an array with the markup code (the one I showed above) to the constructor (which is the EA on the same chart) and the constructor reads the array and builds the GUI. The markup language code is an instruction for the constructor. It performs construction (drawing, initialisation of element parameters, settings, etc.) according to it.


2. The mechanism is simple. After finishing editing the interface, the user calls the context menu of the constructor by double-clicking on the chart and selects the save option. The constructor prints all the information into two files. These files are used by the engine.

Let me explain in detail: the user connects the two files received from the constructor and the engine (which I will provide) to his EA (in the header of the EA. I will provide an example of connection). Then, writes several calls in the functions OnInit(), OnTimer(), OnChartEvent() and OnDeinit() (I will provide an example). Next, goes into a file printed by the constructor called Internal_API. This file contains everything necessary to connect GUI controls to the Expert Advisor/user indicator. That is - generated functions of the elements and detailed instructions. I will provide connection examples later.

Again, nothing complicated. Everything is there. Here is for example how it looks like with the interface above:

1. Wrote a window.


2. Followed the instructions below:

3.

  • Transfer the two files printed by the constructor to your project.
  • Connect to your Expert Advisor.
  • Write calls of several functions as shown in the picture.


4. Open the InternalAPI file and start the connection. The file contains everything.

//---------------------------------------------------------------------------------------------------------------------------+
//                                              PLEASE READ CAREFULLY                                                        |
//---------------------------------------------------------------------------------------------------------------------------+
//-------------------------------------TO GET OR SET VALUE FOR YOUR VARIABLE-------------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//1. To initialize your variable with this value, type:            variable = ( type of your variable )value;                |
//2. To initialize your variable with some element's value, type:  variable = E_, then, choose element and add ();           |
//---------------------------------------------------------------------------------------------------------------------------+
//---------------------------------------TO GET OR SET VALUE OF THE ELEMENT--------------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//3. To use value of some element, type:                           E_, then, choose element and add ();                      |
//4. To set new value to some element, type:                       E_, then, choose element and add ( type here new value ); |
//---------------------------------------------------------------------------------------------------------------------------+
//-------------------------------------------TO OPEN OR CLOSE A WINDOW-------------------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//5. To open your window, type:                                    W_, then, choose window and add ();                       |
//6. To close your window, type:                                   W_, then, choose window and add (close);                  |
//---------------------------------------------------------------------------------------------------------------------------+
//------------------------------------TO CHANGE A COLOR PROPERTY OF THE ELEMENT----------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//7. To change main color of the element:                          Type E_,then, choose element and add (M_COLOR,your color);|
//8. To change text color of the element:                          Type E_,then, choose element and add (T_COLOR,your color);|
//9. To change frame color of the element:                         Type E_,then, choose element and add (F_COLOR,your color);|
//---------------------------------------------------------------------------------------------------------------------------+
//------------------------------------TO CHANGE READ ONLY PROPERTY OF THE TEXT BOX-------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//10.To change READ ONLY property of the text box:                 Type E_,then, choose element and add (ONLY_READ,0 or 1);  |
//---------------------------------------------------------------------------------------------------------------------------+
//------------------------------------TO CHANGE A STATE PROPERTY OF THE ELEMENT----------------------------------------------+
//---------------------------------------------------------------------------------------------------------------------------+
//11.You can set 6 possible states of the element:        OFF, ON, LOCKED_OFF, LOCKED_ON, OFF_H, ON_H.                       |
//To set a new state of the element:                    Type E_,then, choose element and add (STATE,one of the states above);|
//---------------------------------------------------------------------------------------------------------------------------+
//***************************************************************************************************************************+
//NOTICE: THE COLOR WILL BE SET FOR THE CURRENT STATE OF THE ELEMENT. IF THE STATE CHANGES, THE COLOR WILL CHANGE.           |
//        IN EACH STATE THE ELEMENT CAN HAVE DIFFERENT MAIN, TEXT AND FRAME COLOR. MAKE SURE TO CONSIDER THE STATE           |
//        OF THE ELEMENT, WHEN YOU CHANGE IT'S MAIN, TEXT OR FRAME COLOR.                                                    | 
//---------------------------------------------------------------------------------------------------------------------------+
string DRIVE_MESSAGE_ADRESS = "\Experts\Advisors\MY_VS.1.0.ex5";
//---------------------------------------------------------------------------------------------------------------------------+
//---------------------------------------- 
#define _open                13
#define _close               14
//---------------------------------------- 
#define  on                   1
#define  off                  0
//---------------------------------------- 
#define  pressed              1
#define  released             0
//---------------------------------------- 
#define  checked              1
#define  unchecked            0
//---------------------------------------- 
#define  rare_value "~~`````~```~~~~~`~~~`~"
//---------------------------------------- 
int Params[10000];
//---------------------------------------- 
int par = 0;
//---------------------------------------- 
string i_MSG = NULL;
//---------------------------------------- 
uint Orders[];
//---------------------------------------- 
uint N = 0;
//---------------------------------------- 
#define  Descending  -1
//========================================================================================================= 
#define  CHECKBOX3___Some_checkbox_1               3
#define  D_LIST4___Some_list_1               4
//========================================================================================================= 
void On_Gui_Event(int Element, string value, double Magic = 0)
{
 string action = value, selected_option = value; //DON'T CHANGE THIS LINE
//------------------------------------
 switch(Element)
   {
//=====================================================================================================================
//WINDOW:   Demo window 1 | element: CHECKBOX  | name: Some checkbox 1  |  Location: Window's Main Frame
//=====================================================================================================================
case CHECKBOX3___Some_checkbox_1:
               //------------------------------------------------------------------------------------------------------
               //What to do when checkbox checked or unchecked?
               //------------------------------------------------------------------------------------------------------
               switch((int)action)
               {
                case checked:     break;
  
                case unchecked:     break;
               }
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
//=====================================================================================================================
//WINDOW:   Demo window 1 | element: D_LIST  | name: Some list 1  |  Location: Window's Main Frame
//=====================================================================================================================
case D_LIST4___Some_list_1:
               //------------------------------------------------------------------------------------------------------
               //What to do when option selected?
               //------------------------------------------------------------------------------------------------------
               if(selected_option == "L_ITEM  1"){}
               if(selected_option == "L_ITEM  2"){}
               if(selected_option == "L_ITEM  3"){}
               if(selected_option == "L_ITEM  4"){}
               if(selected_option == "L_ITEM  5"){}
               if(selected_option == "L_ITEM  6"){}
               if(selected_option == "L_ITEM  7"){}
               if(selected_option == "L_ITEM  8"){}
               if(selected_option == "L_ITEM  9"){}
               if(selected_option == "L_ITEM  10"){}
               if(selected_option == "L_ITEM  11"){}
               if(selected_option == "L_ITEM  12"){}
               if(selected_option == "L_ITEM  13"){}
               if(selected_option == "L_ITEM  14"){}
               if(selected_option == "L_ITEM  15"){}
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
   }
}
//=================================================================================================================
//----------------------------------------------------------------------------------------------------------------
string E_Demo_window_1_Some_checkbox_1(string n = rare_value,  int Property = -1){return(GET_N_SET(3,n,Property));}
//----------------------------------------------------------------------------------------------------------------
string E_Demo_window_1_Some_list_1(string n = rare_value,  int Property = -1){return(GET_N_SET(4,n,Property));}
//----------------------------------------------------------------------------------------------------------------
string E__(string n = rare_value,  int Property = -1){return(GET_N_SET(5,n,Property));}
//----------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------
void W_Main_context_menu(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "2" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "2" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Set_Values_Change_Delay(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "3" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "3" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_GEN_Disconnected(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "5" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "5" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Caption_of_GEN_Disconnected(string Caption)
{
 i_MSG += (string)W_CAPTION + "`" + Caption + "`" + "5" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Custom_Context_Menu(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "8" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "8" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Custom_Set_Values_Change_Delay(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "9" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "9" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Demo_window_1(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "10" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "10" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_Caption_of_Demo_window_1(string Caption)
{
 i_MSG += (string)W_CAPTION + "`" + Caption + "`" + "10" + "~";
}
//----------------------------------------------------------------------------------------------------------------
void W_(int action = _open)
{
 if(action == _open)i_MSG += (string)OPEN_WINDOW + "`" + "0" + "`" + "0" + "`" + "0" + "~";
 if(action == _close)i_MSG += (string)CLOSE_WINDOW + "`" + "0" + "`" + "0" + "`" + "0" + "~";
}
//----------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------
int C_Index(int Par){return((int)P_CORE[Par][_COLOMN_]*1000000 + (int)P_CORE[Par][_G_INDEX]);}
//----------------------------------------------------------------------------------------------------------------
//========================================================================================================= 
string GET_N_SET(int Element,  string n, int Property)
{
if(n != rare_value && Property == -1)
  {
   P_CORE[Element][_NEW_VALUE]  = n;
   P_CORE[Element][_LAST_VALUE] = P_CORE[Element][_CURRENT_VALUE];
   P_CORE[Element][_CURRENT_VALUE] = P_CORE[Element][_NEW_VALUE];
   if(n != P_CORE[Element][_LAST_VALUE])i_MSG += (string)_SYNC_P_CORE + "`" + P_CORE[Element][_ELEMENT] + "`" + "0" + "`" + P_CORE[Element][_CURRENT_VALUE] + "~";
   return(P_CORE[Element][_CURRENT_VALUE]);
  }
if(n == rare_value && Property == -1)return(P_CORE[Element][_CURRENT_VALUE]);
if((int)n > 12 && (int)n < 18 && Property > -1)
  {
   if(Property == OFF || Property == OFF_H || Property == LOCKED_OFF)On_Gui_Event(Element,(string)0);
   if(Property == ON  || Property == ON_H  || Property == LOCKED_ON) On_Gui_Event(Element,(string)1);
   if(n != P_CORE[Element][_LAST_VALUE])i_MSG += n + "`" + P_CORE[Element][_ELEMENT] + "`" + "0" + "`" + (string)Property + "~";
  }
return(NULL);
}
//========================================================================================================= 



Theuser only has to write his actions in the conditions of the OnGuiEvent() function. The rest does NOT need to be touched.
.


Switching the state of controls, as well as getting/setting their values is done with the help of functions generated by the constructor, which the user will see in the intellisense.

 

From the file code above, the user is only working with this part:


 
Реter Konow #:

Nicholas, hi!

I'll answer in order:


1. The user WILL NOT (from the word at all) interact with my code. It is not necessary. Next you will understand why. The user needs ONLY the markup language. (I've emphasised this several times before, but I always get this recurring question from programmers. ) The reason is that the user only "initialises" the array using language keywords that are defined by defines in the constructor code. The interpreter (indicator) sends an array with the markup code (the one I showed above) to the constructor (which is the EA on the same chart) and the constructor reads the array and builds the GUI. The markup language code is an instruction for the constructor. It performs construction (drawing, initialisation of element parameters, settings, etc.) according to it.


2. The mechanism is simple. After finishing the interface editing, the user calls the context menu of the constructor by double-clicking on the chart and selects the save option. The constructor prints all the information into two files. These files are used by the engine.

Let me explain in detail: the user connects the two files received from the constructor and the engine (which I will provide) to his EA (in the header of the EA. I will provide an example of connection). Then, writes several calls in the functions OnInit(), OnTimer(), OnChartEvent() and OnDeinit() (I will provide an example). Next, goes into a file printed by the constructor called Internal_API. This file contains everything necessary to connect GUI controls to the Expert Advisor/user indicator. That is - generated functions of the elements and detailed instructions. I will provide connection examples later.

Again, nothing complicated. Everything is there. Here is for example how it looks like with the interface above:

1. We have written a window.


2. Followed the instructions below:

3.

  • Transfer the two files printed by the constructor to your project.
  • Connect it to your Expert Advisor.
  • Write calls of several functions as shown in the picture.


4. open the InternalAPI file and start the connection. The file contains everything.



Theuser only has to specify his actions in the conditions of the OnGuiEvent() function. The rest does NOT need to be touched.


Switching the state of controls and getting/setting their values is done with the help of functions generated by the constructor, which the user will see in the intellisense.

Peter, I don't understand you. You didn't answer the questions.
It is important for programmers to know how to interact with your GUI while working.
Here is an example of my GUI. I clicked the light/dark theme shortcut and this event immediately triggered the function to change background colours and lines. How do you do this interaction?


What does it mean " The user will NOT interact (at all) with my code. "?
The programmer needs to interact, not with the code, but with the events that should generate this code.

After all, GUI is not a separate independent program. The GUI must ultimately interact with the developer's main program. Whether it is an indicator or EA.