Discussing the article: "Tables in the MVC Paradigm in MQL5: Integrating the Model Component into the View Component"

 

Check out the new article: Tables in the MVC Paradigm in MQL5: Integrating the Model Component into the View Component.

In the article, we will create the first version of the TableControl (TableView) control. This will be a simple static table being created based on the input data defined by two arrays — a data array and an array of column headers.

In article “Table and Header Classes based on a table model in MQL5: Applying the MVC concept" we completed creating the table model class (in the MVC concept it means the Model component). Next, we were developing a library of simple controls that allow for creating controls based on them that are completely different in purpose and complexity. In particular, the View component for creating the TableView control.

This article will cover implementation of the interaction between the Model component and the View component. In other words, today we will combine tabular data with their graphical representation in a single control.

The control will be created based on the Panel object class, and will consist of several elements:

  1. Panel is the base, the substrate to which the table header and the data area of the table are attached;
  2. Panel is a table header consisting of a number of elements: column headers created based on the Button object class;
  3. Container is the tabular data container with scrollable content;
  4. Panel is a panel for arranging table rows on it (attached to the container (item 3) and, when going beyond the container, scrolls using container scrollbars);
  5. Panel — table row is a panel for drawing table cells on it, attached to the panel (item 4). A number of such objects corresponds to the number of rows in the table;
  6. The table cell class is a new class that allows drawing at specified coordinates on the indicated canvas (CCanvas). An object of this class is attached to a table row object (item 5), the canvases of the table row object are specified as drawing elements; and the table cell is drawn on this panel at the specified coordinates. The area of each table cell is set in the table row object (item 5) by an instance of the CBound class object, and an object of the table cell class is attached to this object.


Author: Artyom Trishkin