Docking on MDI Client area in C++ - c++

I need Mdi application with docked panels on all sides of MainFrame.
but dock panels I created can't to be docked to center of the screen, because of MDI Client area.
Is there any way to hide or remove mdi client area and enable dock panes to be docked to center of the screen?
Thank you for your help!!

There seems to be some issues with your design.
"Docking" itself means taking help of the sides of the window so that your panes can fit & rest over there.
If you want something to appear in the center then you would create a document that has a form view (CFormView). The form view will use the pane's dialog template.

Related

Is there a way to attach or anchor two QWidgets together?

I'm getting started with Qt and decided to build a full-screen text editor. I want to have a button (button with arrow in screenshot) attached to a QDockWidget which opens and closes it so the button is always visible to the right side of the screen and stay anchored to it when dock is visible or resized.
My current app is a simple fullscreen textEdit set to centeralwidget in Mainwindow.
I haven't found a way to do this yet with layouts or existing addAnchor() functions so any help or direction is appreciated.
You can achieve what you want by using a container for your text edit and the button. A QWidget instance can be used as an "invisible"*** container for other widgets.
So in Qt Designer you add a widget as a central widget of the main-window, inside this widget you add the text edit and the button, then you set a vertical layout for this container widget.
Don't forget to restrict the docking widget to only dock to the right side, you can do that with: dock->setAllowedAreas(Qt::DockWidgetArea::RightDockWidgetArea); //assuming dock is the pointer to your QDockWidget.
In case you want the dockWidget to be able to dock to any side and the button to follow, you can do that too, but it get a little bit more complicated. Basically you need to connect a slot to dockLocationChanged of your dockWidget and based on where it's docked you need to set-up a new layout for the container widget to be vertical or horizontal and the order of the textEdit and the button based on the side the dock happened.
LE:*** you will most likely need to set the margins you want, since both the widget and it's layout can have them and the actual content might have higher spacing than you want.

MFC: allow docking to main view

In Visual Studio, you can dock arbitrary panes to the main view in the center of the window:
In the above image, the Error List pane is being docked to the main view.
I'd like to do that with CDockablePanes in MFC. However, it appears that by default, docking panes to the main view isn't allowed. Is this possible with MFC? If so, how is it done?
Panes are normally docked to the CMainFrame, and they can be docked above the main view.
If you need to dock them inside your view they should be created (and docked to) in the CChildFrame.
Make sure to use .EnableDocking(CBRS_ALIGN_ANY); and EnableDocking(CBRS_ALIGN_ANY);
In case you are referring to converting a dockable pane to a tabbed document, right click on the pane header and select 'Tabbed Document'.
Also check out CDockablePane::ConvertToTabbedDocument and m_bCanCovertControlBarToMDIChild.

Put a window behind desktop icons

currently I've this but it doesn't put my window behind the desktop
SetWindowPos(hWnd,HWND_BOTTOM,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,SWP_FRAMECHANGED);
ShowWindow(hWnd,SW_SHOWNOACTIVATE);
i want to put my window behind every window even the taskbar and desktop icons window
please help me how can i do this
thanks in advance
The Desktop is a ListView control, and the desktop icons are its list items. Top-level windows can be made children of that ListView window, but it is impossible to place a child window between the ListView's background and its list items. The only way to make anything appear behind the items is to draw directly on the ListView's background, such as by subclassing it to intercept its WM_ERASEBKGND and WM_PAINT messages.

Child Window painting problem on Vista only

I have a dialog-based MFC C++ app. My dialog displays a number of "pages" (similar to a tab page or property dialog box).
I display each "page" by displaying a Child window over the top of the parent's client area. This works fine on Vista until I then open another window on top of the child.
Vista then seems to draw a thick white rectangular frame within my parent dialog box which paints over the top of my "page" child window(s). If I move another window over the top of this white rectangle, it will repaint the obscured area just fine.
Can somebody please tell me what is going on? Is Vista trying to clear my non-client (frame) area using incorrect coordinates perhaps?
My parent dialog is a skinned class derived from CDialog which handles the painting of my own window titlebar and frames. I've found that if I don't call CDialog::OnNcActivate() within my own OnNcActivate() method, the white rectangle doesn't appear. Of course if I do this then I can't use my child windows.. but OnNcActivate would appear to be related to the problem.
I've figured out the problem.. I shouldn't be calling CDialog::OnNcActivate() - I should have just been returning TRUE instead. All working fine now.

Can I draw a menu (not popup menu) in any rectangular region of a window with MFC?

I override OnNcPaint() method along with OnNcLButtonDown() and OnNcMouseMove() and OnNcHitTest() method. So the original menu of the window doesn't exist. I want to add a menu with the area of the caption bar. How can I do this?
Thank you very much!
The menu is painted as part of the non-client area. So if you are doing your own non-client painting, you'll also have to draw the window yourself. You may be able to hack something out with TrackPopupMenu to do the actual menu drawing, and you'll just have to handle the menu bar and top-level menu items yourself.
Drawing the non-client area yourself is fraught with peril. Are you sure you don't just want to use an owner drawn menu?
It can be tempting to tweak your UI dialogs to fit your exact needs, but also keep in mind that it is jarring to users who are accustomed to the look-and-feel of windows already.