Click here to Skip to main content
16,005,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HELP... Pin
toxcct7-Jun-05 1:51
toxcct7-Jun-05 1:51 
GeneralRe: HELP... Pin
Bob Stanneveld7-Jun-05 2:03
Bob Stanneveld7-Jun-05 2:03 
GeneralRe: HELP... Pin
ThatsAlok7-Jun-05 2:14
ThatsAlok7-Jun-05 2:14 
GeneralRe: HELP... Pin
Bob Stanneveld7-Jun-05 2:22
Bob Stanneveld7-Jun-05 2:22 
GeneralRe: HELP... Pin
toxcct7-Jun-05 5:06
toxcct7-Jun-05 5:06 
QuestionHow to access the variables of View Class Pin
nripun7-Jun-05 0:00
nripun7-Jun-05 0:00 
AnswerRe: How to access the variables of View Class Pin
Rahim Rattani7-Jun-05 0:14
Rahim Rattani7-Jun-05 0:14 
AnswerRe: How to access the variables of View Class Pin
Cedric Moonen7-Jun-05 0:17
Cedric Moonen7-Jun-05 0:17 
nripun wrote:
I tried creating an object of the view class in the dialog class

WTF | :WTF: Errr, I think this is not a good solution Poke tongue | ;-P

What you need to do is, when creating your dialog, send the variables to the dialog (using a public member function) before calling DoModal. Exemple:

CYourDialog::CDialog
{
   // MFC stuff here....

public:
    void SetVariable(int Value)  { m_ViewVar = Value; }

private:
   int m_ViewVar;
}


Then when creating your dialog you can do that:

CYourDialog Dlg;
Dlg.SetVariable(Variable);
Dlg.DoModal();

So nowm inside your dialog class know the value of the variable from your View. If you need to retrieve it, the same, add a member function to retrieve the value.

Why using functions and not public variable ? In fact this is a good habit to have: your member variables should be private (or protected in case of inheritance) and they can be accessed through Get/Set methods...

Hope this helps
GeneralRe: How to access the variables of View Class Pin
nripun7-Jun-05 1:37
nripun7-Jun-05 1:37 
Questionwhat is EV_BREAK event detection pre-condition in serial comm program?? Pin
SAMZC6-Jun-05 21:55
SAMZC6-Jun-05 21:55 
AnswerRe: what is EV_BREAK event detection pre-condition in serial comm program?? Pin
Bob Stanneveld7-Jun-05 0:24
Bob Stanneveld7-Jun-05 0:24 
GeneralItems in a Combo Box.. Pin
mpallavi6-Jun-05 21:14
mpallavi6-Jun-05 21:14 
GeneralRe: Items in a Combo Box.. Pin
ThatsAlok6-Jun-05 21:26
ThatsAlok6-Jun-05 21:26 
GeneralRe: Items in a Combo Box.. Pin
Nilesh K.6-Jun-05 21:43
Nilesh K.6-Jun-05 21:43 
GeneralRe: Items in a Combo Box.. Pin
mpallavi6-Jun-05 22:38
mpallavi6-Jun-05 22:38 
GeneralRe: Items in a Combo Box.. Pin
super6-Jun-05 23:07
professionalsuper6-Jun-05 23:07 
GeneralRe: Items in a Combo Box.. Pin
mpallavi6-Jun-05 23:28
mpallavi6-Jun-05 23:28 
GeneralRe: Items in a Combo Box.. Pin
ThatsAlok6-Jun-05 23:47
ThatsAlok6-Jun-05 23:47 
GeneralRe: Items in a Combo Box.. Pin
super6-Jun-05 23:53
professionalsuper6-Jun-05 23:53 
GeneralRe: Items in a Combo Box.. Pin
Nilesh K.6-Jun-05 23:43
Nilesh K.6-Jun-05 23:43 
GeneralRe: Items in a Combo Box.. Pin
mpallavi7-Jun-05 2:17
mpallavi7-Jun-05 2:17 
GeneralRe: Items in a Combo Box.. Pin
ThatsAlok7-Jun-05 2:48
ThatsAlok7-Jun-05 2:48 
GeneralRe: Items in a Combo Box.. Pin
mpallavi7-Jun-05 19:13
mpallavi7-Jun-05 19:13 
GeneralRe: Items in a Combo Box.. Pin
ThatsAlok7-Jun-05 19:18
ThatsAlok7-Jun-05 19:18 
GeneralRe: Items in a Combo Box.. Pin
mpallavi7-Jun-05 20:42
mpallavi7-Jun-05 20:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.