The CComboBox.Value dosen't work

 

Hello every one, I'm making a EA that uses a ComboBox and I can't get the value, for instance: this instruction  "Comment(m_field.Value());" should print  the value of the current CombBbox field like a string  and so on, but instead, it shows me the index of the array(in this case the ComboBox list). I don't know if it's a common error in the class ListView.mqh or Edit.mqh. I would like to know  what´s wrong or if I must re-install MT5.

Thank you so much in advance.

 
jatm:

Hello every one, I'm making a EA that uses a ComboBox and I can't get the value, for instance: this instruction  "Comment(m_field.Value());" should print  the value of the current CombBbox field like a string  and so on, but instead, it shows me the index of the array(in this case the ComboBox list). I don't know if it's a common error in the class ListView.mqh or Edit.mqh. I would like to know  what´s wrong or if I must re-install MT5.

Thank you so much in advance.

Show your code if you need coding help.

 
Alain Verleyen:

Show your code if you need coding help.

This is the snippet to create the control...

bool CTrade::CreatePipsST(void) 
  { 
//--- coordinates 
   int x2=(ClientAreaWidth()- CONTROLS_GAP_X*3) - EDIT_WIDTH*2;   
   int x1= x2 - (EDIT_WIDTH + 20); 
   int y1=INDENT_TOP+(EDIT_HEIGHT+CONTROLS_GAP_Y)+ 
       5*CONTROLS_GAP_Y;
   int y2=y1+EDIT_HEIGHT; 
//--- create 
   if(!m_field_pips_st.Create(m_chart_id,m_name + "ComboBoxPipsST",m_subwin,x1,y1,x2,y2)) 
      return(false); 
   if(!m_field_pips_st.ReadOnly(false)) 
      return(false);       
        
   if(!Add(m_field_pips_st)) 
      return(false); 
   

//--- fill out with strings 
   
   for(int i=0;i<110;i+=10) 
      if(!m_field_pips_st.ItemAdd(IntegerToString(i))) 
         return(false); 
   
  
//--- succeed 
   return(true); 
  } 



... and this is the event to get the value and show it into the chart.


//+------------------------------------------------------------------+ 

//| Event handler                                                    | 

//+------------------------------------------------------------------+ 

void CTrade::OnChangeFieldPipsST(void) 

  { 

  

  Comment((m_field_pips_st.Value());

 

  } 

This is the result 



For instance I select the value "30" and print the position 3. What´s wrong? It should print  the value "30". I think that the problem is some class by default like the Edit.mqh, ComboBox.mqh or ListView.mqh class I'm not sure. I would  like that you do the same control and prove it in your PC and tell me if this control works well in your PC.


Thank you very much .



 
Sergey Golubev:


Ok, no problem.