|
Can any one help me, abt how to use a modeless dilog box as a modal dialog box ?
|
|
|
|
|
Kind of late , but I did it like this:
CDlgLogin* pDlgLogin= new CDlgLogin(theApp.m_pMainWnd);
pDlgLogin->Create (pDlgLogin->IDD,theApp.m_pMainWnd);
pDlgLogin->CenterWindow (NULL);
pDlgLogin->ShowWindow (SW_SHOW);
pDlgLogin->UpdateWindow();
theApp.m_pMainWnd->EnableWindow (FALSE);
pDlgLogin->EnableWindow (TRUE);
And it worked in VS2008 MFC + Feature pack.
Don't know if it is wright or wrong,
but I did get what I wanted this way.
The downside was that I had to call both
pDlgLogin->EndDialog() And
pDlgLogin->DestroyWindow()
to make the dialog properly close.
|
|
|
|
|
I compiled the example exactly as shown in code project with VC++6.0. I can not type into the text box. The only control that works is the ok and cancel. I am starting the child dialog by using the drop down menu under "FILE".
I am learning MFC so any help you can give me help why it does not work
alan
|
|
|
|
|
Hi!
That is a list control not an edit control. Which means that you cannot type text inside this control.
If you need to type text into something, go to resource editor, delete the list control and add yourself an edit box.
Best wishes,
Christian.
I am in love with VC++
|
|
|
|
|
I had the same problem as quite a number of people on this forum - the child dialog appeared correctly, and the controls were visible, but nothing happened when I clicked the controls.
The solutions is to ensure that the you create your child dialog with it's parent window being the dialog which it is a child of. The code in the article actually does do this.
<br />
m_pModeless->Create(IDD_DIALOG1, this); <br />
<br />
m_pModeless->Create(IDD_DIALOG1); <br />
<br />
Interestingly, the call to the dialog constructor does not need the explict parent window parameter. If you put "new CDropDlg(this)", your code will still work, but "this" is not necessary. It is necessary in the "Create".
- Steve
(Stephen Hosking)
|
|
|
|
|
I am confident this is the correct solution. If it doesn't work for you, please post here, and I'll try to have a look at the problem. (if the system works, and I receive notification of responses in this thread)
|
|
|
|
|
I've created a dialog box intended it to be a part of my main window so i set its style to Child. But once the program is running all the buttons on my dialog is disabled. It is as if the dialog box is always inactivated. I don't know how to fix this.. help =(! Or is there another way that I can attach my dialog box to my main window without having it as a child window?
|
|
|
|
|
|
Hi!
The solution is to set Style to Popup instead of Child.
Best wishes,
Christian.
I am in love with VC++
|
|
|
|
|
How can i call a function in formview class when one of it's modeless dialog is closed or opened
|
|
|
|
|
i m working in database using mfc(dialog based window). i have to create a child window with different edit text on it so i want to use a button to access that window .
plz if u know send it to me
|
|
|
|
|
I have created two dialogs(classes) in the same project. Now I want 2 call a dialog from another using a button. Can any 1 help?
|
|
|
|
|
You can use like this.
void CExoTransferDlg::OnOpenNewDialog()
{
CDialog2 Dlg;
Dlg.DoModal();
}
|
|
|
|
|
I'm a newby, I'm using this code to create a modeless dialog in a dialog based application. my problem is:
If I open the modless dialog, and than click on the parent dialog, the modeless dialog stays in front, and blocks the view of the parrent dialog.
what shold i do?
|
|
|
|
|
you should set the style of the modelless dialog to be child.
null
|
|
|
|
|
Hi I've the same problem and when I set the style of the dialog to be child
it also didn't work..
I've tried it with ModifyStyle(0, WS_CHILD) and tried it with adding WS_CHILD
to the Dialog resource in myproject.rc ....
What must I do to get it to work ??
THX
DarkCloud14
|
|
|
|
|
Detected memory leaks!
Dumping objects ->
D:\Down\step1\OtherDropDialogThread.cpp(18) : {174} client block at 0x00345C20, subtype 0, 112 bytes long.
a COtherDropDialogThread object at $00345C20, 112 bytes long
AfxBeginThread( RUNTIME_CLASS(COtherDropDialogThread) );
How to Kill thread??
^^;
|
|
|
|
|
This might be a stupid question, but im a newbie...
If i intend to use a lot of diferent dialogs in a CFormView window, which works better, or works at all? : the modeless method used on this article, changing the dialog used in CFormView class (enum{IDD_DIALOGx}) or creating a different CFormView class for each dialog? Im working with Splitter windows so, if the last case applies, how do i do it?
Miguel Lopes
|
|
|
|
|
I am having the same problem that someone else posted. I create the child window, it moves around as a child, but I can't enable it. Even when I click it, it stays disabled and I cannot use any of the objects in it.
Please respond.
Chris Karpinski
|
|
|
|
|
Please note:
I am setting the property of the child dialog box as child because I NEED IT to stay within the main window, and not be able to move around the entire desktop
|
|
|
|
|
My objective is also the same. So once i set the dlg property as Child, all the buttons are disabled. It is as if the dialog box is inactivated and the focus is now on the main window. I want to be able to switch between the two windows. HELP =(!
|
|
|
|
|
Everything seems to work fine except....
I want the modeless dialog to be a child of the view or the main frame. Meaning, I want it
contained within the view or main frame (clipped by the parent's edges). When I set
the style flag of the child dialog to Child, it does that part correctly (clipped
and constrained by the parent). However, when I do that the dialog seems to be disabled:
the title bar remains gray and I cannot click to activate an edit box on the dialog
(although all the buttons still work as usual).
What gives? More importantly, how do I overcome that?
Thanks.
David.
|
|
|
|
|
Once, I got a similar problem. I needed a pop up window. When called, the popup window was appearing disabled.
I did the following changes and it worked, I dont know if this helps;
Dialog Properties.Styles Tab.Style : Popup
Dialog Properties.Styles Tab.Border : DialogFrame
Dialog properties.Styles Tab.System Menu : Checked
Dialog Properties.More Styles Tab.Disabled : Unchecked
Nice Özgürce
|
|
|
|
|
hi,i also encounter the problem,finally how do you overcome it?
|
|
|
|
|
In the message handler OnModeless there are compilcations.
I had a CListControl taking up all the space on the 2nd dialog and
in the method OnKillfocusList(NMHDR* pNMHDR, LRESULT* pResult) I
added this->DestroyWindow(); (Which produced the PostNcDestory etc etc)
However when I tried to Create(ID_2ND_DIALOG, this) the 2nd time I got a
DebugBreak which I could not locate in the source. I went down the whole
path of just re-using the first instance of the Dialog (so Create is only
called once) but I didn't like it.
So, I added this :
const int WM_CUSTOM_DESTROY = WM_USER+100;
void C2ndDlg::OnKillfocusList(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
// this->DestroyWindow(); We don't want to call this any more.
this->PostMessage(WM_CUSTOM_DESTROY);
}
void C2ndDlg::OnCustomDestroy(UINT, UINT)
{
this->DestroyWindow();
}
and to the MessageMap
ON_MESSAGE(WM_CUSTOM_DESTROY, OnCustomDestroy)
Suddenly it works!
Which allows me to NOT maintain all the pointer to the C2ndDlg objects
and instead add 'delete this' to the OnPostNcDestory() as in MSDN.
FYI:
What this means is that stuff is happening After the OnKillfocusList
which needs to happen before we can call DestroyWindow, its just really
hard to find out what.
If anyone know can they please reply.
Thanks
Jules
|
|
|
|