You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Pyotr, 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 the code should generate.
Good. I'll try to use only pictures for clarity.
1.
2.
3.
4.
Our options sheet and the checkbox in the window and the Internal_API file:
5. Performing actions on the window and items in the user code:
6.
INTELLISENSE TELLS US EVERYTHING!!!
Using web development as an example.
Because your GUI is written using the markup language you created. Web development also has its own markup language (HTML) and style language (CSS).
If you have created a web site only in HTML, you can create controls in pure html. Here is an example with checkbox.
But in this case the site will be dead, because nothing will happen when controls are working.
To make something happen, you need to put a handler for each event using JavaScript and the addEventListener function
Here is an example of such a handler: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_addeventlistener4
My main question can be rephrased: How do you implement for the programmer the event handler generated by GUI when the user works. I.e. what is your analogue of addEventListener ?
As I said, I have it implemented through the fact that when the GUI is generated programmatically, each control is assigned its own event handler function using a pointer to a function.
OK. I'll try to ask a different question.
Using web development as an example.
Because your GUI is written using the markup language you created. Web development also has its own markup language (HTML) and style language (CSS).
If you have created a web site only in HTML, you can create controls in pure html. Here is an example with checkbox.
But in this case the site will be dead, because nothing will happen when controls are working.
To make something happen, you need to put a handler for each event using JavaScript and the addEventListener function
Here is an example of such a handler: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_addeventlistener4
My main question can be rephrased: How do you implement for the programmer the event handler generated by GUI when the user works. I.e. what is your analogue to addEventListener ?
As I said, I have it implemented through the fact that when the GUI is generated programmatically, each control is assigned its own event handler function using a pointer to the function.
Nicholas, everything works. You will try it yourself later. Everything is much simpler than you think. I have made many working interfaces using this technology. So... You'll see soon enough.
Nikolai, it's working. You'll try it yourself later. It's much simpler than you think. I have made many working interfaces using this technology. So... You'll see soon enough.
Okay. I'll be waiting. I really want to understand your Creation.
However, to make it easier to understand by example, please create a simple empty indicator (or Expert Advisor), in which your GUI is connected in the form of a separate button, when you press it, the background colour of the window changes from black to white and from white to black. It is only desirable that the colour change takes place in the indicator body, and not in one of the connected files. Because the programmer really should not get into your code.
For simplicity of writing here is the code of the function that should be executed in the program body when the button is pressed:
Okay. I will wait. I really want to understand your Creation.
However, to make it easier to understand by example, please create a simple empty indicator (or Expert Advisor), in which your GUI is connected in the form of a separate button, when you press it, the background colour of the window changes from black to white and from white to black. It is only desirable that the colour change takes place in the indicator body, and not in one of the connected files. Because the programmer really should not get into your code.
For simplicity of writing here is the code of the function that should be executed in the program body when the button is pressed:
Ok. I will make the simplest possible implementation for understanding. No frills).
Okay. I'll make the simplest possible implementation for understanding. No frills).
Great! Thank you.
Nikolay, I can't write a function call inside the indicator body, because its handler is inside the file Internal_API.mqh.
That is, I can call your function on the event of pressing the button from its handler in this file. However, I can set the button states programmatically from the indicator body on the timer event, for example. But then I don't need to press the button. In short, there are different elements. Some of them can be handled inside the indicator body (mostly non-interactive elements, like progress-bar, for example) and there are those that have a handler in the file Internal_API.mqh and work from there. Although their states can be set programmatically from the EA/indicator body.
Your task is completed. (if white square - click)
Code:
Commented out your function because the compiler was swearing. I made it simpler.
Here is the code in the file Internal_API.mqh
By the way, you should add:
Internal_API.mqh file contains control handlers and is SPECIFICLY designed to connect them.
This file is intended for the user and is not part of the engine or any of my other code.
This file is intended for the user and is not part of the engine or any of my other code.
I see, Peter. Thanks.
It is not convenient, of course, for a developer. There is a lot of unnecessary code and movements.
Still, the variant with a pointer to a function is much better.