-
April 15th, 2011, 05:14 AM
#1
global variables
How do I create global variable for dialog class (global object of dialog class), which is accessible to all other classes including other dialog classes?
-
April 15th, 2011, 05:16 AM
#2
Re: global variables
Put the variable in the public section.
-
April 15th, 2011, 05:22 AM
#3
Re: global variables
but public section of which class or file?
-
April 15th, 2011, 05:56 AM
#4
Re: global variables
Did you mean "global" or static variable for dialog class?
If former - then why?
Victor Nijegorodov
-
April 15th, 2011, 06:19 AM
#5
Re: global variables
I need global variables or objects of dialog class for eg:- if my dialog class is dlg1 then I need the object as dlg1 d1 globally so that i can directly access d1 in other dialog classes such as dlg2, dlg3 etc.
-
April 15th, 2011, 06:23 AM
#6
Re: global variables
Do you mean the "dialog classes" or " dialog class instances"?
Victor Nijegorodov
-
April 15th, 2011, 06:59 AM
#7
Re: global variables
dlg1, dlg2 etc. are the names given to dialogbox class & d1,d2... are the instances of dlg1,dlg2...
& I want to declare d1,d2 globally
-
April 15th, 2011, 07:07 AM
#8
Re: global variables
1. http://www.codeguru.com/forum/showthread.php?t=221889
2. Usually declaring globals is not a good idea. In the most of cases (at least 99.99%) globals can be and should be avoided.
What is the purpose to access dlg1 d1 from within other dialog classes such as dlg2, dlg3 etc.?
Victor Nijegorodov
-
April 15th, 2011, 11:25 PM
#9
Re: global variables
I want to show dlg1 dialog from dlg2 & dlg3 on button
click
-
April 17th, 2011, 04:06 PM
#10
Re: global variables
Originally Posted by shwetashah01
I want to show dlg1 dialog from dlg2 & dlg3 on button
So why do you need a global variable for this? Just declare one locally and call DoModal().
Code:
dlg2::OnOk()
{
dlg1 myDlg;
myDlg.DoModal();
// ....
}
Given your description, I see no need for global variables whatsoever if all you want to do is invoke a dialog from another dialog.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|