Click here to Skip to main content
15,918,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I've a class called CChartCtrl which i used it to draw graphs.

The graphs that i drew is in a Custom Control in the parent dialog. I've a button called "Full-Screen".
When i clicked on the full screen button, I passed the Custom control to the new dialog in Full-screen.

When i tried to restore to the parent dialog, it will give me error.
C++
CChartCtrl m_ChartCtrl; 
CFullScreen m_pFullScr; 
void CParentDialog::OnBnClickedButtonFullscr() 
{ 
        m_pFullScr.SetChartCtrl(&m_ChartCtrl); 
} 
CChartCtrl* m_maxChartCtrl; 
void CFullScreen::SetChartCtrl(CChartCtrl* ChartCtrl) 
{ 
        m_maxChartCtrl = ChartCtrl; 
}


In Full-Screen On-Init Dialog:
C++
m_maxChartCtrl->SetParent(this);


When I clicked the restore screen button:
C++
CParentDlg *dlg = (CParentDlg *) this->GetParent();
dlg->SetChartCtrl(m_maxChartCtrl);

In Parent Dialog:

C++
CChartCtrl m_ChartCtrl;

void CParentDlg::SetChartCtrl(CChartCtrl ChartCtrl)
{
	m_ChartCtrl = ChartCtrl;   // Error occurs here
}

if(m_pFullScr.DoModal() == IDOK)
{

	m_ChartCtrl.SetParent(this);
}


I will receive this error:

error C2582: 'operator =' function is unavailable in 'CChartCtrl'

CChartCtrl is derived from CWnd.
Am i doing anything wrong? Any help is greatly appreciated. Thank you.
Posted
Updated 3-Apr-12 21:12pm
v4
Comments
Resmi Anna 4-Apr-12 3:01am    
not clear what you are trying to attempt. Can you show the exact line where you are getting error? have to overloaded the = operator in your CChartCtrl class or its base class if any?

1 solution

Your CChartCtrl class has no copy (=) operator.

It may be possible to pass the existing control by pointer or reference to the full screen dialog that can resize and redraw the chart. But that requires assignment of a new parent window to the control which may have side effects.

Solutions are:


  1. If your normal dialog does only contain the chart and no other controls, you may modify it for full screen by removing the borders and caption and resize it to full screen size.
  2. Create a new chart using the settings and data from the existing one. That is, create the new chart for full screen mode like the one for normal view (pass settings and data points).
 
Share this answer
 
Comments
skfoo1 4-Apr-12 3:13am    
I see. What possible side effects are you talking about?
Jochen Arndt 4-Apr-12 3:27am    
I have never used such approach, so I don't know all. One problem is message handling which uses the window's handle and not the MFC CWnd pointers. There are messages send from the parent to all or specific childs, and other messages (mainly notifications) are send from childs to their parent. Before using this, I would place a new question if and how this can be done. However, I expect the answer will be: Don't do it.
skfoo1 4-Apr-12 5:08am    
ok! Thanks for the enlightenment! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900