How to get focus from child dialog and parent dialog - visual-c++

I Have one parent dialog and one child dialog, when I loaded child dialog in parent dialog the focus is not coming on parent dialog`s control, what I do to get focus on parent dialog control?

Without seeing your code, I would assume that this is a problem with dialog styles. In particular, WS_EX_CONTROLPARENT.

Related

MFC non-modal dialog front but not topmost

Recently I would like to bring a dialog in front of it's father window(always do, no matter its father window gets focus or not) but not topmost. In other words, I only want it cover its father window but not other applications' window.
I've tried:
// this covers other windows
SetWindowPos(&wndTopMost, rectPos.left, rectPos.top, width, height, SWP_SHOWWINDOW);
// this doesn't work
SetWindowPos(&GetParentFrame()->wndTop, rectPos.left, rectPos.top, width, height, SWP_SHOWWINDOW);
Any ideas?
Xiangguan Zheng, in your original post you stated:
I only want it cover its father window but not other applications' window.
Later in your comment you mentioned:
I want do edit the father dialog by clicking the buttons on the child dialog.
These are two completely different requirements.
If you want a second dialog to be contained in the parent dialog area, you can achieve this by setting WS_CHILD style to the second dialog and calling Create. this will show the child dialog over the top of the parent and keep it within the parent area.
to fulfill the second requirement, you will have to pass the pointer to the parent dialog as the second parameter in Create call, or pass it when the child dialog is instantiated. Either way, you will have to save that pointer in the child dialog and use it to either call the public function exposed by the parent or use the pointer to send/post messaged to the parent.

Continue execution of parent Dialog in Dynamics CRM

I have a Dialog in which I've linked a child Dialog. I want to the execution of the Dialog to the parent dialog once my child dialog has completed executing.
How can I achieve this? My child dialog isn't throwing the execution back to the parent Dialog in Dynamics CRM.
That's not how they work out of the box. When you go to a child you transfer control to child and the parent ends.
You could look to rearrange your dialog;so the last step of the child, is to start the parent as a child dialog. The parent dialog would then need to somehow skip to the right page. Or it might be easier to break the parent dialog into multiple parts, which are chained together using start child.

To send a custom Message from Parent Dialog Box to child Dialog Box using SendMessage() function

There are several ways to use SendMessage()
WIN32API modal
::SendMessage(h, MY_MSG ,0,0);
MFC modal
Let's ptr having child Dialog box Handle then we can use this modal
ptr->SendMessage(MY_MSG,0,0);
But How can I get child dialog Box handle once I clicked a button in parent Dialog box see this.. I write the code
void CCustomMessageDlg::OnBnClickedOpen(){
MyDialog2 d2(IDD_CHILD_DIALOG);
d2.DoModal();
}
I Need Send Custom Message to child Dialog using SendMessage() API once Button is clicked. Can You Please Suggest A solution for this problem
You cannot send a message to the dialog after DoModal() returns, because the dialog will already be destroyed.
In case you want to pass data to the dialog, you can add a member variable to your child dialog, say:
CString m_strMyData;
Then use:
MyDialog2 d2(IDD_CHILD_DIALOG);
d2.m_strMyData = "Test";
d2.DoModal();
and access m_strMyData from within the child dialog.

How to save state of dialog so that it not closed?

I design mfc dialog based application in which first i design main parent window containing multiple child windows with tab control,it works fine.After i add one dialog before parent dialog and call parent dialog from it.So call to new dialog insert Back button on parent dialog,it works well,but second time parent dialog failed to open and application close.So how to save state of parent dialog second time initialization.I used methodlogy for above scenario given below:
I call new dialog in OnInitDialog() of parent dialog as DoMOdal() method.
Back button code given below:
void CParent::OnBnClickedBack()
{
UpdateData(TRUE);
NewDlg dlg=new NewDlg();
OnOK();
dlg.DoModal();
}

visualforce rerender the parent page table from child

I want to refresh the part of (not whole page) the parent window by clicking the button on child window.
It it is like action="action name" rerender="id" on just one page.
But from child window, is it possible to rerender the parent page part(on my case it is table)?
Please, help.
Thank you!
Yes. Simply:
rerender="ioOfParentComponent"
This only pertains to the same page, however. If you're talking about IFrames then this will not work. But within the same <apex:page > </apex:page> block, this will work.
If you want to refresh a parent window from the child, and the child is a popup and both pages are custom visualforce pages - do it per javascript callback:
Parent window:
<apex:actionFunction name="callBackFunction" reRender="refreshMe" action=""/>
<apex:outputPanel id="refreshMe">
Some text here...
</apex:outputPanel>
Child window (popup):
<apex:commandButton onClick="javascript:parent.window.opener.callBackFunction(); return false;" value="Refresh parent" />

Resources