Discussion of article "Graphical Interfaces VII: The Tabs Control (Chapter 2)" - page 2

 
Anatoli Kazharski:

Of course. )

The next update for this class(CTabs) will be "Multiline Tab Mode".

Like here (multiple rows) :

Super. Too bad that tables and lists are just tables and lists for now. So far, they practically serve only as visualisation of data without any interactivity.

I would like, of course, to take and select the necessary columns/rows of lists/tables, and perform some manipulations with them - for example: there is a list, put checkboxes, or in general completely selected the necessary rows, and displayed in a separate window the general data on the selected rows .... Something like that would be super :)

However, to be able to do this, you need to add methods for manipulating this data. Maybe it already exists, but I don't know?

 
Artyom Trishkin:

Great. It's a pity that tables and lists are just tables and lists. So far, they practically serve only as visualisation of data without any interactivity.

...

For most of the above, it's all there.

Selecting an item in lists(CListView) generates an event, which can be used to determine which item was selected and what current value was selected.

It is the same in tables(CTable). When selecting a table row, an event is generated, its parameters contain the row index ( dparam parameter), by which you can then get the values in the cells of this row using the CTable::GetValue() method:

//+------------------------------------------------------------------+
//| Returns the value at the specified indices | 
//+------------------------------------------------------------------+
string CTable::GetValue(const int column_index,const int row_index)
  {
//--- Check for leaving the column range
   int csize=::ArraySize(m_vcolumns);
   if(csize<1 || column_index<0 || column_index>=csize)
      return("");
//--- Checking for row range exit
   int rsize=::ArraySize(m_vcolumns[column_index].m_vrows);
   if(rsize<1 || row_index<0 || row_index>=rsize)
      return("");
//--- Return value
   return(m_vcolumns[column_index].m_vrows[row_index]);
  }

//---

And in the mode of editing table cells an event is generated, in the parameters of which (parameter sparam) you can get a string with column number, with row number and current value in the cell being edited, in the format "column_row_text".

Artyom Trishkin:

I would like, of course, to take and select the necessary columns/rows of lists/tables, and perform some manipulations with them - for example: there is a list, put checkboxes, or in general select the necessary rows, and display in a separate window the general data on the selected rows.... Something like that would be super :)

I will make separate classes for lists with checkboxes and radio buttons later.

 
Hi. A really nice article, but at the moment I've some questions:

1.)
I do not find an information, how I can add simple CLabel or CEdit controls to the form. (From objects.mqh)
They do not have a function like WindowPointer().
I can create these objects, but I can't attach them to the window.

The
CWndContainer::AddToElementsArray(m_subwin, _MyEditBox);
does not work in this case...

2.)
Is the CComboBox a static object. Is it possible to modify the list of elements in the

ComboBox-Listview after the creation of the ComboBox?

Thank you!

 

Tol, something I can't win... There are two windows. From the first - from the main menu we open the second window, which has 4 tabs with icons. Each tab has its own table bound to it.

The problem is this: when opening the first window, the most recently built table is always visible, and it doesn't matter that before opening the window the tab is programmatically switched to the necessary one - it is selected as it should be, but the table on it is not the one bound to it, but the most recent one.

I made an example. Picture of the first window opening:

Screenshots of the MetaTrader trading platform

EURUSD, D1, 2016.11.03

MetaQuotes Software Corp., MetaTrader 5, Demo

EURUSD, D1, 2016.11.03, MetaQuotes Software Corp., MetaTrader 5, Demo


As you can see, tab 1 is highlighted, but the table is visible that is bound to Tab 4 - it is written in the table itself in the column headers.

Further, if you switch tabs, the tables are placed where they are supposed to be, I highlighted the second tab with the mouse:

MetaTrader trading platform screenshots

EURUSD, D1, 2016.11.03

MetaQuotes Software Corp., MetaTrader 5, Demo

EURUSD, D1, 2016.11.03, MetaQuotes Software Corp., MetaTrader 5, Demo


Back on the first one:

MetaTrader trading platform screenshots

EURUSD, D1, 2016.11.03

MetaQuotes Software Corp., MetaTrader 5, Demo

EURUSD, D1, 2016.11.03, MetaQuotes Software Corp., MetaTrader 5, Demo


What am I doing wrong? Or is it a bug?

Files in the trailer. Indicator.

Files:
 
Artyom Trishkin:

...

What am I doing wrong? Or is it a bug?

It works correctly with CTabs tabs. But for CIconTabs tabs I haven't yet made personal arrays in the library engine and automatic display of the contents of the selected tab when opening a dialogue box. This will be fixed in the next update.

But as a temporary solution, you can already track the opening of a dialogue box in a custom class and update the tabs as shown in the listing below:

//+------------------------------------------------------------------+
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_CUSTOM+ON_OPEN_DIALOG_BOX)
     {
      if(lparam==m_window2.Id())
         m_icon_tabs.ShowTabElements();
     }
  }
 
Anatoli Kazharski:

It works correctly with tabs of CTabs type. But for CIconTabs tabs I haven't yet made personal arrays in the library engine and automatic display of the contents of the selected tab when opening a dialogue window. This will be fixed in the next update.

But as a temporary solution right now you can already track the opening of a dialogue box in a custom class and update the tabs as shown in the listing below:

//+------------------------------------------------------------------+
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_CUSTOM+ON_OPEN_DIALOG_BOX)
     {
      if(lparam==m_window2.Id())
         m_icon_tabs.ShowTabElements();
     }
  }
Thanks. It works like this. Now I'll put two overlapping tables in each tab - let's see ;)
 
HI , if I roll up the Dialog, and change the period.the Dialog is not ok.in MT4.
 
When compiling, it generates errors like:
'return' - cannot convert from const pointer to nonconst pointer        SplitButton.mqh 90      65
. It can be cured by deleting Const in the corresponding lines.
 

I am trying to add an input field to a tab but it wont work. 

input double whenToTrail=10.3;

class CProgram: public CWndEvents
{
protected:
   CSpinEdit         m_StartTS;
//Code
protected:
   bool              CreatetrailStop(const int x_gap, const int y_gap, const string text);
};


then the function

bool CProgram::CreatetrailStop(const int x_gap, const int y_gap, string text)
  {
//--- Save the pointer to the main element
   m_StartTS.WindowPointer(m_window);
//--- Coordinates
   int x = m_window.X() + x_gap;
   int y = m_window.Y() + y_gap;
//--- Reserve for the tab
   m_tabs.AddToElementsArray(1, m_StartTS);
//--- Properties
   m_StartTS.XSize(95);
   m_StartTS.YSize(15);
   m_StartTS.EditXSize(40);
   m_StartTS.MinValue(0.01);
   m_StartTS.StepValue(0.01);
   m_StartTS.SetDigits(1);
   m_StartTS.SetValue(NormalizeDouble(whenToTrail,1));
   
   m_StartTS.ResetMode(true);
//--- Create a control
   if(!m_StartTS.CreateSpinEdit(m_chart_id, m_subwin, text, x, y))
      return(false);
//--- Add the object to the common array of object groups
   CWndContainer::AddToElementsArray(0, m_StartTS);
   return(true);
  }

this object isn't attached to the Panel but is on thee chart. 

and after deleting the chart the object remains
 
Hi, this article interests me a lot, I tried to install it but when I compile it it gives me these errors:

resource file '\ Images \ EasyAndFastGUI \ Controls \ LeftTransp_black.bmp' not found Calendar.mqh 443 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ LeftTransp_blue.bmp' not found Calendar.mqh 444 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ calendar_today.bmp' not found Calendar.mqh 738 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ calendar_drop_on.bmp' not found DropCalendar.mqh 435 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ calendar_drop_off.bmp' not found DropCalendar.mqh 436 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ calendar_drop_locked.bmp' not found DropCalendar.mqh 437 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ RightTransp_rotate_black.bmp' not found TreeItem.mqh 247 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ RightTransp_rotate_white.bmp' not found TreeItem.mqh 248 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_x_resize.bmp' not found Pointer.mqh 8 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_x_resize_blue.bmp' not found Pointer.mqh 9 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_y_resize.bmp' not found Pointer.mqh 10 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_y_resize_blue.bmp' not found Pointer.mqh 11 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_xy1_resize.bmp' not found Pointer.mqh 12 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_xy1_resize_blue.bmp' not found Pointer.mqh 13 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_xy2_resize.bmp' not found Pointer.mqh 14 11
resource file '\ Images \ EasyAndFastGUI \ Controls \ pointer_xy2_resize_blue.bmp' not found Pointer.mqh 15 11
resource file '\ Images \ EasyAndFastGUI \ Icons \ bmp16 \ folder.bmp' not found FileNavigator.mqh 284 11
resource file '\ Images \ EasyAndFastGUI \ Icons \ bmp16 \ text_file.bmp' not found FileNavigator.mqh 285 11

I looked in the MQL5 zip file but the files are not there, is there any way to get them?
Thank you