Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Can't trigger listbox selection in commandbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Can't trigger listbox selection in commandbar

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


Joined: 16 October 2005
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote dehilster Quote  Post ReplyReply Direct Link To This Post Topic: Can't trigger listbox selection in commandbar
    Posted: 08 June 2011 at 9:33pm
Looking at the samples, I am trying to trigger and event with this code:

ON_LBN_SELCHANGE(ID_LISTER_BOX, OnListerSelect)
ON_UPDATE_COMMAND_UI(ID_LISTER, OnUpdateLister)
ON_UPDATE_COMMAND_UI(ID_LISTER_BOX, OnUpdateLister)

CXTPToolBar* pToolBarListBox = pCommandBars->Add(_T("ListBox"), xtpBarTop);
pToolBarListBox->GetControls()->Add(xtpControlLabel, 0)->SetCaption(_T("CXTPControlListBox:"));
CXTPControlPopup* pPopup = (CXTPControlPopup*)pToolBarListBox->GetControls()->Add(xtpControlPopup, ID_LISTER);
pPopup->SetCaption(_T("ListBox"));
CXTPControlListBox* pListBox = (CXTPControlListBox*)pPopup->GetCommandBar()->GetControls()->Add(new CXTPControlListBox, ID_LISTER_BOX);
pListBox->GetListCtrl()->AddString(_T("Item 1"));
pListBox->GetListCtrl()->AddString(_T("Item 2"));

void CMainFrame::OnListerSelect() {
int i = 0;  // this is just a BREAKPOINT
}

void CMainFrame::OnUpdateLister(CCmdUI* pCmdUI) 
{
pCmdUI->Enable(true);
}

However, it never makes it to BREAKPOINT

I need to get an event triggered in choosing a list item in a command bar.

Help!

-David
 Long Beach, CA
David de Hilster
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: 09 June 2011 at 7:34am
Hi,

Please check CommandBars\ListBoxSamples.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
dehilster View Drop Down
Groupie
Groupie


Joined: 16 October 2005
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote dehilster Quote  Post ReplyReply Direct Link To This Post Posted: 09 June 2011 at 11:07am
Thanks!  I saw that one but only now realize the list box was the undo buttons.  I will let you know how it works out.
David de Hilster
Back to Top
dehilster View Drop Down
Groupie
Groupie


Joined: 16 October 2005
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote dehilster Quote  Post ReplyReply Direct Link To This Post Posted: 09 June 2011 at 11:35am
Yes, this works.  Thanks!
David de Hilster
Back to Top
jintian01 View Drop Down
Newbie
Newbie
Avatar

Joined: 10 December 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jintian01 Quote  Post ReplyReply Direct Link To This Post Posted: 27 December 2011 at 8:46pm

How do you resolve it ?Can you past your code section to me?

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.172 seconds.