Discussion of article "Graphical Interfaces IX: The Progress Bar and Line Chart Controls (Chapter 2)" - page 3

 

Anatol, can you tell me if it is possible to dynamically change the process description in the progress bar?

Suppose we have some array of symbol names. We loop through this array and get the character names. Then each symbol is processed by the programme to get data from it. The overall cycle is displayed by one progress bar, but I would like to display the process of processing each individual symbol. Accordingly, and sign the name of the process "processing CMG", then, when processing the next, already write another name of the process: "processing EQIX", etc.

It is not known in advance what symbols may be in the array - i.e. it will not be possible to prepare a bunch of progress bars, and it is not optimal with more than a thousand names of different symbols....

 
Artyom Trishkin:

Anatol, can you tell me if it is possible to dynamically change the process description in the progress bar?

Suppose we have some array of symbol names. We loop through this array and get the character names. Then each symbol is processed by the programme to get data from it. The overall cycle is displayed by one progress bar, but I would like to display the process of processing each individual symbol. Accordingly, and sign the name of the process "processing CMG", then, when processing the next, already write another name of the process: "processing EQIX", etc.

You don't know in advance what symbols may be in the array - i.e. you can't prepare a bunch of progress bars, and it's not optimal with more than a thousand names of different symbols....

There is no such method now. In the next update I will add this feature for each element that has a text description. That is, it will be possible to change the text after the item is created.
 
Anatoli Kazharski:
Right now there is no such method. In the next update I will add this feature for each element that has a text description. That is, it will be possible to change the text after the item is created.

Thanks, looking forward to it ;)

Question: in your examples you have this code for building a progress bar:

//+------------------------------------------------------------------+
//| Creates a progress bar|
//+------------------------------------------------------------------+
bool CProgram::CreateProgressBar(const int x_gap,const int y_gap)
  {
//--- Save the pointer to the form
   m_progress_bar.WindowPointer(m_window);
//--- Coordinates
   int x=m_window.X()+x_gap;
   int y=m_window.Y()+y_gap;
//--- Set properties before creation
   m_progress_bar.YSize(15);
   m_progress_bar.BarYSize(11);
   m_progress_bar.BarXOffset(65);
   m_progress_bar.BarYOffset(2);
   m_progress_bar.BarBorderWidth(1);
   m_progress_bar.LabelText("Processing:");
   m_progress_bar.AreaColor(C'225,225,225');
   m_progress_bar.BarAreaColor(clrWhiteSmoke);
   m_progress_bar.BarBorderColor(clrWhiteSmoke);
   m_progress_bar.IsDropdown(true);
   m_progress_bar.AutoXResizeMode(true);
   m_progress_bar.AutoXResizeRightOffset(230);
//--- Creating an element
   if(!m_progress_bar.CreateProgressBar(m_chart_id,m_subwin,x,y))
      return(false);
//--- Hide element
   m_progress_bar.Hide();
//--- Add a pointer to the element in the base
   CWndContainer::AddToElementsArray(0,m_progress_bar);
   return(true);
  }
//+------------------------------------------------------------------+

what is the sign of the dropdown element for:

m_progress_bar.IsDropdown(true);

???

 
Artyom Trishkin:

Question: you have this code for building a progress bar in your examples:

what is the purpose of the dropdown element trait:

???

To avoid showing the progress bar when the form is expanded, when it should not be visible.
 
Anatoli Kazharski:
To avoid showing the progress bar when the form is expanded, when it should not be visible.
Does this apply to any objects that can be built with your library?
 
Artyom Trishkin:
Does this apply to any objects that can be built using your library?
Yes. The IsDropdown() method is in the CElement base class and is available for all GUI elements.
 

Dynamically changing progress bar properties does not work.

For example, I wanted to change the colour:

   void              IndicatorColor(const color clr)    { m_indicator_color=clr;           }

Zero response. Apparently, in the Update method, in addition to changing the index and total values, it is necessary to specify the other m_indicator_color and so on. Otherwise these methods are not applied anywhere except during creation. Or was this the way it was intended?

 
Alexander Fedosov:

... Otherwise, these methods don't apply anywhere except at creation. Or was that the way it was intended?

Yes, this is a temporary version. Soon (in the next few articles) there will be massive updates for all controls, where you can change any property at runtime.
 
Anatoli Kazharski:
Yes, this is a temporary version. Soon (in the next few articles) there will be massive updates for all controls, where you can change any property at runtime.

That's excited. In the meantime, I found a temporary solution:

//+------------------------------------------------------------------+
//|| 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 form a 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);
   
   m_indicator.BackColor(m_indicator_color);
   m_indicator.Color(m_indicator_color);
  }
 
172218684:
You all to this gold combat shouting single group 172218684 172218684 , will continue to earn profits, single here shouting Verification - strength is priceless!

Liar