Is that possible? - page 8

 
Vitaly Muzichenko #:

Somewhere on the forum a full working code on mql4 and mql5

Wrote it about a year ago.

In which thread, or how do you search?

 
Andrey Sokolov #:

In which topic, or how do you search?

Here's the big question with the primitive site search, otherwise I would have found it myself.

 
Probably this one?
 
Vasiliy Pushkaryov #:
I guess this is it?

Thank you

 
Andrey Sokolov #:

Thank you

There's a revised version and the source in the very last post of this thread
 
Andrey Sokolov #:

Hello, could you please show me how you did it?

Output the data from the array to Labels in the Scroll Bar client area at an offset equal to the offset of this Scroll Bar. You can use CScrollV from the standard library as the Scroll Bar. Array - a list with all items. Labels - area to display items from the list. What is so complicated there...? If desired, any programmer who is familiar with OOP can do it.

 
Mihail Matkovskij #:

Output the data from the array to Labels in the Scroll Bar client area at an offset equal to the offset of this Scroll Bar. You can use CScrollV from the standard library as the Scroll bar. Array - a list with all items. Labels - area to display items from the list. What is so complicated there...? If desired, any programmer, who is familiar with OOP can do it.

Have you dealt with scrolling from SB? I somehow couldn't get it to work separately on the chart, without the client panel. If i had a question, i may ask how to make it work in real time.

Forum on trading, automated trading systems and strategy tester

How to create a graphic panel of any complexity and how it works".

Vasiliy Pushkaryov, 2021.12.21 10:12

I am trying to create a vertical scroll bar without any link to the panel, just on the chart, but it does not work.

For example with checkbox this code gives reaction on mouse click. The checkbox appears and disappears.

#include <Controls\CheckBox.mqh>
CCheckBox Chbox;
//+------------------------------------------------------------------+
void OnInit()
{
  Chbox.Create(0, "MyCheckBox", 0, 20, 20, 100, 40);
  ChartRedraw();
}
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{
  Chbox.OnEvent(id, lparam, dparam, sparam);
}
//+------------------------------------------------------------------+


But with vertical scroll - no reaction to mouse clicks.

#include <Controls\Scrolls.mqh>
CScrollV Scroll;

void OnInit()
{
  Scroll.Create(0, "MyScrollV", 0, 20, 20, 40, 200);
  ChartRedraw();
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
{
  Scroll.OnEvent(id, lparam, dparam, sparam);
}
//+------------------------------------------------------------------+

Please advise, who knows how to make this combined element work on the chart?


 
Vasiliy Pushkaryov #:

Have you dealt with the scrolling from the SB? For some reason I couldn't get it to work separately on the chart, without the client panel. Maybe you can help?


There are a lot of nuances there. The checkbox works (visually) because it is OBJ_BITMAP_LABEL, and its State is changed by the terminal. Its click can be tracked like the click of any Bitmap label in OnChartEvent. But the standard library has its own event model based on custom events. They are generated in void CAppDialog::ChartEvent by enumerating the CArrayObj CWndContainer::m_controls if the CScrollV component has been added tothe CAppDialog. Then events like ON_CLICK, ON_DRAG_START, ON_DRAG_PROCESS and ON_DRAG_ENDare generated. In your case components have not been added to CAppDialog, so no events are generated. How to circumvent this mechanism and force generation of custom events without CAppDialog I haven't thought about. I need to analyze the source code in more detail.

You can try creating a component based on CWndContainer class. And add elements to it. There are no visual elements there (as in CDialog and CAppDialog), but all the necessary mechanisms for the correct operation of UI elements are present.
 
Mihail Matkovskij #:

There are a lot of nuances there. OnCheckBox tick works (visually) because it is OBJ_BITMAP_LABEL, and its State is changed by the terminal. Its click can be tracked as any Bitmap label clicks in OnChartEvent. But the standard library has its own event model based on custom events. They are generated in void CAppDialog::ChartEvent by enumerating the CArrayObj CWndContainer::m_controls if the CScrollV component has been added tothe CAppDialog. Then events like ON_CLICK, ON_DRAG_START, ON_DRAG_PROCESS and ON_DRAG_ENDare generated. In your case components have not been added to CAppDialog, so no events are generated. How to circumvent this mechanism and force the generation of custom events without CAppDialog I haven't thought about. I need to analyze the source code in more detail.

You can try to create a component based on CWndContainer class. And add elements to it. There are no visual elements there (as in CDialog and CAppDialog), but all the necessary mechanisms for the correct operation of UI elements are present.
Thank you for describing the mechanisms of CAppDialog and for suggesting to put it in a container. When I have more time, I will try to experiment.
Reason: