How to avoid Flickering in my SDI application? - mfc

I created an SDI application in vc++ having multiple views in it. When i re-size the SDI application it is getting flickered. I tried returning "TRUE" in "oneraseBackGround" function.
But that is causing my application refresh issue.
Please guide me on the same.

You need to use double-buffering. Let me share with you an interesting link where a class which solves your problem is implemented:
http://www.codeproject.com/KB/GDI/flickerfree.aspx
I hope it can solve your problem.

Related

Resize QDockWidget without undocking and docking

I found a weird behaviour of QDockWidget when I tried to insert it into own application. The problem is that after dragging border of widget, it size goes back, so I can't change its size. So then I opened official qt example. But the same problem exist in this example. You can see it below. (After undocking and docking again problem disappears)
Another KDE applications in my system doesn't have such bug, so I think there is some function in Qt wich fixes this problem. Please help me to fix this example.
The only thing you need to do is to call QMainWindow::resizeDocks. After that the bug will disappear.

Qt mac switch between panels without changing window

I extensively researched this topic, mainly hindered by that I'm not sure I'm using the right words to describe my issue.
So the point is I'm developing a GUI application in C++ with Qt. The app is being developped on Mac and ftm it's intended only for mac deployment.
I want my app to behave much like System Preferences on Mac, thus accessing different views/panes by clicking buttons on the toolbar.
What I want to avoid is to have one separate window for each pane.
The closest thing I found seems to be QStackedWidget however I'm not sure what's the best way for implementing it.
Should I use it as the main class of my application? Or can I treat it as an object of MainWindow? I'm not a Qt Expert so any further insight or suggestion will be much appreciated. Thanks
QStackedWidget is definitely the way to go. Use it as your main 'container' for your widgets and implement a default main panel widget which contains your entry items, then when you click on one you can push it to be the currently displayed widget in the stack. You could try more complicated solutions to achieve it, but it's significantly easier to do with a QStackedWidget and then focus on how the interaction is handled.

Upgrading an MDI application with MFC Ribbon

I have an old style MFC MDI application. Now that VS 2010 has included a ribbon in VC++, I would like to upgrade my application with MFC ribbons. I also would like to give the user an option to retain the old style if he prefers to. That is the user should be able to switch between the classic view and the modern ribbon view while the application is running. Could you help me with achieving this please?
Many thanks.
There is on best walkthrough given by MSDN Walkthrough: Updating the MFC Scribble Application which may help you else provide your code or where exactly you are stuck.

TabControl MFC visual studio 2008 in C++

I have never used MFC so far. I'd like to learn how creating a simple tabcontrol in a SDI application. I'am looking for a very beginner guide or a tutorial? Could you help me?
Thanks
I've not installed it on this machine, but as far as i remember, there is a wizard alowing you to create a dialog-based TabCtrl-Application. You could get all you ned to know from htere. Also you may find this Link useful:
http://www.codeguru.com/cpp/controls/controls/tabcontrols/article.php/c5239/Creating-a-CTabCtrl-Application.htm
Please bear in mind that the TabCtrl is just the tabs, not the space they show – this is a window that you have to make visible, so the usual approach is a couple of windows with the same screen location and the tabctrl makes one visible and hides the others by clicking on it.

How to hide/collapse main menu in a win32/mfc application

I always been interested on how we can accomplish this (hide/show the main menu using the alt key), and now some applications do this very often. One that really please me is the visual studio 2010 with this plugin:
http://visualstudiogallery.msdn.microsoft.com/bdbcffca-32a6-4034-8e89-c31b86ad4813?SRC=VSIDE
(firefox also do this, but i think that is in a different way)
Can anyone explain me how this can be achieved or if you known of any sample project that demonstrate this please tell me.
(what i can see in some replies here in stack is that we have to destroy the menu when is to hide and create it when is to show?! but this seems a bit bad solution...)
Thanks
The SetMenu function lets you add/remove the menu from the window. It does not destroy the menu.
Note that most applications which have the dynamic menu hide/show behavior are not really showing a menu. They're showing a custom control that looks like a menu.
You might also take a look at MFC support for auto hiding menus. I used this technique and it worked really well.
in CMainFrame::OnCreate I did
m_wndMenuBar.ShowWindow(SW_HIDE);
which actually works fine in our project
I stumbled across a related pit fall that will show a hidden main frame without your consent:
Whenever the focus for a child window in an MDI application changes (e.g. due to right clicking in it), the function CMDIChildWnd::OnMDIActivate will be called, which in turn shows the main menu (even if it was removed or destroyed previously) of the MDI application.
This works basically by adding the saved main manu from the underlying's CMDIChildWnd m_hMenuShared variable.
A quick&dirty hack to prevent this, is setting m_hMenuShared to NULL (it's protected in CMDIChildWnd so this needs a custom derived child class of CMDIChildWnd) for all child frames.