Print Page | Close Window

Can't trigger listbox selection in commandbar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=18519
Printed Date: 04 October 2024 at 5:19pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Can't trigger listbox selection in commandbar
Posted By: dehilster
Subject: Can't trigger listbox selection in commandbar
Date 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



Replies:
Posted By: Oleg
Date Posted: 09 June 2011 at 7:34am
Hi,

Please check CommandBars\ListBoxSamples.


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


Posted By: dehilster
Date 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


Posted By: dehilster
Date Posted: 09 June 2011 at 11:35am
Yes, this works.  Thanks!

-------------
David de Hilster


Posted By: jintian01
Date Posted: 27 December 2011 at 8:46pm

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




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