Print Page | Close Window

MiniToolbar - Buttons Disabled

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=11705
Printed Date: 17 July 2025 at 9:01pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MiniToolbar - Buttons Disabled
Posted By: barobax
Subject: MiniToolbar - Buttons Disabled
Date Posted: 03 August 2008 at 8:01pm
Hi,
my MiniToolbar Buttons are disabled.

ON_COMMAND(IDM_VOICES_US, DSyntax::OnUS_Clicked)
ON_UPDATE_COMMAND_UI(IDM_US, DSyntax::OnUpdateUS)

ON_COMMAND(IDM_VOICES_UK, DSyntax::OnUK_Clicked)
ON_UPDATE_COMMAND_UI(IDM_UK, DSyntax::OnUpdateUK)
   
ON_COMMAND(IDM_VOICES_AU, DSyntax::OnAU_Clicked)
ON_UPDATE_COMMAND_UI(IDM_AU, DSyntax::OnUpdateAU)

m_US = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_US);
m_UK = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_UK);
m_AU = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_AU);



Replies:
Posted By: Oleg
Date Posted: 04 August 2008 at 3:29am
 
ON_COMMAND(IDM_VOICES_US, DSyntax::OnUS_Clicked)
ON_UPDATE_COMMAND_UI(IDM_US, DSyntax::OnUpdateUS)
 
have to be same.


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


Posted By: barobax
Date Posted: 04 August 2008 at 3:37am
sorry for above lines
ON_COMMAND(IDM_US, DSyntax::OnUS_Clicked)
ON_UPDATE_COMMAND_UI(IDM_US, DSyntax::OnUpdateUS)

ON_COMMAND(IDM_UK, DSyntax::OnUK_Clicked)
ON_UPDATE_COMMAND_UI(IDM_UK, DSyntax::OnUpdateUK)
   
ON_COMMAND(IDM_AU, DSyntax::OnAU_Clicked)
ON_UPDATE_COMMAND_UI(IDM_AU, DSyntax::OnUpdateAU)

m_US = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_US);
m_UK = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_UK);
m_AU = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_AU);


Posted By: Oleg
Date Posted: 04 August 2008 at 4:13am
Hi,
 
Check if these handlers are really called. if not, you have move them to CMainFrame or to View. not sure what DSyntax is...


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


Posted By: barobax
Date Posted: 04 August 2008 at 6:28am
Hi,
BEGIN_MESSAGE_MAP(DSyntax, CXTPSyntaxEditCtrl)
    ON_COMMAND(IDM_US, DSyntax::OnUS_Clicked)
    ON_UPDATE_COMMAND_UI(IDM_US, DSyntax::OnUpdateUS)

    ON_COMMAND(IDM_UK, DSyntax::OnUK_Clicked)
    ON_UPDATE_COMMAND_UI(IDM_UK, DSyntax::OnUpdateUK)

    ON_COMMAND(IDM_AU, DSyntax::OnAU_Clicked)
    ON_UPDATE_COMMAND_UI(IDM_AU, DSyntax::OnUpdateAU)

    ON_WM_MOUSEMOVE()
    ON_WM_CREATE()
    ON_WM_RBUTTONUP()
END_MESSAGE_MAP()


Posted By: Oleg
Date Posted: 04 August 2008 at 7:18am
Hi,
 
Where do you have this DSyntax ? on dialog ? 
 
ToolBars/MiniBar send messages to main site, if you don't recevie them in DSyntax, you have to move handlers to main site (your CMainFrame or main dialog) or manually forward them.
 


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


Posted By: barobax
Date Posted: 04 August 2008 at 8:18am
Hi oleg,
ON_WM_CREATE() does not work when I set a breakpoint in OnCreate Block. My application run without hint to breakpoint.

int DSyntax::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    return CXTPSyntaxEditCtrl::OnCreate(lpCreateStruct);
}
in (class DEdit : public CXTEdit) is so on and my control created without call to my overrided method.

I moved handlers to CMainFrame and is like previous step and my buttons are disabled
.
MiniToolbar created on OnRButtonUp
void DSyntax::OnRButtonUp(UINT nFlags, CPoint point)
{
if (m_MiniToolBar)
        {
            CXTPCommandBars* pCommandBars =      ((CMainFrame*)AfxGetMainWnd())->GetCommandBars();
            m_MiniToolBar = CXTPMiniToolBar::CreateMiniToolBar(((CMainFrame*)AfxGetMainWnd())->GetCommandBars());
            m_MiniToolBar->SetWidth(22 * 3 + 4);
            m_US = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_US);
            m_UK = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_UK);
            m_VoiceAU = (CXTPControlButton*)m_MiniToolBar->GetControls()->Add(xtpControlButton, IDM_AU);
            UINT nIDs[] = {IDM_US, IDM_UK, IDM_AU};
                                           ((CMainFrame*)AfxGetMainWnd())->GetCommandBars()->GetImageManager()->SetIcons(IDB_PNG3,       nIDs, 3, CSize(16, 16));
        }
        m_AU->SetEnabled(TRUE);
        ClientToScreen(&point);
        m_MiniToolBar->TrackMiniBar(0, point.x, point.y + 30);
        CXTPSyntaxEditCtrl::OnRButtonUp(nFlags, point);
}

My Header file
class DSyntax : public CXTPSyntaxEditCtrl
{
private:
    CXTPMiniToolBar* m_MiniToolBar;
    CXTPMiniToolBar* m_MiniToolBarOptions;
    CXTPControlButton* m_US;
    CXTPControlButton* m_UK;
    CXTPControlButton* m_AU;
    CString m_SampleString;
    DECLARE_MESSAGE_MAP();
public:
    DSyntax();
    ~DSyntax();
    afx_msg void OnMouseMove(UINT nFlags, CPoint point);
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    void OnRButtonUp(UINT nFlags, CPoint point);

    afx_msg void OnUS_Clicked();
    void OnUpdateUS(CCmdUI* pCmdUI);
    afx_msg void OnUK_Clicked();
    void OnUpdateUK(CCmdUI* pCmdUI);
    afx_msg void OnAU_Clicked();
    void OnUpdateAU(CCmdUI* pCmdUI);
};


Posted By: Oleg
Date Posted: 05 August 2008 at 1:29am
Hi,
 
I need to see whole picture. Attach sample project, I wll help to fix it.


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


Posted By: barobax
Date Posted: 05 August 2008 at 8:17am
Hi,
Thanks for your responses oleg.
I solve problem with moving all in CMainFrame.
But my Overrided OnCreate does not work. WHY?!?!
in any inherited class from CodeJock controls have same problem.(CXTEdit,CXTPSyntaxEditCtrl)


Posted By: Oleg
Date Posted: 05 August 2008 at 9:50am
Hi,
 
Are you sure you create it and not subclass from some control from dialog?


-------------
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