Home > Software engineering >  Ask a MFC in display forms to operate in the form of questions
Ask a MFC in display forms to operate in the form of questions

Time:09-25


First of all, I in the login window, in A.C PP, is to generate the child window

M_conditionDlg. Create (IDD_DIALOG2, this);
M_conditionDlg. ShowWindow (SW_HIDE);

M_conditionDlg - is to generate the child window of association class


And then through the pictures, the tree structure on the left, and click "condition of the single" to display this window, through the ShowWindow (SW_SHOW); To display
Figure 1

 
If (strItem=="condition of the single")
{
M_nCurMenu=10;
CRect rt, rr.



GetClientRect (& amp; Rt);
Int h=rt. Height ();


GetDlgItem (IDC_STATIC_gg) - & gt; GetWindowRect (rr);
The ScreenToClient (& amp; The rr);

P_rt=rt;
P_rr=rr.

Rt. Top=rt. Top + 5; Rt. Bottom=h - 3; Rt. Left=rr. Right + 10;
M_conditionDlg. MoveWindow (rt);
M_conditionDlg. ShowWindow (SW_SHOW);
//MessageBox (" conditions of single test ");
}


This window can be generated operations, no problem,


But I through the "conditions" button below the biggest PP generated on the "order" window above, clicking the "order" button, just to produce the condition of single window,
(or by A.C PP
M_conditionDlg. Create (IDD_DIALOG2, this);
M_conditionDlg. ShowWindow (SW_HIDE);
Two other code generation window to display its)

Figure 2


Through the code below shows
 
CfClientApp * app=(CfClientApp *) AfxGetApp ();//this function can get the current application process of pointer
M_mainDlg=(CMainDlg *) app - & gt; M_pMainWnd;
M_mainDlg - & gt; OpenConditionWindow ();//show the conditions of single window


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* the function name: OpenConditionWindow
* can work: according to conditions of single window
No
* and number:* time: on February 8, 2018 15:00:11
* to write: YX
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

Void CMainDlg: : OpenConditionWindow ()
{

//p_rt. Top=p_rt. Top + 5;//p_rt. Bottom=h - 3;//rt. Left=rr. Right + 10;
//m_conditionDlg MoveWindow (p_rt);
//m_conditionDlg. Create (IDD_DIALOG2, this);
CRect rt.

GetClientRect (& amp; Rt);
Rt. Left +=530;
M_conditionDlg. MoveWindow (rt);
M_conditionDlg. ShowWindow (SW_SHOW);
}


But this display "condition of the single" window appears in figure 2, the window with another window appears overlap, and "conditions of single window" can't do anything, the mouse drag on, will give "condition of the single" window to brush,

So could you please tell me what's the problem? How can I write to after clicking the "order" button, can show operation "conditions of single window?"

CodePudding user response:

Estimation is the parent window must have been this all,

The previous m_conditionDlg. Create (IDD_DIALOG2, this); Don't

 
If (strItem=="condition of the single")
{
.
//display created before
If (m_conditionDlg m_hWnd==NULL)
M_conditionDlg. Create (IDD_DIALOG2, this);
M_conditionDlg. MoveWindow (rt);
M_conditionDlg. ShowWindow (SW_SHOW);
.
}

CodePudding user response:

reference 1st floor zgl7903 response:
estimates were part of the parent window to make this right,

The previous m_conditionDlg. Create (IDD_DIALOG2, this); Don't

 
If (strItem=="condition of the single")
{
.
//display created before
If (m_conditionDlg m_hWnd==NULL)
M_conditionDlg. Create (IDD_DIALOG2, this);
M_conditionDlg. MoveWindow (rt);
M_conditionDlg. ShowWindow (SW_SHOW);
.
}


Not oh, this just inside the A.C PP file, to click on the tree after show "conditions of single window", does not affect the biggest PP order window for "conditions of single window display, because
M_conditionDlg. Create (IDD_DIALOG2, this);
In A.C PP initialization method of inside, the back of the button is only to change his display attributes,
Now I am in the biggest PP through "order" button to display the "conditions of single window", so through the following code
 

CfClientApp * app=(CfClientApp *) AfxGetApp ();//this function can get the current application process of pointer
M_mainDlg=(CMainDlg *) app - & gt; M_pMainWnd;
M_mainDlg - & gt; OpenConditionWindow ();//show the conditions of single window


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* the function name: OpenConditionWindow
* can work: according to conditions of single window
No
* and number:* time: on February 8, 2018 15:00:11
* to write: YX
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

Void CMainDlg: : OpenConditionWindow ()
{

//p_rt. Top=p_rt. Top + 5;//p_rt. Bottom=h - 3;//rt. Left=rr. Right + 10;
//m_conditionDlg MoveWindow (p_rt);
//m_conditionDlg. Create (IDD_DIALOG2, this);
CRect rt.

GetClientRect (& amp; Rt);
Rt. Left +=530;
M_conditionDlg. MoveWindow (rt);
M_conditionDlg. ShowWindow (SW_SHOW);
}




So here with this sentence, not affected
If (strItem=="condition of the single")
{
.
//display created before
If (m_conditionDlg m_hWnd==NULL)
M_conditionDlg. Create (IDD_DIALOG2, this);
,,,,,,,,
}
  • Related