Gallery of UIs written in MQL - page 58

 
A fully functional base version of the engine and builder is a valid and achievable goal. It requires a clear plan and prioritisation. In turn, it means the end of adding big tasks to the plans and the beginning of solving urgent problems.

Let me give an analogy with the construction of a high-rise building. Let's imagine a project where the foreman doesn't know exactly how many floors need to be built. Let's assume that he was not informed. But he is a creator at heart - a creative person. He doesn't care. The bigger the better. He likes tall houses and skyscrapers. While he's working, the construction goes on, floors are added and the building grows to the sky. But the flats can't be handed over to the tenants, because the scaffolding hasn't been removed and the living space hasn't been cleaned. Even the doors are not inserted. The house is unfinished. But for the foreman it is trifles. He's looking up. The sky. And the tenants are waiting impatiently, they need flats.

In general, it's time for the foreman to "change the firmware" and mentally reorganise. Stop building floors and start putting doors in the openings. And finally start cleaning the area, plastering walls, laying parquet and installing chandeliers ....

Let me put it this way: the floors, for now, will not be built. Instead, the floors that have already been built will be finished. The work will be planned in such a way that the house will be handed over to the tenants as soon as possible.

After all, the house was built for them....


 

Hello everyone,

In light of the recent discussion, I would like to propose that we document the results and progress of Peter Konow's project in the "Codebase" rather than on the forum. The forum is excellent for discussions and immediate feedback, but it lacks the structure and coherence needed to present the overall picture and consistent policies of the project.

By using the Codebase, we can ensure that all relevant information is organized, easily accessible, and provides a clear overview of the project's status. This will not only help in maintaining clarity but also in facilitating better collaboration and understanding among all team members and stakeholders.

I would greatly appreciate it if you could consider this suggestion.

 
Yutaka Okamoto project be documented in Codebase rather than on the forum. The forum is great for discussion and immediate feedback, but it lacks the structure and coherence needed to present the big picture and consistent policies of the project.

By using a 'Codebase' we can ensure that all relevant information is organised, easily accessible and provides a clear picture of the project's status. This will not only help maintain clarity, but will also promote better co-operation and understanding between all team members and stakeholders.

I would be very grateful if you would consider this proposal.

It is a very rational suggestion, thank you. Undoubtedly, the codebase is convenient for publishing updates and communicating with users. It's a great addition to the development of the project. Although I have hardly used the codebase in the past, I now see the practical sense in exploring the terms and conditions and adapting to the requirements. To get an idea of the possibilities and limitations of this platform, I will look for projects of well-known members of the community. Taking their example, I will be able to conduct the project in the codebase in an informative and competent way.

 

I have a release scheduled for today.

However, I decided to follow the helpful advice of a forum member and publish the new version in the codebase. To do it right, I will need a few days to study examples of similar publications, to make a plan of parallel running the project on the forum and there. And also to go through moderation.

A few words about this release:

1. Conceptualised and implemented a system of programmatic interaction between a user program and its graphical interface.

More details:

  • After conducting technical tests and analysing the results, it was decided to use element wrapper functions instead of abstract global properties. As it turned out, this is the most effective and simple variant of programme coupling of algorithms with the graphical environment.
  • Additions were made to the functions of project saving and printing of UIDATA.mqh and API.mqh files so that each interactive element of the interface receives a wrapper function automatically when the project is saved.
  • At the same time, the element wrapper functions have got a very small body and their main task is to call the central function, passing three main parameters - element number, value and property value.
  • Theexternal simplicity of the functions does not hinder the versatility of their application:

1. When called with empty brackets, functions return the value of the element parameter with one of three types: int, double, string depending on the type of the element.

     int i    = w6_i_CHECKBOX_Some_checkbox(); //Элемент чекбокс. Буква i  после префикса означает что тип возвращаемого/устанавливаемого значения int.
     
     double d = w6_d_S_EDIT_Spin_the_value();  //Элемент поле ввода с кнопками. Буква d после префикса означает что тип возвращаемого/устанавливаемого значения double.

     string s = w7_s_EDIT_Comment_1();         //Элемент текстовое поле ввода. Буква s означает что тип возвращаемого/устанавливаемого значения string.

2 When called with one value in brackets, the functions set the passed value to the element parameter and then redraw it (the value is set to int, double or string, depending on the element type).

     int i    = w6_i_CHECKBOX_Some_checkbox(0/1/2/3); //Элемент чекбокс. Передача нуля,единицы, двойки или тройки для смены между нейтральным, активированным, нетр.блокир. и актив. блокир. состояниями элемента. 
                                                      //Тот же метод работает для всех кнопок.
     
     double d = w6_d_S_EDIT_Spin_the_value(653.89);   //Элемент поле ввода с кнопками. Передача значения параметра в функцию для установки его в элемент.

     string s = w7_s_EDIT_Comment_1("Any text");      //Элемент текстовое поле ввода. Передача текста для установки в поле ввода.   


3. when called with the default value of the first parameter and a property number (from the available properties), the functions return the value of this property of the element (all property numbers are of type int, passed in the property parametre).

      int i = w6_i_BUTTON_Start(get_i,_A_COLOR); //Элемент Кнопка. Возврат значения цвета из свойства _A_COLOR. Может быть указано другое значение или другое свойство из списка доступных свойств.
                                                                  //Однако, данных тип функции принимает значения только типа int, но может приводить их к другим родственным типам (uint, short, bool...).
                                                                  //Значение первого параметра get_i говорит функции что не нужно принимать значение первого параметра в расчет, а лишь вернуть значение свойства _A_COLOR.


4 . When called withvalue and propertyvalue in parentheses, the functions set the passed values to the available properties of the element. The propertynumber is passed in the property parameter, the property value is passed in thevalue parameter.

     int i = w6_i_BUTTON_Start(C'255,0,0',_A_COLOR); //Элемент Кнопка. Передача и установка польз. значения цвета в свойство _A_COLOR. Может быть указано другое значение или другое свойство из списка доступных свойств.
                                                                      //Однако, тип функции этого элемента принимает значения только типа int, но может приводить их к другим родственным типам (uint, short, bool...).


The structure of function-wrapper names: w6_i_BUTTON_Start();

1. w is the initial letter of all wrapper functions. It is an abbreviation of window.

2. 6 (or other number) - the sequence number of the window containing the element.

3. i (either d or s) - means the type of the returned/set value of the element's parameter.

  • Can be int: for buttons, checkboxes, sliders, input fields with/without buttons, progress bars, chart bars, radio buttons.
  • Can be double: for sliders, input fields with/without buttons.
  • Can be string: for text input fields, for VALUE elements, for table cells, for pop-up lists.


4. BUTTON - name of the element type to which the wrapper function belongs. It can be any other element.

5. Start - name of a specific element.


  • All wrapper functions have an identical name structure.
  • I repeat: all functions are printed automatically.

//----------------------------------------------------------------------------------------------------

Smart application of the intellisense system:

It was decided to use a special prefix system that helps to quickly search and find the necessary functions-wrappers of windows and elements. Here is an example:

All window and element wrapper functions have the letter w at the beginning. However, if you put a lower dash after w: _ an intellisense window opens with a list of names of all UI window functions. Next, you need to find the window with the name you are looking for in the list, look at its number (it is printed in the function name) and erase the dash and put this number after w. The list of intellisense with the names of functions of elements included in the window will appear at once. Here is how it is done:

This is a simple way to quickly navigate through the list of element wrapper functions. You don't even need to print them.

//----------------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------------

Also, changes and additions were made to the API file. Now more information about the element and window is available to the user:

 switch(Element)
   {
//=====================================================================================================================
//WINDOW:       Settings example 1 | #: 6 | PFX: w_6 | GET/SET: int w_6_Settings_example_1(int value = get_i, int Property = 0)
//---------------------------------------------------------------------------------------------------------------------
//ELEMENT:      BUTTON
//NAME:         Start
//PARAMETER:    int
//INIT STATE:   OFF
//LOCATION:     Location: Window's Main Frame
//---------------------------------------------------------------------------------------------------------------------
//GET/SET:   int w6_i_BUTTON_Start(int value = none, int Property = 0)      | PFX: w6
//=====================================================================================================================
  
case Settings_example_1___Start:
  
               //------------------------------------------------------------------------------------------------------
               //What to do when button pressed or released?
               //------------------------------------------------------------------------------------------------------
               switch((int)action)
               {
                case pressed:  Alert("BUTTON Start pressed!");   break;
  
                case released:  Alert("BUTTON Start released!");   break;
               }
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
//=====================================================================================================================
//WINDOW:       Settings example 1 | #: 6 | PFX: w_6 | GET/SET: int w_6_Settings_example_1(int value = get_i, int Property = 0)
//---------------------------------------------------------------------------------------------------------------------
//ELEMENT:      CHECKBOX
//NAME:         Set an option
//PARAMETER:    int
//INIT STATE:   OFF
//LOCATION:     Location: Window's Main Frame
//---------------------------------------------------------------------------------------------------------------------
//GET/SET:   int w6_i_CHECKBOX_Set_an_option(int value = none, int Property = 0)      | PFX: w6
//=====================================================================================================================
  
case Settings_example_1___Set_an_option:
  
               //------------------------------------------------------------------------------------------------------
               //What to do when checkbox checked or unchecked?
               //------------------------------------------------------------------------------------------------------
               switch((int)action)
               {
                case checked:  Alert("CHECKBOX Set_an_option pressed!");   break;
  
                case unchecked:  Alert("CHECKBOX Set_an_option released!");   break;
               }
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
//=====================================================================================================================
//WINDOW:       Settings example 1 | #: 6 | PFX: w_6 | GET/SET: int w_6_Settings_example_1(int value = get_i, int Property = 0)
//---------------------------------------------------------------------------------------------------------------------
//ELEMENT:      CHECKBOX
//NAME:         Set another option
//PARAMETER:    int
//INIT STATE:   OFF
//LOCATION:     Location: Window's Main Frame
//---------------------------------------------------------------------------------------------------------------------
//GET/SET:   int w6_i_CHECKBOX_Set_another_option(int value = none, int Property = 0)      | PFX: w6
//=====================================================================================================================
  
case Settings_example_1___Set_another_option:
  
               //------------------------------------------------------------------------------------------------------
               //What to do when checkbox checked or unchecked?
               //------------------------------------------------------------------------------------------------------
               switch((int)action)
               {
                case checked:  Alert("CHECKBOX Set_another_option pressed!");   break;
  
                case unchecked:  Alert("CHECKBOX Set_another_option released!");   break;
               }
               //------------------------------------------------------------------------------------------------------
               //Your comment:
               //------------------------------------------------------------------------------------------------------
               break;
  
//=====================================================================================================================
//WINDOW:       Settings example 1 | #: 6 | PFX: w_6 | GET/SET: int w_6_Settings_example_1(int value = get_i, int Property = 0)
//---------------------------------------------------------------------------------------------------------------------
//ELEMENT:      D_LIST
//NAME:         D_LIST 1
//PARAMETER:    string
//INIT OPTION:  L_ITEM  1
//LOCATION:     Location: Window's Main Frame
//---------------------------------------------------------------------------------------------------------------------
//GET/SET:   string w6_s_D_LIST_D_LIST_1(string value = get_s, int Property = 0)      | PFX: w6
//=====================================================================================================================
 
I hope to try these features soon.
 
hini #:
I hope to try these features soon.
I will upload the new version to codobase tomorrow evening.
 
Late night release.
 

I present a version of the engine programmatically interacting with the GUI.

I have done a lot. There is something to tell and show.

After public testing I will upload it to the codebase.

An interesting thing has turned out...

More details tomorrow.

Files:
4uh38_06.08.24.zip  1712 kb
 

A little bit ahead of time, I can say that I have found a very convenient solution for users. Inside their code they can easily navigate through windows, elements and properties. The solution allows them not to remember the names of elements or properties, but to easily find and work with them. At the same time, each element has a list of get/set properties available only to it and "related" elements. With the prefix embedded in the element's function name, the user calls it and will never make the mistake of trying to return or set a property that the element doesn't have.

The wrapper functions turned out to be so versatile and easy to use that I am surprised myself. Return the value of a parameter when the brackets are empty, set when the value is one, return the value of a property from a list when the first parameter is empty and the property index is in the second. They set a value to a property when there is a value in the first parameter and a property index in the second. They also return a result notification as 1 on success, and -1 on error (invalid value or property). The functions redraw the elements themselves. You don't need to take care of this.

What you can do with wrapper functions:

1. Get the value of the element parameter.

2. Set the value of an element parameter.

3. Get values of element properties from the individual list of properties belonging to its type of elements (called by the prefix written in the function name).

4. Set values of element properties from the same list.

5. Set the state of the element: neutral, activated, (on/off), blocked neutral, blocked activated.

6. Returns the current state of the element.


In the first case the function returns the value of the parameter.

In the second case it returns the result: successful or error. The error is output to the log.

In the third case, it returns the value of the property.

In the fourth - result: success or error of setting the property.

In the fifth, returns 1 or -1.

In the sixth - returns the element's state index (details below).


Everything is done by one wrapper function that is printed automatically. To find it, type w_, the list of intellisense will open, it contains the names of windows. In one of them is the element you are looking for. You need to remember roughly which window it is in. Then, erase the devil and type the window number and select the one you need from the list of items. No memorisation.

You don't need to remember the properties of the elements either. Look at the feature name, see the prefix to open a list of individual properties. Type it in, open it, select the property. You don't need to remember anything at all. No typing either. Intellisense does everything.

Windows have their own wrappers too. They can open and close them. The rest of the features have not been implemented yet.


Did a big upgrade to the API file. It now has a HUGE amount more useful information about the element. Namely: prefixes, individual properties, prototypes of the element wrapper function and its window, the exact location of the element (table, canvas and tab to which the element belongs, if any), the type of its parameter (int, double, string...), the properties of its parameter (min.value, max.value, step, number of digits after the decimal point) are printed. Initial value or selected option (depending on the element). Everything is designed quite readable and understandable.

I have partially tested the new functionality and I am satisfied with it. Everything works as intended.

Tomorrow I will show it in practice.

 
The directory is still in Russian ...... I hope it's possible to have the directory and filenames in English like KIB PROJECTS ...... This is a small request from me!