Classes for creating panels and dialogues - page 3

 
Slawa:

What are the symptoms?

Dimitri needs the indicator's GUI, which is in a sub-window (indicator_separate_window), to be created in the main chart window.
 
Dmitry Fedoseev:
So

Anyway, I've got a little problem too. ) This mode, i.e."indicator in a subwindow and its GUI in the main chart window", had not been tested in my library before and now there is a small bug that made it impossible to delete the indicator by pressing the close button and also there is a conflict in determining the subwindow number after placing/deleting other indicators in subwindows, which led to incorrect event handling in some cases.

I will refine the library for this mode, but a little later and this will be available in a future version. This will take some time, as we need to carefully test everything in different situations.

As an alternative I can suggest the following from what has already been tested and works. You can place the indicator bar in the indicator subwindow in various ways. There are several modes in which you can minimize the panel (1) together with the indicator subwindow, or (2) only the panel without touching the indicator subwindow, as shown in the screenshots below. The subwindow can be (1) fixed height or (2) free to be resized manually. But even in this case there is one limitation. There can only be one MQL-application with graphical interface on the graph. Otherwise, there will be conflicts.

//---

If the suggested options are suitable, I will prepare templates. If not, then, unfortunately, I can't help you with that.

Files for tests are in the archive:

Files:
Test.zip  8 kb
 
Slawa:

Nothing is glitchy. What are the symptoms?

I've just tried it. First the indicator in the subwindow. Then the panel on the chart. Then a similar panel in the subwindow. The only thing I saw was SimplePanel2 in the first subwindow. But it doesn't affect the operation. All the buttons pressed correctly.

The only thing that distinguishes SimplePanel2 from SimplePanel is the indicator_chart_window property

Tried redoing SimplePanel for graph window, also works fine. Both work, in subwindow and on the chart and when the subwindow is a normal indicator. But when both SimplePanel (on the price chart and in a subwindow), then when I run a standard indicator in a subwindow, the panel that is on the price chart glitches - the window is minimized, when I try to expand it, it unfolds for a moment and then minimizes again.

Mine glitches when adding a standard indicator to the subwindow. Here's the code of the included file:

#include <Controls\Dialog.mqh>
#include <Controls\Edit.mqh>
#include <Controls\ComboBox.mqh>
#include <Controls\Label.mqh>

#define INDENT 11
#define LINE   20

class CPanTest:public CAppDialog{
   protected:
      CComboBox         m_cmb_main;
      CEdit             m_edit1;
      void OnMainEvent(){
      }    
      void OnControlEvent(){
      }        
   public:
      bool Create(){
         if(!CAppDialog::Create(0,"name",0,20,20,200,300)){
            return(false);  
         }
         return(true);    
      }  
      bool OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
};

EVENT_MAP_BEGIN(CPanTest)
   ON_EVENT(ON_CHANGE,m_cmb_main,OnMainEvent)
   ON_EVENT(ON_END_EDIT,m_edit1,OnControlEvent)
EVENT_MAP_END(CAppDialog)

Indicator:

#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

#include <CPanTest.mqh>

CPanTest * pan;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(){
   pan=new CPanTest();
   if(!pan.Create()){  
      return(INIT_FAILED);
   }
   if(!pan.Run()){
     return(INIT_FAILED);  
   }  
   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason){
   pan.Destroy();
   delete(pan);
}  

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   return(rates_total);
}

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   pan.ChartEvent(id,lparam,dparam,sparam);
}
 
Anatoli Kazharski:

Anyway, I've got a little problem too. ) This mode, i.e."indicator in a subwindow and its GUI in the main chart window", had not been tested earlier in my library and now there is a small bug that made it impossible to delete the indicator by pressing the close button and also there is a conflict in determining the subwindow number after placing/deleting other indicators in subwindows, which led to incorrect event handling in some cases.

I will refine the library for this mode, but a little later and this will be available in a future version. This will take some time, as we need to carefully test everything in different situations.

As an alternative I can suggest the following from what has already been tested and works. You can place the indicator panel in the indicator subwindow in various ways. There are several modes in which you can minimize the panel (1) together with the indicator subwindow, or (2) only the panel without touching the indicator subwindow, as shown in the screenshots below. The subwindow can be (1) fixed height or (2) free to be resized manually. But even in this case there is one limitation. There can only be one MQL-application with graphical interface on the graph. Otherwise, there will be conflicts.

//---

If the suggested options are suitable, I will prepare templates. If not, then, unfortunately, I can't help you with that.

Files for tests are in the archive:

Let it be in the podoc. It should hang freely in subwindow, collapse independently of subwindow, and subwindow can be scaled.
 
Dmitry Fedoseev:
Let it be in subwindow. The subwindow should hang freely in the subwindow, collapse independently of the subwindow, and the subwindow should be scalable.

There is a template file in the archive. If you have any questions, I'll answer them.

Files:
Test.zip  4 kb
 
Anatoli Kazharski:

There is a template file in the archive. If you have any questions, I'll answer them.

There's been a mix-up:

 
Dmitry Fedoseev:

There's been a mix-up:

Oh, I've already got the changes going on for the next version. I'm just making it all coherent. )

Corrected for the version from the last article. One more try.

Files:
Test.zip  4 kb
 
Anatoli Kazharski:

Oh, I've already got the changes going on for the next version. Bringing everything back to the same. )

Corrected for the version from the last article. One more try.

Eh... some more... Now a lot of errors about missing resources.
 
Dmitry Fedoseev:
Eh... some more... Now there are a lot of errors about missing resources.
All the resources used in the library are attached to the last article in the series. What are the log messages?
 
Anatoli Kazharski:
All resources used in the library are attached to the last article in the series. What are the messages in the logbook?
Messages about missing resources.