Iteration in CheckGroup control

 

Hello everyone,

I'm trying to iterate in a checkgroup control but I can't get the count of items in it.

how can i do that?


Thank you in advance

 
amin_mohammadi:

Hello everyone,

I'm trying to iterate in a checkgroup control but I can't get the count of items in it.

how can i do that?


Thank you in advance

What have you tried ?
 
angevoyageur:
What have you tried ?

I need to fill the checkgroup dynamically and use for loop to get items values

for example:


for(int i=0;i<m_check_group.Items ;i++) // I know "Items" is not member of CCheckGroup Class but I need such member
       {
        // code
       }
 
amin_mohammadi:

I need to fill the checkgroup dynamically and use for loop to get items values

for example:


Hi, maybe do the same as the source code of the Create method (number of visible rows and red values below) at folder ..\MQL5\Include\Controls\CheckGroup.mqh can help you.

//+------------------------------------------------------------------+
//| Create a control                                                 |
//+------------------------------------------------------------------+
bool CCheckGroup::Create(const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2)
  {
//--- determine the number of visible rows
   m_total_view=(y2-y1)/m_item_height;
//--- check the number of visible rows
   if(m_total_view<1)
      return(false);
//--- call method of the parent class
   if(!CWndClient::Create(chart,name,subwin,x1,y1,x2,y2))
      return(false);
//--- set up
   if(!m_background.ColorBackground(CONTROLS_CHECKGROUP_COLOR_BG))
      return(false);
   if(!m_background.ColorBorder(CONTROLS_CHECKGROUP_COLOR_BORDER))
      return(false);
//--- create dependent controls
   ArrayResize(m_rows,m_total_view);
   for(int i=0;i<m_total_view;i++)
      if(!CreateButton(i))
         return(false);
//--- succeed
   return(true);
  }
 
figurelli:

Hi, maybe do the same as the source code of the Create method (number of visible rows and red values below) at folder ..\MQL5\Include\Controls\CheckGroup.mqh can help you.

Thank you very much

:D

Reason: