Click here to Skip to main content
15,212,721 members

C / C++ / MFC

 
GeneralRe: binary trees Pin
Amr.Mohammad876-Dec-15 0:49
MemberAmr.Mohammad876-Dec-15 0:49 
GeneralRe: binary trees Pin
CPallini6-Dec-15 3:47
mveCPallini6-Dec-15 3:47 
GeneralRe: binary trees Pin
Amr.Mohammad8724-Dec-15 20:14
MemberAmr.Mohammad8724-Dec-15 20:14 
GeneralRe: binary trees Pin
CPallini25-Dec-15 8:43
mveCPallini25-Dec-15 8:43 
QuestionService only works once useing Pin
derek-20084-Dec-15 12:58
Memberderek-20084-Dec-15 12:58 
QuestionAdding a new button to and existing CMFCRibbonBar "tab" Pin
S.T.K4-Dec-15 6:22
MemberS.T.K4-Dec-15 6:22 
GeneralRe: I now have an MFC example project that highlights my issue. Pin
S.T.K6-Dec-15 23:25
MemberS.T.K6-Dec-15 23:25 
GeneralRe: Adding a new button to and existing CMFCRibbonBar "tab" Pin
S.T.K10-Dec-15 2:37
MemberS.T.K10-Dec-15 2:37 
Can anyone help me?
I am still unable to add to a ribbonbar “tab”.
Here is an example bit of code, which when added to a new MFC MDI basing ribbon example generated from the wizard works correctly until I add the bit at the bottom.

Add to MainFrm.h
// Implementation
public:
    void CMainFrame::CreateAddtoTabs();
    void CMainFrame::AddToExistingTab();
    void CMainFrame::DoIWork(UINT ID);
public:
    CMFCRibbonButton  *pQuickMenu;
	CMFCRibbonBar     m_wndRibbonBar;


Add to MainFrm.cpp

BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
    ON_COMMAND(2000,&CMainFrame::AddToExistingTab)
    ON_COMMAND_RANGE(1000,1001,&CMainFrame::DoIWork)
END_MESSAGE_MAP()


//Replace the existing InitializeRibbon routine.
void CMainFrame::InitializeRibbon()
{
	BOOL bNameValid;

	CString strTemp;
	bNameValid = strTemp.LoadString(IDS_RIBBON_FILE);
	ASSERT(bNameValid);

	// Load panel images:
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDB_BUTTONS);

	// Init main button:
	m_MainButton.SetImage(IDB_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(strTemp);

	m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE);

	CreateAddtoTabs();
}


//Include new routines in MainFrm.cpp
void CMainFrame::CreateAddtoTabs()
{
    pQuickMenu = new CMFCRibbonButton(1000,TEXT("QuickMenu"),NULL,0,0,0,0);
    AddToExistingTab();
    m_wndRibbonBar.AddToTabs(pQuickMenu);
}

void CMainFrame::AddToExistingTab()
{
    pQuickMenu->AddSubItem(new CMFCRibbonButton(1001,TEXT("Do I work?"),NULL,0,0,0,0),-1);
}
void CMainFrame::DoIWork(UINT ID)
{
    MessageBox(TEXT ("Yes I Do!"),TEXT("Do I Work?"), MB_ICONWARNING) ;
}


If I add the above strucutre to a ribbon based MDI MFC application, a new “QuicMenu” tab appears on the menu system. It works. If I click the “Do I work?” menu entry then it pops up a panel saying “yes I do!”

If I now add a button to the ribbonbar at time of initialisation, which when clicked will adds a new button to the “QuickMenu” menu then all is good. The additional button turns up and is selectable.

void CMainFrame::InitializeRibbon()
…
…
…
…

    CMFCRibbonCategory *pCat = m_wndRibbonBar.AddCategory(TEXT("Update AddToTabs"),0,0,CSize(16,16),CSize(32,32),-1,0);
    CMFCRibbonPanel *pPan = pCat->AddPanel(TEXT("Single Button"),0,0);
    pPan->Add(new CMFCRibbonButton(2000,TEXT("Click to add to quickmenu"),0,0,0,0,0));

    CreateAddtoTabs();
}


But when I select this new menu entry from the “quickmenu”, the click is registered but in the lower MFC code it fails to recognise a valid ribbonbar handle and exists without processing the message (see my first post for more info).

Can anyone help?
I am realy stuck and may have to scrap the ribbon and revert to basic menus only if I can not dynamicaly add to my quickmenu as rquired.

What am I missing or overlooking when I'm adding to my QuickMenu structure?

Any help would be appreciated.
Thanks.
Steve.
AnswerRe: Adding a new button to and existing CMFCRibbonBar "tab" Pin
S.T.K17-Dec-15 23:55
MemberS.T.K17-Dec-15 23:55 
QuestionC++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
Satish Shankar Jagtap3-Dec-15 23:54
MemberSatish Shankar Jagtap3-Dec-15 23:54 
AnswerRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
CPallini4-Dec-15 0:17
mveCPallini4-Dec-15 0:17 
AnswerRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
Jochen Arndt4-Dec-15 1:45
professionalJochen Arndt4-Dec-15 1:45 
GeneralRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
CPallini4-Dec-15 9:18
mveCPallini4-Dec-15 9:18 
QuestionFloating point conversion Pin
Still learning how to code3-Dec-15 22:19
MemberStill learning how to code3-Dec-15 22:19 
AnswerRe: Floating point conversion Pin
Michael_Davies3-Dec-15 22:29
MemberMichael_Davies3-Dec-15 22:29 
GeneralRe: Floating point conversion Pin
Richard MacCutchan3-Dec-15 22:40
mveRichard MacCutchan3-Dec-15 22:40 
GeneralRe: Floating point conversion Pin
Michael_Davies4-Dec-15 21:08
MemberMichael_Davies4-Dec-15 21:08 
GeneralRe: Floating point conversion Pin
Richard MacCutchan4-Dec-15 22:12
mveRichard MacCutchan4-Dec-15 22:12 
AnswerRe: Floating point conversion Pin
Richard MacCutchan3-Dec-15 22:39
mveRichard MacCutchan3-Dec-15 22:39 
AnswerRe: Floating point conversion Pin
Jochen Arndt3-Dec-15 23:10
professionalJochen Arndt3-Dec-15 23:10 
GeneralRe: Floating point conversion Pin
Still learning how to code5-Dec-15 0:29
MemberStill learning how to code5-Dec-15 0:29 
AnswerRe: Floating point conversion Pin
CPallini3-Dec-15 23:30
mveCPallini3-Dec-15 23:30 
GeneralRe: Floating point conversion Pin
k50544-Dec-15 4:21
mvek50544-Dec-15 4:21 
QuestionIEEE 754-1985 Pin
enhzflep4-Dec-15 5:43
Memberenhzflep4-Dec-15 5:43 
AnswerRe: Floating point conversion Pin
S.T.K8-Dec-15 3:19
MemberS.T.K8-Dec-15 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.