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

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
All right. (chuckles) Let's continue with the example we started with here. Complete it to the level when the problem starts to manifest itself.
No, Tol, it's the same in your example - nothing has changed. In Table.mqh I added it to the last loop:
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],m_vcolumns[h].m_cell_color[v],m_vcolumns[h].m_text_color[v],m_vcolumns[h].m_text_align[v]);
v++;
}
}
//---
h++;
}
In Programme.mqh I added a timer:
//| Timer|
//+------------------------------------------------------------------+
void CProgram::OnTimerEvent(void)
{
CWndEvents::OnTimerEvent();
//--- Pause between element updates
if(m_counter1.CheckTimeCounter())
{
//--- Updating the second item of the status bar
m_status_bar.ValueToItem(1,::TimeToString(::TimeLocal(),TIME_DATE|TIME_SECONDS));
//--- Redraw the graph
m_chart.Redraw();
}
//--- Pause between element updates
if(m_counter2.CheckTimeCounter())
{
//--- Enter the price value of the current symbol into the Price of the first row
MqlTick tick;
if(SymbolInfoTick(Symbol(),tick))
{
int dg=(int)SymbolInfoInteger(Symbol(),SYMBOL_DIGITS);
m_table.SetValue(1,1,DoubleToString(tick.bid,dg),dg);
m_table.UpdateTable();
}
//--- Add a row to the table if the total number is less than the specified one
if(m_table.RowsTotal()<m_spin_edit1.GetValue())
m_table.AddRow();
//--- Add a column to the table if the total number of columns is less than the specified number.
if(m_table.ColumnsTotal()<m_spin_edit2.GetValue())
m_table.AddColumn();
//--- Add an item to the list if the total number is less than the specified number.
if(m_listview.ItemsTotal()<m_spin_edit5.GetValue())
{
m_listview.AddItem("SYMBOL "+string(m_listview.ItemsTotal()));
//--- Move the scroll bar slider to the end of the list
m_listview.Scrolling();
}
//--- Add an item to the list from the checkboxes if the total number is less than the specified one
if(m_checkbox_list.ItemsTotal()<m_spin_edit5.GetValue())
{
m_checkbox_list.AddItem("Checkbox "+string(m_checkbox_list.ItemsTotal()));
//--- Move the scroll bar slider to the end of the list
m_checkbox_list.Scrolling();
}
//--- Redraw the graph
m_chart.Redraw();
}
}
//+------------------------------------------------------------------+
Everything is the same as before - no change - it blinks.
Maybe you have another version of Table.mqh and it already works with such changes?
...
Maybe you already have a different version of Table.mqh and it already works with these changes?
The version is the same as in the article with the example. I don't see any problems myself. I can't help you with anything else, as the reasons are not clear.
And you have the timer working, the price is updated in the table with each new tick, but the table behaves normally?
Yes.
Have you changed the mouse operation? It depends on the state of the cursor - if you move the cursor, the highlighted line becomes highlighted, but it blinks, if the cursor is in place, then no highlighting of the line is visible.
Everything you are describing played for me before the changes I mentioned. I don't see any problems now. Try recompiling all the library files and look again.
It didn't work.
Not helpful.
Pay attention not only to what is highlighted, but where it is then used:
Forum on trading, automated trading systems and testing trading strategies
Discussion of the article "Graphical Interfaces X: Advanced List and Table Management. Code Optimisation (build 7)"
Anatoli Kazharski, 2017.01.24 12:26 pm.
To prevent the highlighted row of the table from blinking, add these lines to the CTable::UpdateTable() method in the last loop:
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++;
}
//---
And with the rest you need more details.
What is this? :