Application structure with three main windows - mfc

I want to build a level/game editor that looks like the Skyrim Creation Kit. On the image you can see:
the main window/frame with a menu, a toolbar and a status bar at the bottom,
the Render Window that displays the current loaded level,
the Object Window that contains every objects/entities used in the game,
and the Cell View that contains on the left a list of all the levels and on the right all the entities belonging to the current loaded level.
One thing to note is that these three windows are floating, you can move them around and should always be present while editing a level.
I'd like to have some advice on how should I structure my MFC project in order to mimic the Skyrim editor: I don't know if I should use CDialog or simply CFrames for each window. If you want to know what I've done, you can read the following paragraphs.
Here is a picture showing what I've managed to do.
With MSVC I created an MFC project "based on dialogbox" but I don't know if it is a mistake, maybe I should have chosen the SDI template because there is indeed a single document (the document is all the data for the game which consists of entities, levels, spritesheets, sounds effects, scripts, dialogues...).
For now I have managed to create the main window and the render window. The main window is derived from CDialogEx and is created by calling DoModal() in the InitInstance() of the applciation.
BOOL CGameEditorApp::InitInstance() {
// ...
CGameEditorDlg dlg; // main window derived from CDialogEx
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
// ...
}
Inside OnInitDialog() of the main window, I create the render window like so
BOOL CGameEditor1Dlg::OnInitDialog() {
// ...
m_RenderWindow.Create(IDD_DLG_RENWIN);
// ...
}
Now I have a problem when trying to create the object window. In order to replicate the one of the Skyrim editor, I want a CSplitter with one row and two columns: the left pane would have the Filter option and a CTreeCtrl and the right pane would have a CListCtrl. So I tried to use a CDialog jsut like the render window but it appears that it is not possible to split a CDialog object. Now I've found a code sample where a CFrameWnd was created inside a CDialog and then a CSplitter was possible inside this frame but I cannot make it working since my knowledge of MFC is very little.

Related

window procedures for dialog box controls

I've created a dialog box with buttons in it using Visual Studio's resource editor, and I want the buttons to display different icons under different circumstances.
I gather that in order to set an icon for a button, I need to send a BM_SETIMAGE message to a window procedure for that button.
I'm not clear on what handling such a message would involve, but I haven't gotten to the point of figuring that out, because I don't see how to associate a window procedure to a button in the first place. I'm used to associating a window to its window procedure by passing a pointer to the procedure into the function that initializes the window, but that doesn't seem to apply here since the buttons are initialized automatically when I initialize the dialog box.
I thought there might be a way to specify window procedures for controls in the resource editor, but if there is, I'm missing it.

MFC floating CDialog control clipping issue

I am making an SDI MDF application that uses a frameview to provid the user with a set of controls (buttons, editboxes and such). The view also owns a set of CDialogs used to desplay aditional controls that can be can be shown or hidden via a tabcontrol and other means. Untill recently the dialogs have been staticly placed at creation to be in their proper location on the screen but I wanted to add a dialog that the user could move around but is still a child of the view. When I created a dialog with a caption and sysmenu that the user can move around the issue I am running into is that when the window is placed over another control owned by the view, (lets say a button) when the paint method is called on the button, it draws over the dialog. The dialog is still on top and the dialogs controls can still be interacted with but the button is drawn over them untill the dialog is repainted. I have tryed to change the clipchild and clipsiblings settings of the dialog and have been able to get the dialogs to properly clip eachother but can not seem to get the child dialog to properly clip the parent view controls. Does anyone have any ideas on what setting might fix this clipping issue.

How To Change Panel/view in the Windows Client Area in MFC

I want to design a student registration and exam recording app using C++ MFC with a kind of child window containing buttons edits and other common controls which is displayed on the app client area, and can be removed and replaced with another one by clicking a button. Thats the problem i face now( The GUI ). I came from JAVA background where this can be done by creating a JPanel as a container for the buttons, combo boxes and text fields controls. the panel is displayed on the client area and can be removed and replaced with another panel containing a new set of controls. I tried learning CView but it keeps talking about documents and views that displays untitled document as in word processing. Any pointer will be appreciated. Thanks.
After having searched and read a lot about my problem, i decided to go into win32 API where everything is possible depending on your awareness.The solution is as simple as creating a main window and creating any number of child windows who uses the main window as parent and all has a hiden window attribute. Then you can create controls on each child window. To switch between the child windows I did this: ShowWindow(childWindow1, SW_HIDE); ShowWindow(childWindow2, SW_SHOW);. thats it, only that the repaint process after restore does not repaint the child window's controls and its child window.

Insert an UI into another MFC Dialog

I have one MFC application (exe) that contains two panes in its main UI. This application loads another DLL that also contains one dialog. How can I programatically place a Dialog defined into the DLL, and put it into (within) the pane of the MFC application? The question is not how to programatically retrieve the dialog from the DLL but how to put this dialog 'on the top' (within, inside) of one UI pane that belongs to the application?
My goal is to customize the UI of the application with dialog(s) retrieved from a dll and give the user the feeling that these dialogs all belong to one application UI. Thanks for any hint.
I have some applications with this feature, often with a tab control to alternate between windows.
First I set a frame in the container window, invisible to the user. The frame is just a placeholder to where the dialog window will be.
Then I make an instance of the dialog window as a global variable in the container class, I create the dialog window as a modeless window (using Create(), not DoModal()), move the window to the same RECT of the frame control, and call ShowWindow() to show the window.
Am I understanding you correctly that you don't want the dialogs to appear as dialogs, but rather as content of another window, or as a pane?
In other words, you want to get rid of the dialog's title bar and embed the dialog's content into another window, is that right?
That is possible. You would need to create the dialog without the title bar (change the window style) and make sure that you create the dialog's window as a childwindow of the window where you want the content to go. I can explain this further but I first would like to know if I'm understanding you correctly.

MFC MDI CView and some kind of bar at bottom of CView

I have created a MDI project with CView's using VS2008Pro.
I want to have some sort of bar at the bottom of every CView where i
can put controls on, like buttons. I dont know how this bar is called
and how to create one for every CView.
I have a picture of it here to explain what i want.
http://www.4shared.com/dir/32975742/b4bac91c/CView_Bar.html
Could someone please tell me what kind of bar this would be and how to
create it for CViews?
Thanks.
I think, what you want is basically a Toolbar (to answer your question how it is called) in an MDIChildWindow (similar like the toolbar in the main frame window of your application which is created usually by the MFC application wizard automatically). The way to add a toolbar in a child frame window is very analogous to what the wizard has added to the main frame window. You can decide in code where the toolbar shall be located (top, bottom, left, ...)
You can find a brief "How to..." here: http://support.microsoft.com/kb/155141
Also try to google by "Toolbar in MDIChildWindow" or similar. You'll find many resources, I believe.