Home > Software engineering >  VC main dialog application sub TeeChart controls within the dialog?
VC main dialog application sub TeeChart controls within the dialog?

Time:10-08

Recently met a problem in the VC application TEECHART, TEECHART chart I is to use TAB controls in a child in the dialog box, now need to be initialized in the main dialog control
Now is:
The chart 1, Teechart initialization function if the words on the initialization function of child dialogs can be normal to initialization of the chart,
Initialization method is as follows:
 BOOL CLineGraph: : OnInitDialog () 
{
CDialogEx: : OnInitDialog ();
M_screenWidth=GetSystemMetrics (SM_CXFULLSCREEN);
M_screenHeight=GetSystemMetrics (SM_CYFULLSCREEN);
InitChart1 (0);
InitChart2 (0);
Return TRUE;
}

2, in the rest of the child dialogs through Pointers can be initialized to TeeChart chart, method is like this:
 CLineGraph * pDlg=(CLineGraph *) GetParent ();//get child dialogs class pointer 
PDlg - & gt; Initchart2 (0);//the initial changes dialog box Teechart chart

3, in the main dialog box by by defining a class variable to the initial changes in the dialog box Teechart chart is wrong, the initialization for
 CLineGraph pDlg; 
PDlg. InitChart2 (0);

Such problems will emerge, tracking, and in the front part of the initialization function is no problem, but to use CSeries class defines a variable error will occur when
The code of that place is:
 CSeries lineseries=(CSeries) m_chart2. Series (0); 

If there is no CSeries class variables related to operation, wrong will happen, you know what reason is this?

CodePudding user response:

CLineGraph pDlg;

PDlg. InitChart2 (0);//the window hasn't create


PDlg. Create (XXXXXX)
PDlg. Initxxxxx

CodePudding user response:

Window has not been created, and the window ~ related operations are illegal

CodePudding user response:

Before I had a similar modules:
Main interface A create A non-modal child window B, B for the Tab controls;
Then create multiple Windows B non-modal Tab control child window C,
Like the original poster wants to initialize the TeeChart words only in a child window initialization, main interface can put the need of parameters in the child window initialization time passed in the past, and then initializes the TeeChart...
  • Related