Discussion of article "Graphical Interfaces IX: The Progress Bar and Line Chart Controls (Chapter 2)"
Super!
From my point of view, now you are definitely ahead of all MQL graphics developers.
I have concluded for myself that I have something to aspire to.
The result is amazing!
Good luck in further development.
Super!
From my point of view, now you are definitely ahead of all MQL graphics developers.
I have concluded for myself that I have something to aspire to.
The result is amazing!
Good luck in further development.
There is always something to strive for. )
Here, look at the works of the master, which will inspire you even more: Yuri Kulikov >>>>
There is always something to strive for. )
Here is a look at the master's works that will inspire you even more: Yuri Kulikov >>>.
Thank you, really impressive!
You know, I wanted to ask you a question...
You created your project using OOP. You have implemented almost all the basic controls. You have created a rich library...
At the same time, how much of the code you have already used in your work?
For example, how much did you use the library of controls in MT, Canvas, etc...?
Personally, I had to create everything from scratch and on a completely new technology, in which it was impossible to use already worked out things.
In the future, the development of my project will also not be continued by other developers and they will not be able to participate in its development, because the technology is not familiar to anyone but me.
In your case, it's the opposite... All programmers will be able to take part in improving and developing your library.
And the only thing that can prevent it is laziness.
At the same time, how much of the code you have already used in your work?
For example, how much did you use the library of controls in MT, Canvas, etc...?
In the first article of this series, I answered this question: GUIs I: Preparing the Library Structure (Chapter 1). There it shows the structure of the standard library classes for working with standard graphical object-primitives.
The list of classes I use in the project is:
- CChartObjectRectLabel - rectangular label.
- CChartObjectEdit - input field.
- CChartObjectLabel - text label.
- CChartObjectBmpLabel - graphic label.
- CChartObjectButton - button.
- CCanvas - provides creation of a graphic resource (with or without binding to a chart object) and drawing of graphic primitives.
Ideally, there should be only one class left - CCanvas. A useful topic on this subject is here: Doing a crowdsource project on Canvas >>>
Before I started development, I studied the standard library for creating graphical interfaces and Dmitry Fedoseev's version. Then I made a list of what I personally lack and started working on the project. The list of what needs to be done is still quite large and is constantly being updated with suggestions from other interested users. It's just that it's all happening mostly in personal correspondence. We are also working on the bugs and errors that are gradually revealed when using the library in our projects.
The only thing that can prevent this is laziness.
There are no problems with it. )
In the first article in this series, I answered this question: Graphical Interfaces I: Preparing the Library Structure (Chapter 1). There it shows the structure of classes of a standard library for working with standard graphical primitive objects.
The list of classes I use in the project is:
- CChartObjectRectLabel - rectangular label.
- CChartObjectEdit - input field.
- CChartObjectLabel - text label.
- CChartObjectBmpLabel - graphic label.
- CChartObjectButton - button.
- CCanvas - provides creation of a graphic resource (with or without binding to a chart object) and drawing of graphic primitives.
Ideally, there should be only one class left - CCanvas. Useful topic on this subject: Doing a crowdsource project on Canvas >>>
Before I started development, I studied the standard library for creating graphical interfaces and Dmitry Fedoseev's version. Then I made a list of what I personally lack and started working on the project. The list of what needs to be done is still quite large and is constantly being updated with suggestions from other interested users. It's just that it's all happening mostly in personal correspondence. I'm also working on bugs and errors that are gradually revealed when using the library in my projects.
There are no problems with that. )
Thank you for the detailed answer. )
I wish you further productive work.
Anatoly, I apologise for being intrusive, but I would like to know how it is possible to update the progress bar inside a loop with heavy calculations.
For example, we have a progress bar m_progress_bar, we have a loop inside CProgram
m_progress_bar.Show(); // is pointless, as it is already visible immediately when showing the window (m_window.Show()) to which it is bound, // and I would like to create it in a hidden state, and show it when it is needed int total=1000; // a certain number of loop iterations, which you want to display with the progress bar for(int i=0;i<total;i++) { Func(); // Function with heavy calculations at each iteration of the loop m_progress_bar.Update(i,total); // does nothing: the progress bar is in "hung" - its initial state. } //--- the progress bar should be hidden when the cycle is complete, //--- and in this situation it is not updated during the loop and then hidden by overlaying it with another object m_progress_bar.Hide(); // does not hide the progress bar for some reason, I have to hide it under another graphical object.
Could you explain on such an "abstract" example what I don't understand?
It wouldn't hurt to pass on some data.
What about this?
m_progress_bar.Update(i,total);
How about this?
It doesn't work.
Why not?
//+------------------------------------------------------------------+ //|| Updates the progress bar| //+------------------------------------------------------------------+ void CProgressBar::Update(const int index,const int total) { //--- Set new index CurrentIndex(index); //--- Set new range StepsTotal(total); //--- Calculate the width of the indicator double new_width=(m_current_index/m_steps_total)*m_bar_bg.XSize(); //--- Adjust if less than 1 if((int)new_width<1) new_width=1; else { //--- Adjust for the width of the frame int x_size=m_bar_bg.XSize()-(m_bar_border_width*2); //--- Correct if out of bounds if((int)new_width>=x_size) new_width=x_size; } //--- Set a new width for the indicator m_indicator.X_Size((int)new_width); //--- Calculate the percentage and generate the string double percent =m_current_index/m_steps_total*100; string desc =::DoubleToString((percent>100)? 100 : percent,m_digits)+"%"; //--- Set the new value m_percent.Description(desc); } //+------------------------------------------------------------------+

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Graphical Interfaces IX: The Progress Bar and Line Chart Controls (Chapter 2) has been published:
The second chapter of the part nine is dedicated to the progress bar and line chart controls. As always, there will be detailed examples provided to reveal how these controls can be used in custom MQL applications.
Let's list all the components used for creating a progress bar in the developed Library.
Fig. 1. Components of the progress bar control.
Author: Anatoli Kazharski