473,399 Members | 2,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Why disabling the parent window also disables child modeless dialo

I have the MDI MFC application ported to .NET.
Now this application include mixed managed/unmanaged code.

The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.

Here is the segment of the code:

void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)

SetText("" ) ;
SetProgressText("" ) ;

CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;

if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}

I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}

Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks
Nov 17 '05 #1
4 4122
This is correct behaviour. When parent window is disabled, children are
disabled automatically. When parent window is hidden, childrent will hide
too. To keep parent disabled and child enabled, use modal window.
-Praveen
"Steve" wrote:
I have the MDI MFC application ported to .NET.
Now this application include mixed managed/unmanaged code.

The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.

Here is the segment of the code:

void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)

SetText("" ) ;
SetProgressText("" ) ;

CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;

if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}

I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}

Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks

Nov 17 '05 #2
Thank you for your response.

Could you provide any link to msdn or other source confirming that "When
parent window is disabled, children are disabled automatically". I never
heard about this before. The situation was definitely different in VC++ 6.0.
Is it new feature of .NET?

Thanks
Steve

"Praveen" wrote:
This is correct behaviour. When parent window is disabled, children are
disabled automatically. When parent window is hidden, childrent will hide
too. To keep parent disabled and child enabled, use modal window.
-Praveen
"Steve" wrote:
I have the MDI MFC application ported to .NET.
Now this application include mixed managed/unmanaged code.

The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.

Here is the segment of the code:

void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)

SetText("" ) ;
SetProgressText("" ) ;

CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;

if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}

I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}

Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks

Nov 17 '05 #3
"If a window is already disabled, its child windows are implicitly disabled."

http://msdn.microsoft.com/library/de...ablewindow.asp

-Praveen

"Steve" wrote:
Thank you for your response.

Could you provide any link to msdn or other source confirming that "When
parent window is disabled, children are disabled automatically". I never
heard about this before. The situation was definitely different in VC++ 6.0.
Is it new feature of .NET?

Thanks
Steve

"Praveen" wrote:
This is correct behaviour. When parent window is disabled, children are
disabled automatically. When parent window is hidden, childrent will hide
too. To keep parent disabled and child enabled, use modal window.
-Praveen
"Steve" wrote:
I have the MDI MFC application ported to .NET.
Now this application include mixed managed/unmanaged code.

The application displays progress dialog with the cancel button
during lenghtly operation. This progress dialog implemented as
modeless to allow user to cancel the lenghtly operation if he
wishes. At the same time I disable mainframe window to prevent
user from clicking on the menu bar.

Here is the segment of the code:

void CCommProgressDialog::Show(CWnd* pParent/*=NULL*/ )
{
if(!::IsWindow(m_hWnd) )
{
if(Create(IDD, pParent ) )
{
m_pParentWnd = pParent ; // Create not set it (MFC Bug ??)

SetText("" ) ;
SetProgressText("" ) ;

CenterWindow();
ShowWindow(SW_SHOW ) ;
UpdateWindow() ;
SetFocus() ;

if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}
}
}
}

I notice recently that cancel button on that dialog doesn't work.
In fact the dialog is simply disable, you can't even move it.
I isolated the problem to the following code
if(pParent )
{
pParent->EnableWindow(FALSE ) ;
}

Can anyone explain, why disabling the parent window also disabling
the child modeless dialog? Has anyone experienced such problem?
Thanks

Nov 17 '05 #4
On Sat, 15 Jan 2005 19:27:02 -0800, "Steve"
<St***@discussions.microsoft.com> wrote:
Thank you for your response.

Could you provide any link to msdn or other source confirming that "When
parent window is disabled, children are disabled automatically". I never
heard about this before. The situation was definitely different in VC++ 6.0.
Is it new feature of .NET?


There are two types of child windows, and the Windows documentation
doesn't always differentiate properly.

Every created window has a parent (passed to CreateWindow or
CreateWindowEx). But what are often referred to as "child windows" are
only those that have the WS_CHILD flag set. These are windows that
exist within the parent window's client area (and are restricted
there).

Sometimes Windows documentation uses "child" to refer to any owned
window; at other times it means a real (WS_CHILD) child. Divining the
difference brings fame, fortune and true guru status!

I have not seen any difference in the treatment of my child and Child
windows between VC 6.0 and VC.NET 2003. I would think the differences,
if any, would be between OS versions instead, or simply nomenclature.
(My code is all Win32 API C/C++; no MFC or managed code bullshit.)

--
Sev
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bostonasian | last post by:
I am trying to append options to dropdown in parent window from option items in child window. In parent window, I have following code: <script language="javascript"> function...
4
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a...
2
by: Chandru | last post by:
hi I want to know how to pass values from different forms. That is, i created one parent form. from there i opened child form modeless way. Once i close the child form i need some value from...
2
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
1
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is...
2
by: epaetz | last post by:
Is there a way to decouple the linkage between a parent and a child window? Does the parent window have any sort of a collection that holds all the children that it has spawned? I want to...
1
by: sowen | last post by:
In IE, I am using showModalDialog to pop up a modeless window, then the object "opener" is undefined. well, I pass the parent window object as an argument to pop up, then I can redirect the...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.