|
rolfhorror wrote: how can these two dialogs share variables?
Do they really need to? If so, they are inherently tied together from that point forward. That's not necessarily a bad thing, but it does keep the child dialog from being re-used.
Several solutions exist:
void CMainDialog::SomeAction()
{
CChildDialog dlg(m_var1, m_var2);
dlg.m_var1 = m_var1;
dlg.m_var2 = m_var2;
dlg.SetVar1(m_var1);
dlg.SetVar2(m_var2);
if (dlg.DoModal() == IDOK)
{
m_var1 = dlg.m_var1;
m_var2 = dlg.m_var2;
m_var1 = dlg.GetVar1();
m_var2 = dlg.GetVar2();
}
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is this helpfuls you can insert this code to child dialog after user insert his text on your editbox.
<br />
After insert text to editbox on the child dialog you can get this string and use of this code (if you dont need to global cstring)<br />
CMain *m_Main=(CMain*)GetParent();
m_Main->m_EditControl.SetWindowText();
|
|
|
|
|
one solution is to pass a pointer (this) of the parent dialog to the child dialog :
MyChildDialog dlg( this );
dlg.DoModal();
But that would force a "coupling" dependance between both dialogs; maybe it's ok for your particular situation.
|
|
|
|
|
thanks alot guys, i'll try your coding.
|
|
|
|
|
Hello,
i like to modify the dialog style to WS_CHILD, and need help to do this, reason for that is that i
want to place normal dialog on other dialog as child!
BOOL CParentDlg::OnInitDialog()
{
pReportDlg.Create(IDD_REPORT, pParentWnd);
pReportDlg.ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_DLGMODALFRAME, WS_CHILD);
pReportDlg.ShowWindow(SW_SHOW);
pReportDlg.SetWindowPos(pComboFileName, 8, cRect.top, cRect.right, cRect.bottom, NULL);
}
thanks in advance
break;
|
|
|
|
|
|
Hello WhiteSky,
ähm, the dialog style stay the same, they dont change style from [popup with dialog frame] to child dialog style without frame, title bar etc.
Is there any thing what i forgot to use oder set?
thanks
|
|
|
|
|
What happens if you use of ModifyStyle instead ModifyStyleEx
|
|
|
|
|
Nothing, no errors or something, style stay without changes, the same like i create him with the assistance!
Just normal dialog, not included to my parent dialog, but like his own dialog
|
|
|
|
|
Whats return value of ModifyStyle?
|
|
|
|
|
|
Return 1 this meaning that function is working
|
|
|
|
|
break; wrote: pReportDlg.ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_DLGMODALFRAME, WS_CHILD);
Modify this to,
pReportDlg.ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_DLGMODALFRAME, WS_CHILD,SWP_FRAMECHANGED);
|
|
|
|
|
Hello Prasad,
thanks for help, the dialog i now showed with new style, without border etc., also like a child
dialog, but they is showed outside of hims parent stay only to clip the dialog to them...
BOOL CFileDialogReport::OnInitDialog()
{
const UINT iExtraSize = 220;
CWnd* pParentWnd = GetParent();
RECT cRect;
pParentWnd->GetWindowRect(&cRect);
pParentWnd->SetWindowPos(NULL, 0,0,cRect.right - cRect.left, cRect.bottom - cRect.top + iExtraSize, SWP_NOMOVE);
CWnd* pComboFileName = pParentWnd->GetDlgItem(cmb1);
pComboFileName->GetWindowRect(&cRect);
pParentWnd->ScreenToClient(&cRect);
cRect.top += 20;
cRect.bottom += 120;
cRect.left += 50;
cRect.right += 160;
pReportDlg.Create(IDD_REPORT, pParentWnd);
pReportDlg.ModifyStyle(WS_OVERLAPPEDWINDOW ,WS_CHILD , SWP_FRAMECHANGED);
pReportDlg.ModifyStyleEx(WS_EX_OVERLAPPEDWINDOW | WS_EX_DLGMODALFRAME,
WS_CHILD ,SWP_FRAMECHANGED);
pReportDlg.ShowWindow(SW_SHOW);
pReportDlg.SetWindowPos(pComboFileName, 8, cRect.top, cRect.right, cRect.bottom, NULL);
}
ok, i can set settings in the template to child and without border, but i want to try everything
what is posible to do this to runtime, any idea how to do this now?
regards
|
|
|
|
|
Hi,
I solve this now, i forgot to set the parent window ,
before i call ShowWindow(SW_SHOW);
i set the parent for my dialog:
pReportDlg.SetParent(pParentWnd);
pReportDlg.ShowWindow(SW_SHOW);
pReportDlg.SetWindowPos(pComboFileName, 8, cRect.top, cRect.right, cRect.bottom, NULL);
regards
|
|
|
|
|
You can mention parent window, at the time of creation only.
|
|
|
|
|
Your code looks correct. I did the same thing sans the call to ModifyStyleEx() and the child dialog was definitely contained within the parent. In the child's dialog template, I set the Style to Child, and the Border to None.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello David,
yes, it works too when i set the same settings like you, in the template, but i need to change
this properties to runtime, before i show the dialog...
regards
|
|
|
|
|
break; wrote: ...but i need to change
this properties to runtime, before i show the dialog...
Just out of curiosity, why? Do you not have access to the project's .rc file?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello David,
thanks for help, i have all access to project, that is not the reason, i want to learn how to
do this for the future!
And i know now!
regards
break;
|
|
|
|
|
Even if you did something like:
ModifyStyle(WS_POPUPWINDOW | WS_CLIPSIBLINGS | WS_DLGFRAME | DS_MODALFRAME, WS_CHILDWINDOW);
ModifyStyleEx(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT, 0); there's no guarantee that it will work.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ok, i'm now complete confused, but thanks!
regards
break;
P.S. i think i do this in the template, set the properties to child , with no border...
|
|
|
|
|
Greetings:
Does anybody know anything about a limit to the COMn designation that can be successfully opened by the "CreateFile" SDK function?
We have serial ports here that can take mappings greater than 9 (ie: COM10, COM11, etc...). "CreateFile" returns NULL for anything greater than COM9.
Does anybody know a way of getting around this?
Its Windows XP-Pro at the moment, but we have to expect our application to run on other versions as well. I'm using VS 2003 and MFC.
Thank you,
Mark
|
|
|
|
|
Jethro63 wrote: Does anybody know anything about a limit to the COMn designation that can be successfully opened by the "CreateFile" SDK function?
This is special case code (or hack) in the implementation of ::CreateFile() that recognizes the filename "COM" followed by one single integer. You can have COM ports from COM1 to COM255, but for port numbers above 9 you have to use "\\\\.\\COMnnn" as filename, e.g. "\\\\.\\COM10" .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hey! That, like, totally worked!!!
Thanks!
Mark
|
|
|
|
|