Discussion of article "Graphical interfaces X: Advanced management of lists and tables. Code optimization (build 7)" - page 9

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Well, Tol, thanks for the hint:
for(uint c=l; c<m_visible_columns_total; c++)
{
//--- Get the current position of the vertical scroll bar slider
v=m_scrollv.CurrentPos()+t;
//--- Rows
for(uint r=t; r<m_visible_rows_total; r++)
{
//--- Offset table data
if(v>=t && v<m_rows_total && h>=l && h<m_columns_total)
{
//--- Adjustment for the highlighted line
color back_color=(m_selected_item==v) ? m_selected_row_color : m_vcolumns[h].m_cell_color[v];
color text_color=(m_selected_item==v) ? m_selected_row_text_color : m_vcolumns[h].m_text_color[v];
//--- Adjust (1) values, (2) background colour, (3) text colour and (4) text alignment in cells
SetCellParameters(c,r,m_vcolumns[h].m_vrows[v],back_color,text_color,m_vcolumns[h].m_text_align[v]);
v++;
}
}
//---
h++;
}
Forum on trading, automated trading systems and testing trading strategies
EasyAndFastGUI library
Viktor Glovluk, 2017.01.26 10:42 AM.
Dear forum members, please help!
On the basis of this library from Anatoli Kazharski , trying to weld an owl and wanted to organise a record in the file states of checkboxes and values of input fields! But in order not to record every time ALL values, I can not understand how to determine the element that was clicked! In the user application there is an event handler, and the parameter lparam is just responsible for the index of the element, but how to find the element by this index that would then work with it I can not understand!
Thanks in advance!
Viktor Glovluk, 2017.01.26 10:42
Dear forum members, please help me!
On the basis of this library from Anatoli Kazharski , I am trying to weld an owl and wanted to organise a record in the file states of checkboxes and values of input fields! But in order not to record every time ALL values, I can not understand how to determine the element that was clicked! In the user application there is an event handler, and the parameter lparam is just responsible for the index of the element, but how to find the element by this index that would then work with it I can not understand!
Thanks in advance!
Clicking on the checkboxes can be tracked by the event with the identifier ON_CLICK_LABEL.
In lparam comes the value of the element identifier.
Example:
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
//--- Click event on the text label
if(id==CHARTEVENT_CUSTOM+ON_CLICK_LABEL)
{
//--- If you clicked on the first checkbox
if(lparam==m_checkbox1.Id())
{
//---
}
}
}
Is this really the only way?
//--- If you clicked on the first checkbox
if(lparam==m_checkbox1.Id())
Answered already after I left this post! Thank you! And I have to go through all the checkboxes and input fields? And as an example if there are a "heap" of them? There is no array that stores all the indexes of the items? Then by this index to get the necessary values (e.g. clicked or unclicked checkbox, value in the input field)!Is that the only way?
...
What's an example if there's a "heap" of them? There is no array that stores all the indexes of elements? Then by this index to get the necessary values (e.g. clicked or unclicked checkbox, value in the input field)!
Look at the content of the CWndContainer class. They are all stored there in the WindowElements structure. They can be accessed from the user class.
struct WindowElements
{
//--- Total array of all objects
CChartObject *m_objects[];
//--- Total array of all elements
CElementBase *m_elements[];
//--- Personal arrays of elements:
// Array of context menus
CContextMenu *m_context_menus[];
//--- Array of main menus
CMenuBar *m_menu_bars[];
//--- Tooltips
CTooltip *m_tooltips[];
//--- Array of drop-down lists of different types
CElementBase *m_drop_lists[];
//--- Array of scroll bars
CElementBase *m_scrolls[];
//--- Array of tables of text labels
CElementBase *m_labels_tables[];
//--- Array of tables from input fields
CElementBase *m_tables[];
//--- Array of drawn tables
CElementBase *m_canvas_tables[];
//--- Array of tabs
CTabs *m_tabs[];
//--- Array of tabs with pictures
CIconTabs *m_icon_tabs[];
//--- Array of calendars
CCalendar *m_calendars[];
//--- Array of drop-down calendars
CDropCalendar *m_drop_calendars[];
//--- Tree lists
CTreeView *m_treeview_lists[];
//--- File Navigators
CFileNavigator *m_file_navigators[];
//--- Standard graphics (graphics objects)
CStandardChart *m_sub_charts[];
//--- Picture Sliders
CPicturesSlider *m_pictures_slider[];
//--- Time
CTimeEdit *m_time_edits[];
//--- Multiline fields
CTextBox *m_text_boxes[];
};
//--- Array of element arrays for each window
WindowElements m_wnd[];
The further away, the better! :)
Again I came across event handler implementations that I don't understand! When creating a custom application, it is supposed to connect the GUI through a class:
#include "Menu.mqh"
CProgram program;
but then how to catch button presses, how to get the states of checkboxes and values of input fields, if they are in the private zone of CProgram class? Should I move what I need to public or do I misunderstand something?
...
but then how to catch button presses, how to get the states of the checkboxes and values of input fields, ...
In the CProgram handler.
//+------------------------------------------------------------------+
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
//--- Click event on the text label
if(id==CHARTEVENT_CUSTOM+ON_CLICK_LABEL)
{
}
}
//---
All articles have MQL application sample files that show how to handle events of controls.
In the CProgram handler.
//+------------------------------------------------------------------+
//| Event handler|
//+------------------------------------------------------------------+
void CProgram::OnEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
//--- Click event on the text label
if(id==CHARTEVENT_CUSTOM+ON_CLICK_LABEL)
{
}
}
//---
All the articles have MQL application sample files that show how to handle control events.
In the CProgram handler it is clear, but this handler is for the interface, right? You should not shove trade solutions into it! I understand very little about OOP, mostly all my knowledge comes from your articles, so I can be stupid! :)
So, for example, how to implement in the Expert Advisor the opening of an order, the lotness of which is set in the input field? I need to get the value of this field in the EA itself!
In the CProgram handler it is clear, but this handler is for the interface, right? You shouldn't be shoving trade solutions into it!
Why not? Yes, you can. It is a class of your MQL-application (indicator or Expert Advisor). Everything is the same.
You can get the value from the input field like this: