Different width of View and Command in BCG Ribbon Main Panel (bug in BCG library) - mfc

Precondition: The application is MFC C++ that uses BCGControlBar library for UI rendering.
Topic:
We can add Backstage Views and Commands to BCG Ribbon Backstage Main Panel.
Something like it:
auto pBackstagePanel = m_wndRibbonBar.AddBackstageCategory(_T("File"), IDB_FILESMALL);
// views
pBackstagePanel->AddView(ID_BACKSTAGE_INFO, _T("Info"), new CBCGPRibbonBackstageViewItemForm (IDD_FORM_INFO, RUNTIME_CLASS(CBackStagePageInfo)));
pBackstagePanel->AddView(ID_BACKSTAGE_RECENT, _T("Recent"), new CBCGPRibbonBackstageViewItemForm (IDD_FORM_RECENTFILES, RUNTIME_CLASS(CBackStagePageRecentFiles)));
// commands
pBackstagePanel->AddCommand (ID_FILE_SAVE, _T("Save"), 2);
pBackstagePanel->AddCommand (ID_OPTIONS, _T("Options"), 3);
pBackstagePanel->AddCommand (ID_APP_EXIT, _T("Exit"), 3);
But BCG Backstage Main Panel has UI bug: ribbon buttons for views (method AddView()) and commands (method AddCommand()) are rendered with different widths!
So hovered or focused state of ribbon button for command are rendered narrower than for views by around 6px.
You can see this bug even in BCG samples that use BCG Ribbon (e.g DrawCli):
Question:
Do you know the way how to fix it and have equal width for all elements in the backstage main panel?

BCGSoft will not fix anything. I have used their lib for years and their 48 hours "help" is useless. Basically, they always reply that the reported problem is MFC and not with their software. It is so poor, I am re-writing my entire framework into straight MFC. This removes the GUI lib's layer of indirection. Not that MS is much better at responding to GUI MFC bugs, though.

Related

NSIS - Default Installer Width/Height

i have several setups created with nsis (modernui).
Is there any possibility to change the default width/height of the installer?
Regards and thanks,
Dennis
The NSIS UI is actually a main dialog window with a inner dialog where the page content is displayed:
If you want to display multiple pages then you pretty much have to accept this design and use a 3rd-party tool like Resource Hacker to redesign the dialogs. If you want to do this then you should create a copy of "NSIS\Contrib\UIs\modern.exe" and edit it, then use the ChangeUI instruction to select the new UI file (!define MUI_UI yourfile.exe (and possibly the other MUI_UI_* defines) when using the MUI).
On the other hand, if you are developing a autorun splash screen or something like that then you could resize the inner dialog so it covers the whole outer dialog area.
There is no simple attribute that just sets the desired width and height because all controls on all pages also need to be resized and moved...
Have a look at this tool: Graphical Installer for NSIS (a little self promo :)
This tool is capable of changing dimensions of installer + has a lot of other features like installer skinning and many more.

Quick Access Toolbar (QAT) doesn't shown in Ribbon MFC

I'm converting an existing application to use ribbon. I'm using visual studio 2012. I tried to add buttons through QAT properties editor in the ribbon designer. The QAT shown in the Test Ribbon mode correctly. But It's not shown when I debugging the application. The dropdown box button is there but not functional.
I've also tried to add buttons in code, but it makes no difference:
MFCRibbonQuickAccessToolBarDefaultState qatState;
qatState.AddCommand(ID_FILE_SAVE);
qatState.AddCommand(ID_EDIT_UNDO);
m_wndRibbonBar.SetQuickAccessDefaultState(qatState);
Any idea would be appreciated. The part of QAT in ribbon1.mfcribbon-ms is:
<QAT_ELEMENTS><ELEMENT_NAME>QAT</ELEMENT_NAME><QAT_TOP>TRUE</QAT_TOP><ITEMS><ITEM><ID><NAME>ID_FILE_NEW</NAME><VALUE>57600</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM><ITEM><ID><NAME>ID_FILE_OPEN</NAME><VALUE>57601</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM></ITEMS></QAT_ELEMENTS>
I solved it. In the CAppnameApp::InitInstance() function in the Appname.cpp, call InitContextMenuManager() function. This initialize the CContextMenuManager object which manage shortcut menus. This object is introduced in VC2008. Also other functions like InitShellManager(); InitKeyboardManager(); InitTooltipManager();need to be called at the same place.

how to navigate one page to another page in nokia qt C++;

hi i want to make an application for nokia in nokia qt sdk.
so please help me how to navigate one page to another page in qt C++ when user press the button in one page.
There's no page concept in Qt, but you can simulate it with other widgets or components. A couple of examples:
Using Qt Desktop Widgets: http://wiki.forum.nokia.com/index.php/Create_a_page_based_UI_with_QStackedWidget_and_QToolbar
Using Qt Quick: http://doc.qt.nokia.com/4.7/declarative-modelviews-visualitemmodel.html
In Qt Quick you can also do it by changing properties like visibility or position of elements like rectangles.
And there are other ways to do this, search for examples in Forum Nokia Wiki or in Qt DevNet.
Just write in click event of button:
manwindow *mainwindow2 = new mainwindow();
mainwindow2->showExpanded();
There is also the concept of a wizard in QT:
http://doc.qt.io/archives/qt-4.7/qwizard.html
I'm not sure if that is what you are looking for as far as look n feel, but it is pretty convenient. You simply add pages to the widget itself and it will create the "Next" and "Finish" buttons for you as well as the page navigation.
Beyond that, do as Mkfnx suggested and use a stack widget or just have a dynamic dialog where you subscribe to your button events (using the connect() ) function and hide/show your widgets as you wish.

How to use the Document/View architecture in MFC

I'm still working on a Data Acquisition program in MFC and am getting stuck working with the Document/View architecture. Basically, I want my application to have a couple windows. One is used to show a video that's recorded from a high speed camera, another has a plot displaying data from the DAQ system, and maybe another has controls for configuring the camera and DAQ, etc.
So, really I have a lot of modeless windows each showing a portion of the data, usually from a different source. Now, going through and using the App Wizard I get confused with the Doc/View stuff, and even though I can turn it off, it isn't technically off. Now that aside, I've tried opening modeless Dialogs and FormViews all to no success. Mostly I just can't figure out how to open the new View, the documentation isn't really helpful. I've been able to open a Modal plotting dialog from a Ribbon Button command and I mark that as a success, but not exactly what I need.
So, does anyone have helpful insight on fitting my application to the Doc/View architecture or opening a modeless dialog or FormView from within another application. I should say I'm using Microsoft Visual Studio 2010 and I'm using MFC and C++.
EDIT:
So, I've gone with MDI and will have one document that handles all the data to be shown. What I am stuck on now is how to create the multiple windows I want. I sublcassed CFormView to be the graph View of the document, and I am trying to create that window when I click a menu button. I was able to do it with a modal Dialog, like this:
void CDAQUniversalApp::OnScopebtn()
{
// TODO: Add your command handler code here
CScopeDlg dlg = new CScopeDlg(); //CScopeDlg is Subclass of CDialog
dlg.DoModal();
}
That worked, but not what I want, so I tried this, and it didn't work at all:
m_pScopeTemplate = new CMultiDocTemplate(
IDD_SCOPEFORMVIEW,
RUNTIME_CLASS(CDAQUniversalDoc),
RUNTIME_CLASS(CMDIChildWnd),
RUNTIME_CLASS(CScopeFormView)); //Subclass of CFormView
if (!m_pScopeTemplate)
return FALSE;
void CDAQUniversalApp::OnScopebtn()
{
// TODO: Add your command handler code here
CMDIChildWnd* pFrame = NULL;
pFrame = DYNAMIC_DOWNCAST(CMDIChildWnd, CWnd::GetActiveWindow());
CMDIChildWnd *pScopeFrame = (CMDIChildWnd*)m_pScopeTemplate->CreateNewFrame(pFrame->GetActiveDocument(), NULL);
if (pScopeFrame == NULL)
return;
m_pScopeTemplate->InitialUpdateFrame(pScopeFrame, pFrame->GetActiveDocument(), TRUE);
}
This just causes an unhandled exception. I really just bruteforced my way to that point finding various largely unhelpful sections of documentation code and modifying it to what I think I need.
Your different windows (for video display, data display and configuration) are actually all views (different view classes) for a single document, which manages the data (assuming the DAQ works on the video data?).
I suggest you pack your application into an MDI app, thus having a main window, with all those different views as subwindows. So you have multiple views for a single document (or even multiple documents in MDI).
MFC can be a pain, if your application does not fit the classical document/view architecture (like Word for example), but I think this would be the best way to fit your application into this framework.

How to show available windows in the Window menu

I have a MFC MDI application that I've recently ported from VS2003 to VS2008, and at the same time moved from Stingray Objective Studio 2006 v2 to v10.1. On the previous versions of my application, if I had more than one view open, the Window menu would be populated by an enumerated list of available views, e.g. 1 MyViewA, 2 MyViewB etc... If I had a large number of views, I would also get a Windows... menu option to allow me to select a view. This no longer happens, which is breaking some of my GUI level regression tests. My guess is that this functionality was implemented by either CMDIFrameWnd or SECMDIFrameWnd but I couldn't find a reference to it in the documentation. Does anyone know how I can get this functionality back.
First thing I'd do is create a new MDI application with the ClassWizard and check if the functionality you're missing is present. If so, poke around and see if you can tell what's different. One place to look may be the menu resource for the main menu.
If there is no in-built functionality to provide what you need, you can dynamically build the menu with the following pseudocode:
foreach registered CDocumentTemplate
foreach document
foreach view
{
if (numberOfWindowMenuItems < 5)
{
Add menu item
}
else
{
Add "Windows..." menu item
break all loops;
}