Print Page | Close Window

Toolbar ComboBox event

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=15479
Printed Date: 11 June 2025 at 10:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Toolbar ComboBox event
Posted By: suchout
Subject: Toolbar ComboBox event
Date Posted: 28 October 2009 at 2:10am
Hi,
 
<in dll >
i developed combobox in  toolbar and add three items in combobox.
 
   CXTPControlComboBox* pControlCombo = (CXTPControlComboBox*)m_pToolBar->GetControls()->Add(xtpControlComboBox , m_ToolbarID[0]); 
   pControlCombo->AddString(_T("abc"));
   pControlCombo->AddString(_T("def"));
   pControlCombo->AddString(_T("hij"));
 
 
<in main program>
when i execute program , i clicked one item of three items 
 
 
in Event handling , catched combobox's id.
 
and show item text in messagebox ,
 
 ON_COMMAND_EX_RANGE(MSG_START, MSG_END, OnUserId)
 
int CTEST1App::OnUserId(UINT nID)
{
    int rtn;
    EVENT_Info eventinfo;
    CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
    rtn = 1;
    switch(nID) {
        ...
      case ID_TB_COMBO1:
    CString str(_T(""));    
    CXTPToolBar *pTb;
    for (int i = 1; i < theApp.m_pCmdBars->GetCount(); i++) {
      pTb = (CXTPToolBar *)theApp.m_pCmdBars->GetAt(i);
      for (int j = 0; j< pTb->GetControls()->GetCount(); j++) {
          int a = pTb->GetControl(j)->GetID();
          if (a == ID_TB_COMBO1) {
             CXTPControlComboBox *pComboCtrl = (CXTPControlComboBox *)pTb->GetControl(j);
             pComboCtrl->GetLBText(pComboCtrl->GetSelected() + 1, str);       
             AfxMessageBox(str);       
          }
       }
    }
            break;
        ...
     }
 
}
 
 
 
and An unknown error has occured.
 
 
 .. ㅠㅠ i think i have a hole in my head..
 
please help me..
 
 



Replies:
Posted By: Oleg
Date Posted: 28 October 2009 at 2:48am
Hi,
 
Please. click Retry and show full stack.
What Toolkit version do you have ?
 
btw its not very good way to determine what control was executed. Search in our samples ON_XTP_EXECUTE.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: suchout
Date Posted: 28 October 2009 at 3:18am
Hi,
 
this is call stack ,
and i use toolkit v13.1.0
 
and i can't found ON_XTP_EXECUTE ....
 


Posted By: Oleg
Date Posted: 29 October 2009 at 6:52am
See CustomThemes sample:
 
ON_XTP_EXECUTE(ID_EDIT_STATE, OnEditState)
void CMainFrame::OnEditState(NMHDR* pNMHDR, LRESULT* pResult)
{
 NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
 CXTPControlComboBox* pControl = (CXTPControlComboBox*)tagNMCONTROL->pControl;
 if (pControl->GetType() == xtpControlComboBox)
 {
  int nState = pControl->GetCurSel();
  if (nState != 2)
  {
   m_nState = nState;
  }
  else
  {
   MessageBox(_T("Configuration Manager"));
   pControl->SetCurSel(m_nState);
  }
  *pResult = TRUE; // Handled
 }
}
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net