Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Toolbar ComboBox event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Toolbar ComboBox event

 Post Reply Post Reply
Author
Message
suchout View Drop Down
Groupie
Groupie


Joined: 29 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote suchout Quote  Post ReplyReply Direct Link To This Post Topic: Toolbar ComboBox event
    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..
 
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
suchout View Drop Down
Groupie
Groupie


Joined: 29 September 2009
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote suchout Quote  Post ReplyReply Direct Link To This Post 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 ....
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.093 seconds.