Discussion of article "Graphical Interfaces IV: Informational Interface Elements (Chapter 1)"

 

New article Graphical Interfaces IV: Informational Interface Elements (Chapter 1) has been published:

At the current stage of development, the library for creating graphical interfaces contains a form and several controls that can be attached to it. It was mentioned before that one of the future articles would be dedicated to the multi-window mode. Now, we have everything ready for that and we will deal with it in the following chapter. In this chapter, we will write classes for creating the status bar and tooltip informational interface elements.

A status bar is one of the informational elements of the graphical interface. This element is used for a quick entry of important data, details, values, etc.

In this article, we are going to create a simple status bar without an option of attaching context menus to its items. Similar to other interface elements, a status bar will be composed of several primitive objects:

  • Background.
  • Items.
  • Separation lines.

Fig. 1. Compound parts of the status bar element.

Fig. 1. Compound parts of the status bar element.


If everything was done correctly, you should get the result as shown in the screenshot below:

Fig. 2. Test of the status bar element.

Fig. 2. Test of the status bar element.

We have completed developing the class for creating the status bar element. The complete version of the class can be found in the files attached to this article. 

Author: Anatoli Kazharski

 
Anatoly, great series of articles, and relevant. Could you: 1. Publish a list of previous articles at the beginning of each article. The search on the site does not always rule correctly) 2. Do some sum of knowledge in the form of an example. No need to chew it up, I think, who reads your articles - will understand. But it would be interesting to see the fun result at once. 3. Good luck, I'm looking forward to the continuation)
 
Alexey Volchanskiy:
Anatoly, excellent series of articles, and relevant. Could you please: 1. Publish a list of previous articles at the beginning of each article. The search on the site does not always rule correctly) 2. Do some sum of knowledge in the form of an example. No need to chew it up, I think, who reads your articles - will understand. But it would be interesting to see the fun result at once. 3. Good luck, I look forward to continuing)

Thank you.

You can write a separate article later, in which as an example you will create an application with a graphical interface with all the library controls. And already in this article make the full content with links to all articles. This option will be convenient for those who just want to use the library in their MQL-applications without going into how it is organised.

 
Anatoli Kazharski:

Thanks.

You can write a separate article in which you create a GUI application with all the library controls as an example. And already in this article make full content with links to all articles.

+1
 
Rashid Umarov:
Deal. )
 
MetaQuotes Software Corp.:

New article Graphical Interfaces IV: Informational Interface Elements (Chapter 1) has been published:

Author: Anatoli Kazharski

Awesome! Thanks Anatoli.
 

Hello~ I have loaded the template you provided for testing, but I get an error

Description: 'return'-cannot convert from const pointer to nonconst pointer

File:SplitButton.mqh

What can I do to fix this?

 

Tol, I haven't looked at the last two versions, but before them there is a bug in CCtatusBar:

If the status bar m_status_bar.ValueToItem() is being updated in the timer, then if the main window is minimised, the status bar hangs on the chart all the time - it is not minimised. I have to constantly monitor in my CProgram in this way:

if(m_status_bar.IsDropdown()) { m_status_bar.ValueToItem(....); }

To fix it, you need to add such a check in CCtatusBar in the ValueToItem() method:

//+------------------------------------------------------------------+
//| Sets the value at the specified index ||
//+------------------------------------------------------------------+
void CStatusBar::ValueToItem(const uint index,const string value)
  {
//--- Check for out of range
   uint array_size=::ArraySize(m_items);
   if(array_size<1 || m_wnd.IsMinimized())
      return;
//--- Adjust index value if out of range
   uint correct_index=(index>=array_size)? array_size-1 : index;
//--- Setting the transmitted text
   m_items[correct_index].Description(value);
  }
//+------------------------------------------------------------------+

Then everything will be fine, and you don't have to constantly remember about it and control it in your programme.

 
Artyom Trishkin:

...

If the status bar m_status_bar.ValueToItem() is being updated in the timer, then if the main window is minimised, the status bar hangs on the chart all the time - it is not minimised.

...

Checked. Almost all the test examples from the articles have a status bar with an update in the timer. The described behaviour is not reproduced.
 
Anatoli Kazharski:
Check. Almost all test examples from the articles have a status line with an update in the timer. The described behaviour is not reproduced.

You know, I wanted to record a video of how it works, but alas, after returning to your version of ValueToItem(), I also lost this behaviour. But it was there... Maybe because the market is closed now....

I'll leave it the way I suggested - so that I don't run into this bug again somewhere, sometime.

 

I'm trying it on 4.
Behaviour is standard.
I'll take this opportunity to ask:
how can icons be used in the status bar?

Like a connectionindicator or something...
)