-
August 10th, 2021, 08:05 PM
#1
A CMFCDropDownToolBar Question
I created a CMFCDropDownToolBar embedded in a CMFCToolBar VIA dummy resource button as explained in CMFCDropDownToolBar Class microsoft document,everything works great, but what I want to do is create another dropdown toolbar embedded in the CMFCDropDownToolBar, is this possible??? I would like the same appearance look of the same toolbar/buttons as the 3rd choice of commands, I tried using the same process this time embedding a CMFCDropDownToolBar in a CMFCDropDownToolBar , it compiled but I got a debug assertion at the line using replacebutton
THIS WORKS
Code:
CMFCToolBar m_wndTB;
CMFCDropDownToolBar m_wndTBM;
afx_msg LRESULT CMainFrame::OnResetToolbar(WPARAM wParam, LPARAM lParam)
{.
.
.
m_wndTB.ReplaceButton(IDB_DUMMY_TBAR, CMFCDropDownToolbarButton(_T("Add TB"), &m_wndTBM));
}
void CMainFrame::OnViewCustomize()
{.
.
.
pDlgCust->AddButton(_T("Build"), CMFCDropDownToolbarButton(_T("Add Resource"), &m_wndTBM));
}
ReplaceButton THROWS A DEBUG ASSERTION
Code:
CMFCDropDownToolBar m_wndTBMode,m_wndTB2;
afx_msg LRESULT CMainFrame::OnResetToolbar(WPARAM wParam, LPARAM lParam)
{.
.
.
m_wndTB2.ReplaceButton(IDB_DUMMY_TBAR2, CMFCDropDownToolbarButton(_T("Add TBMode"), &m_wndTBMode));
}
void CMainFrame::OnViewCustomize()
{.
.
.
pDlgCust->AddButton(_T("Build"), CMFCDropDownToolbarButton(_T("Add Resource"), &m_wndTBMode));
}
-
August 11th, 2021, 01:19 AM
#2
Re: A CMFCDropDownToolBar Question
Use debugger to step in the code to see where exactly and why the assertion fails.
Victor Nijegorodov
-
August 11th, 2021, 08:22 AM
#3
Re: A CMFCDropDownToolBar Question
Originally Posted by VictorN
Use debugger to step in the code to see where exactly and why the assertion fails.
It's happening inside the mfc140ud.dll file created by microsoft
so i'm going to assume that the method i'm trying is not allowed
i'm fairly good at finding errors in my code but through other files not created by me that's another story
can you traverse through dll files to see code?
and my other alternative is programmatically placing a CMFCToolbBar hosting a CMFCDropDownToolBar at the cursor position
it seems to be that CMFCToolBars are placed in a pane placed by the framework at the beginning along the border chosen and from there the user can move it and position is stored via the registry
-
August 11th, 2021, 08:44 AM
#4
Re: A CMFCDropDownToolBar Question
You can do the following:
1.Look at the Call Stack window, click at the line with mfc140ud.dll. If it is disabled then first try to load external code (see https://docs.microsoft.com/en-us/vis...r?view=vs-2019, https://docs.microsoft.com/en-us/vis...e?view=vs-2019)
Or
2. Just open the source file (...\ATCMFC\Src\MFC\afxdropdowntoolbar.cpp from your Visual Studio folder) and find what is on and around the line 554.
Victor Nijegorodov
-
August 11th, 2021, 09:03 AM
#5
Re: A CMFCDropDownToolBar Question
thank you for your quick reply,i found the file in a search on my computer and the toolbar requesting the first button is coming back NULL
Attachment 36006
now to figure out why
-
August 11th, 2021, 09:18 AM
#6
Re: A CMFCDropDownToolBar Question
Originally Posted by jstoll
It's happening inside the mfc140ud.dll file created by microsoft
so i'm going to assume that the method i'm trying is not allowed
i'm fairly good at finding errors in my code but through other files not created by me that's another story
can you traverse through dll files to see code?
and my other alternative is programmatically placing a CMFCToolbBar hosting a CMFCDropDownToolBar at the cursor position
it seems to be that CMFCToolBars are placed in a pane placed by the framework at the beginning along the border chosen and from there the user can move it and position is stored via the registry
Please, don't delete the posts having some important info, particularly the posts on which there already exists the answers!
Victor Nijegorodov
-
August 11th, 2021, 09:20 AM
#7
Re: A CMFCDropDownToolBar Question
Originally Posted by jstoll
thank you for your quick reply,i found the file in a search on my computer and the toolbar requesting the first button is coming back NULL
Attachment 36006
now to figure out why
But does this second toolbar contain any buttons? And did you load it before replacing the button?
Victor Nijegorodov
-
August 11th, 2021, 09:59 AM
#8
Re: A CMFCDropDownToolBar Question
sorry about the deletion, after i posted the reply i found the file and i didn't want to waste anybody's time not realizing it was answered
-
August 11th, 2021, 12:06 PM
#9
Re: A CMFCDropDownToolBar Question
yes but the button i'm testing for the dropdown was an actual button,i replaced the id with a dummy one to connect the dropdownbar, i decided to press ignore after the assertion and the program actually contued on,the icon, one of the 2 buttons appeared as a dropdown control but i'm in another dilemma now I don't think it's going to work, as you press the button down to drop the toolbar and select, the actions are release and the button chosen will be placed in the que but after looking at it it's like having to controls on one button which is like bonnie and clyde pissed off at each other,so the only options i have is creatng a 1 button toolbar and adding the dropdown toolbar or a 2 button popup toolbar and programmatically placing them,can this be done with the mfc toolbars
-
August 15th, 2021, 06:54 PM
#10
Re: A CMFCDropDownToolBar Question
I tried using FloatPane() and Initially it does pretty close to want i want,it places the toolbar near the button i press, theres a couple problems though
1: when the toolbar is in floating mode there's a title bar with a close button how do i get rid of it?
2: when the program initially starts, the floating window programmatically is placed where i want it via the postion of the mousepos, but if i move the toolbar the floating toolbar stays where it last was, if i move the floating toolbar it stays where it is,i used DM_UNKNOWN
DM_UNKNOWN: The framework uses this option when the docking method is unknown. The pane does not store its most recent floating position. You can also use this option to programmatically dock a pane when you do not have to store the recent floating position.
virtual BOOL FloatPane( CRect rectFloat, AFX_DOCK_METHOD dockMethod=DM_UNKNOWN, bool bShow=true); Parameters. rectFloat [in] Specifies the screen coordinates where the floating pane appears.
Code:
void CMainFrame::PositionCylMethodsTB(CPoint mousePos)
{
CRect size (mousePos.x, mousePos.y, mousePos.x+40, mousePos.y+40);
m_wndTBCylMode.SetPaneStyle(CBRS_ORIENT_HORZ | CBRS_FLOATING| CBRS_BORDER_3D| CBRS_NOALIGN);
m_wndTBCylMode.FloatPane(
size,
DM_UNKNOWN,
TRUE);
m_wndTBCylMode.SetWindowText(NULL);
m_wndTBCylMode.ShowPane(
TRUE,
FALSE,
TRUE);
}
i used SetWindowPos() to place the window after the window was placed and it doesn't change the position
how can i make this work please?thanks
-
August 16th, 2021, 07:59 AM
#11
Re: A CMFCDropDownToolBar Question
thanks VictorN for the additional help on debugging, much appreciated
-
August 17th, 2021, 04:41 PM
#12
Re: A CMFCDropDownToolBar Question
m_wndTBCylMode.SetPermament(TRUE); gets rid of the x(close) button still trying to get rid of the title bar
Last edited by jstoll; August 17th, 2021 at 04:48 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|