Have two child dialogs CTabPage1 and CTabPage2,
The two sub box have student id, name, gender three edit box,
Application opens, the default display box 1, and display the student id, name, the default value of gender,
Now want to define three global variable student id, name, gender,
Problem a:
How the three global variables in OnInitDialog initialization?
Problem two:
How to make these three variables box 1, and the box 2 shows?
Question 3:
How to implement the three changes in a child frame 1, when switching to sub box 2, sub box 2 load automatically update the three variables?
2 when a change in a box, box 1 also automatic update,
PS: I am a VC did not start the boy, your bosses can speak detailed point?
Such as which files to add variables, where
In which document to add statements, where
Online to find a lot of information, complete can't find the sort of small white level tutorial,
As the first step to do, the second do the tutorial I like very much, but to this question seems can't find ah,
Speak now to find those who are very general, small white said don't understand what meaning,
Just as that kind of direct use what function, how do I use this function?
I directly with tip error,
Certainly because of use position is wrong, error variable is not defined,
Small white said appear this kind of don't know how to do,
What is in the position to do what?
CodePudding user response:
No one here?CodePudding user response:
"Now want to define three global variable student id, name, gender,"Put CMyTab class, m_tab, son, frame 1 and the child should taking m_tab initialization time defined in the variable (GetParent ())
CodePudding user response:
Cstrings str1;CMyTab: : CMyTab ()
{
M_bHeadStyle=FALSE;
Str1="StrInMyTab";
}
//
CMyTab * pTab=(CMyTab *) GetParent ();
Cstrings STR=pTab - & gt; Str1;
M_Dlg1Edit1. SetWindowText (STR);//"Big Char");
CodePudding user response:
To search the observer patternThis is typical of the observer pattern usage scenarios,
CodePudding user response:
1. In the main dialog box, two since the dialog box to define three num, name, sex, variable respectively in three dialog OnInitDialog initialized, initialization values are from the inside to read ini configuration file, such as:
Int num=GetPrivateProfileInt (" XXX, "" numINI", 1, ". \ \ X.i ni ");
Int name=GetPrivateProfileInt (" XXX, "" nameINI", 1, ". \ \ X.i ni ");
Int sex=GetPrivateProfileInt (" XXX, "" sexINI", 1, ". \ \ X.i ni ");
2. Refer to 1, three after the dialog box to obtain the corresponding value is displayed in the corresponding control in
3. Set a save button in a child frame 1, after modify the value, click the save button, the save button in the corresponding function to rewrite ini configuration file:
Cstrings temp.
Temp. The Format (" % s ", num);
WritePrivateProfileString (" XXX, "" numINI", temp, ". \ \ X.i ni ");
Temp. The Format (" % s ", name);
WritePrivateProfileString (" XXX, "" nameINI", temp, ". \ \ X.i ni ");
Temp. The Format (" % s ", sex);
WritePrivateProfileString (" XXX, "" sexINI", temp, ". \ \ X.i ni ");
As for the switch, according to OnInitDialog achieved in 1
CodePudding user response:
Upstairs can point in more detail?1: which is called the main dialog?
2: which called from the dialog?
3: where there are three OnInitDialog, only a dialog. CPP OnInitDialog,
Please tell me the detail steps, please?
The first step to open the file? .cpp or. H?
The second step is to find which functions or which position, add what code?
The third step 4 to do
CodePudding user response:
The 2nd 3 floor greatly, can speak a bit in detail, card don't understand ah,What is "in" put CMyTab class, m_tab,?
There are 3 floor of cstrings str1; In the function outside? The global variable?
//
CMyTab * pTab=(CMyTab *) GetParent ();
Cstrings STR=pTab - & gt; Str1;
M_Dlg1Edit1. SetWindowText (STR);//"Big Char");
These you also write outside the function? Which function of content?
Can you hold a moment,
1: which file to open the first, and find which position, add the code?
2: switch to which files, then find where, what code to add?
CodePudding user response:
You are not a main dialog box, CMyTab class, any m_tab,Put the public variable m_tab,
Cstrings str1;//CMyTab. Public variable h
CMyTab: : CMyTab ()
{
Str1="StrInMyTab";//public variable initialization
}
Two child dialogs CTabPage1 and CTabPage2,
Initialize the
CMyTab * pTab=(CMyTab *) GetParent ();
Cstrings STR=pTab - & gt; Str1;
M_Dlg1Edit1. SetWindowText (STR);//"Big Char");
CodePudding user response: