Discussion of article "How to create a graphical panel of any complexity level" - page 2

 

What is the best way to code in a panel

Spread:  x.x

Where Spread is a label (not changed) and x.x is actual spread which need to be updated on every tick?

 
Eric Bel :

What is the best way to code in a panel

Spread:  x.x

Where Spread is a label (not changed) and x.x is actual spread which need to be updated on every tick ?

Your question is not clear. Are you asking exactly on the materials of the article?

 
Vladimir Karputov:

Your question is not clear. Are you asking exactly on the materials of the article?

Yes Vladimir,

I want to use the panel with the buttons to trade and it is clear how buttons are working.

Spread                                      3.0 (needs update OnTick)

Button 1     Button 2    

How to code Label spread onTick in the best way so that the label is updated ?

Thank you for help!

                        

 
Eric Bel :

Yes Vladimir,

I want to use the panel with the buttons to trade and it is clear how buttons are working.

Spread                                      3.0 (needs update OnTick)

Button 1     Button 2    

How to code Label spread onTick in the best way so that the label is updated ?

Thank you for help!

                        

Excuse me. I can not understand your thought. I see words, but I do not see thoughts.

 

Vladimir, it is possible to easy for you ;-)

I try to explain my question.

How to add a textlabel to the panel that is updated on every tick. For example, spread or bid price?

thanks.

Eric

 
Eric Bel :

Vladimir, it is possible to easy for you ;-)

I try to explain my question.

How to add a textlabel to the panel that is updated on every tick . For example, spread or bid price?

thanks.

Eric

1. When creating a panel, add a text label object ( CLabel ) to the panel.

2. In the program body, update the trading environment and get data (Bid price, Ask, etc.)

3. Send data to the object text label (in the panel, you must provide a method)

 

Hello Vladimir, great article. 

Is it possible to determine the number of created buttons by the program parameters?

In your code, each button is declared as a separate object in the class header, for example:

CButton              m_button1;                       // the button object
CButton              m_button2;                       // the button object

What if the number of needed buttons in the program isn't constant?



 
Zbigniew Sobczyk:

Hello Vladimir, great article. 

Is it possible to determine the number of created buttons by the program parameters?

In your code, each button is declared as a separate object in the class header, for example:

What if the number of needed buttons in the program isn't constant?



CArrayObj

Dynamic array of CObject pointers

 
Vladimir Karputov:

CArrayObj

Dynamic array of CObject pointers

Thx for express answer. Can you explain a bit how to implement it in the program?

I initialize CArrayObj *array_obj  as private object and modify CreateButton function. Then I try to add new buttons as follows:

   array_obj=new CArrayObj;
   array_obj.Add(new CButton);
   array_obj.Add(new CButton);
   array_obj.Add(new CButton);
   int x=INDENT_LEFT;
   int y=INDENT_TOP;
   for(int i=0;i<3;i++)
     {
      x=INDENT_LEFT+i*(BUTTON_WIDTH+CONTROLS_GAP_X);
      CButton *button=array_obj.At(0);
      if(!CreateButton(button,"Button1",x,y,false))
         return(false);
     }

But this results in a runtime error.

 

When placing a Panel into these control objects, such as in the example code ControlsPanel.mq5 (given here : https://www.mql5.com/en/docs/standardlibrary/controls/cpanel ) minimizing then restoring the panel resizes all panels to be the same size as the control;

On Startup:

https://www.mql5.com/en/charts/10905636/nzdjpy-h1-go-markets-pty

After Minimize/Restore:

https://www.mql5.com/en/charts/10905637/nzdjpy-h1-go-markets-pty

Is there any way to avoid this or is nesting Panels impossible, despite the implication of the documentation?

Documentation on MQL5: Standard Library / Panels and Dialogs / CPanel
Documentation on MQL5: Standard Library / Panels and Dialogs / CPanel
  • www.mql5.com
//|                                                ControlsPanel.mq5 | //|                        Copyright 2017, MetaQuotes Software Corp. | //|                                             https://www.mql5.com | //| defines                                                          |  INDENT_LEFT                         (11)      ...