On Clicking a CButton the CHARTEVENT_OBJECT_ENDEDIT should be trigerred

 

Hi

When i am clicking a CButton  the CHARTEVENT_OBJECT_ENDEDIT event of CEdit should automatically be triggered, which is not happening.

 Because of that the value of CEdit is not updated properly.

 Please help. 

 

Re-phrasing my problem:-

 

I have a CEdit object and a CButton object. Now when i click the CButton, the text in the CEdit object is used for placing orders.

Problem i am facing is that the current updated text in the CEdit object is not available when i click the CButton, only once a 'Enter' key is pressed then only the text value is updated for CEdit object.

Please help with the problem.

Moderators please respond.

 
ankitag2010:

Re-phrasing my problem:-

 

I have a CEdit object and a CButton object. Now when i click the CButton, the text in the CEdit object is used for placing orders.

Problem i am facing is that the current updated text in the CEdit object is not available when i click the CButton, only once a 'Enter' key is pressed then only the text value is updated for CEdit object.

Please help with the problem.

Moderators please respond.

Please show the relevant code.
 
class TradingPanel: public CAppDialog
{
private: 
   CEdit             edit_corelation; 
   CButton           button_long;  
protected:  
   bool              CreateButtonLong(void);
   bool              CreateEditCorrelation(void);   
}

bool TradingPanel::CreateEditCorrelation(void)
{   
      
   edit_corelation_label.Create( m_chart_id, CorrelationEditLabelId, m_subwin, INDENT_LEFT , y1, ( LABEL_WIDTH + INDENT_LEFT ), y2 );
   edit_corelation_label.Text( "Correlation Pairs" );
   if( !Add( edit_corelation_label ))
      return(false);   
   if( !edit_corelation.Create( m_chart_id, CorrelationEditId, m_subwin, x1, y1 ,x2, y2 ))
      return(false);
   if( !Add( edit_corelation ))
      return(false);
   return(true);
}

bool TradingPanel::CreateButtonLong(void)
{
   if( !button_long.Create( m_chart_id, LongButtonId, m_subwin, x1, y1 ,x2, y2 ))
      return(false);
   if( !button_long.ColorBackground( clrSpringGreen ))  
      return(false);
   if( !button_long.Text( "Long" ))
      return(false);   
   if( !Add( button_long ))
      return(false);
   return(true);
}


bool TradingPanel::Create( const long chart,const string name,const int subwin,const int x1,const int y1,const int x2,const int y2,
                           string sLocation1, string sLocation2, string sLocation3, color panelBackColor )
{
    if( !CAppDialog::Create( chart, name, subwin, x1, y1, x2, y2 ))
         return(false);
    if( !CreateButtonLong() )
         return(false);   
    if( !CreateEditCorrelation() )
         return(false); 
 return(true);
}
string TradingPanel::getCorrelatingPairs(void)
{
   return edit_corelation.Text();
}

int OnInit()
{      
   if( !tradingPanel.Create( 0, "Testing", 0, 50, 50, 500, 360, Location1, Location2, Location3, PanelColor ))
     return( INIT_FAILED );
   

   if( !tradingPanel.Run() )
     return( INIT_FAILED );    
   
   return( INIT_SUCCEEDED );
  
}

void OnChartEvent( const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam )
{
   string clickedChartObject = sparam;   
      
   if ( id == CHARTEVENT_OBJECT_CLICK )
   {          
      if (( clickedChartObject == LongButtonId ) || ( clickedChartObject == ShortButtonId ))
      {  long lparam1 = 0;
         double dparam1 = 0.0;
         tradingPanel.ChartEvent(CHARTEVENT_MOUSE_MOVE ,lparam, dparam, CorrelationEditId);
         string CorrelatingPairs = tradingPanel.getCorrelatingPairs();                 
         StringSplit( StringTrimLeft( StringTrimRight( CorrelatingPairs )), ',', CorrelatingPair );           
         if ( clickedChartObject == LongButtonId )
         {           
            PlaceOrderForSymbolPairs( CorrelatingPair, OP_BUY );
         }      
   }   
   tradingPanel.ChartEvent(id, lparam, dparam, sparam);   
} 
 
Hey...Any updates on the issue?  Will appreciate any help.
Reason: