Show same dialog twice in nested tab structure - mfc

In a nested tab structure of type CMFCTabCtrl(e.g. CMFCTabCtrl as Tab in parent CMFCTabCtrl), how can I show a parents tab inside the parent tab and a child CMFCTabCtrl tab?
ParentTab1 ParentTab2 ParentTab3 <-- PARENT CMFCTabCtrltabs
ChildTab1 ChildTab2 ParentTab2 <-- ParentTab3/"Child" CMFCTabCtrltabs
My first approach was basically to completely ignore that I have now "2" parents for the dialog displayed inside ParentTab2, but I get into all sort of graphical problems. How would I overcome this need for 2 parents? Can I create some sort of soft copy in order to show ParentTab2 also inside the child CMFCTabCtrl and still keep both views responsible for click events etc.?

Related

C++ MFC Attach different dialogs for each tab in CTabCtrl

I have a small project I'm working on. It has multiple dialogs so what I want to do is to have 1 main Window with multiple tabs in it. I want each tab to represent different dialog. For now I have that : Dialog with CTabCtrl opens as I expect and I have 3 tabs attached to it, when I press (for example) tab 1 it creates a new Modeless instance of my wanted PopUpDialog and it appears right where I want it. All good. But then if I move my main window , my PopUpDialog (which is borderless) stays on the same spot where he pops up at the start. Seems like the "spawn" location of my dialog is mapped to my CTabCtrl Dialog but it's not attached to it. I think I need to make it a child class or something like this . I am new to MFC and programming. I've been looking for answers for past 2 days but many links were deleted because they're too old. This is a little code example of what I'm doing:
void CTabCtrlDialog::OnSelchangeTab(NMHDR *pNMHDR, LRESULT *pResult)
{
CDialogIwantToPopUp *m_Page;
m_Page = new CDialogIwantToPopUp();
m_Page->Create(IDD_POPUP_DIALOG, m_tabTest.GetWindow(IDD_POPUP_DIALOG));
m_Page->ShowWindow(SW_SHOW);
}
This is a function (in my dialog that contains the tab control) that is responsible for click on any tab event.
I find it easiest to use a property sheet in this situation, but if that isn't appropriate for you, you need to ensure each page has the DS_CHILD style (Style: Child in the resource editor property list).
When creating the page, its parent window should be 'this' rather than what you're doing with GetWindow().

Switch layouts of CWnd inside CVIew

I have MDI application with Document/View enabled.
Inside CView class of the application there are created several CWnd derived child windows(different views) and then placed inside tab control (CMFCTabCtrl), which is also created in application CView class. So, I can see tabs inside each application document and by switching between these tabs, see each child view. For example, one view with OpenGL data visualization, another with text editor window, third with table visualization and so on.
Now, I want to add possibility to see all created child views simultaneously, separated with split control inside one document and switch between this new layout to tabbed layout, mentioned above, and vice versa by menu command.
So, I wonder what is the best way to accomplish my task
Thank you in advance
The SWSPLIT sample app on MSDN does just about everything that can be done with views and splitters.
http://support.microsoft.com/kb/199515/en-us

Tab Order with CTabCtrl and child CFormViews

In my application I have a CFormView with a CTabCtrl, I also have 4 CFormViews that are children of the main CFormView and that are shown/hidden when the user changes the selected tab.
However, I can't find a way to make the Tab Order to work properly. If the CTabCtrl has the focus, pressing the Tab key has no effect and if one of the child CFormView has the focus the Tab key will move the focus only around the controls inside the CFormView.
I tried changing the z-order of the visible child CFormView to be right after the CTabCtrl with SetWindowPos, changed the child CFormViews styles to WS_EX_CONTROLPARENT but nothing seems to work.
You've started out from the wrong implementation: you shouldn't make a CFormView with a CTabCtrl and then stuff more CFormViews into it. This isn't going to work right. Instead, you should work with CPropertySheet and CPropertyPage, where focus handling has already been taken care of. You will still be able to access the CTabCtrl owned by the CPropertySheet by calling GetTabControl(), but MFC will take care of the problems you've encountered.
Briefly: derive classes from CPropertySheet for each of the dialog windows you want to show (e.g., CConfigPage1, CConfigPage2). Create a Dialog resource in the Resource Editor for each of them, and do all of the other standard CDialog setup.
Next, derive a class from CPropertySheet (e.g., CProps), and (optionally) handle WM_SIZE and TCN_SELCHANGE.
Finally, derive a class from a CView descendent, like CScrollView (e.g., CViewMyAwesomeStuff). Then add member variables for the CPropertySheet and CPropertyPages, and handle WM_CREATE where you Add() each page to the property sheet and then Create(this,WS_CHILD|WS_VISIBLE) the property sheet.
Bonus: You can forward the CView::OnUpdate to each child CPropertyPage by calling GetPage() in a loop and calling a function on each of them, or you can send a message to each of them (use a user-defined message, like WM_APP+1). They can discover their parent's CDocument by calling GetParent()->GetParent()->GetDocument().

How do I set focus to CEdit in child dialog that is inside TabCtrl?

I have a dialog box (CDialog) with owner-drawn CTabCtrl in it. Tabs content are child dialogs (one for each tab). There is an CEdit in each tab. When the user clicks a tab, I'm hiding all child dialogs using ShowWindow(SW_HIDE) and showing a selected one.
The problem is that when I have, for example, two tabs, click inside an edit box in the first tab and then switch to second, input focus stays on that (invisible) edit box in the first tab no matter what I do in my code (tried calling all methods that potentially can set focus, nothing changed).
Try this:
GetDlgItem(IDC_YOURCONTROL)->SetFocus();
Or the related variable linked with the control:
m_YOURCONTROLControl.SetFocus();

How can I have a dynamically changing menu in a single QMainWindow, multiple nested QWidgets application on Symbian Qt?

My application consists of one QMainWindow, and a nested QStackWidget containing the rest of the application "forms".
I would like to have a soft-key activated menu on each of those sub forms.
How is this possible?
Hi sabbour here is the link,which gives you a detailed info, perhaps this could be very useful
You need to create the Multiple widgets and associated menu items, when you load the widget in stack, you need to load your menu items accordingly in the mainwindow menu bar. Note your menu bar is constant and only menu items will be getting changed.