How To Change Panel/view in the Windows Client Area in MFC - 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.

Related

What MFC class should I base free floating views on

I have a dialog based MFC application. Now I want to create a wiew (one or more) with a toolbar, scroll bars and a client window (based on CWnd).
What MFC class should I base this window on?
What is the best way to do it?
Thanks.
Using a scrolling client window is more natural in a Document-View application than a dialog based application -- you can have menu bars and toolbars connected to a dialog, but to a View as far as I know.
A SDI application allows support for multiple docking/floating toolbars and multiple views of the same document, so this would be my advice...
Start with a CFrameWnd. It's job is to give your window a titlebar/close button etc., and position control bars (such as a toolbar) and a menu (if you want one) and a view within itself. The view should be a CScrollView (for painted graphics) or a CFormView (for dialog-like controls).
You will find this to be a lot easier if your just start from scratch and let the app wizard generate an SDI or MDI app to start with.

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.

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.

Moving layered windows concurrently in win32

i am trying to implement a custom tab control in my win32 window, for that i have used a layered window which is child of the main app window (for the main tab control) and independent windows for individual tab items.
My problem: Whenever i move the main app window, the control window moves along with it (because its the child window) where as the individual tab item windows remain on their position. Can anyone guide me how to to get the tab items windows move along with the main app window concurrently? I can not set the item windows as child of the app, so please base your suggestions on that.
You should redesign your tab to be a child window. Otherwise your attempts to make it work is nothing but a desperate try to fix the thing made bad in first place.
Still if you feel like sticking the original plan, you need to hook/subclass the main app window and handle its movement and sizing messages (WM_MOVING and friends) so that your handler could update your popup/tab window position respectively.

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.