|
-
Sep 18th, 2002, 09:08 PM
#1
Thread Starter
Member
communication between main dialog box and property pages!!

hi ppl!!!
can help me this once??
how to get a value from the main dialog box for property pages...?????
and vice vasa....
thnks alot,,,,,
and by the way,,,,
i'm having problems with the data types in C++....
actually,,, i hav created an edit box,,,with a member variable with a value "short",,,
when i click a button, i should get the value of this edit box and call a function passing this value,,,,,(muz b "short")
and i want to display the return result in the same edit box,,, but cant display,,,,
it already has the correct value but now is the "Displayin'" problem....
i tried the other way,, set that member var of edit box to control CEdit...
but it has the CString type and cant convert it to short to call my function by passing it in,,,,,,,, but no problem displayin the value,,,,,
i wrote quite confusing but...
doez anybody know how to solve this???,,,
pls help me...
thanks.......
-
Sep 18th, 2002, 11:04 PM
#2
Thread Starter
Member
hey ppl.....
the second problem i mentioned above is already solved......
i juz put UpdateData(TRUE); before i retrieve,,,,,
so juz help me solve the first problem.....
thankzzzzzzzz,,,,,,,
=o)
-
Sep 19th, 2002, 06:42 AM
#3
Please when asking questions make sure you use correct spelling and correct punctuation,,,, cuz sis can b really confusing!??!,,...!
Why don't you just place DDX functions?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 20th, 2002, 03:42 AM
#4
Thread Starter
Member
haha ok.
i'll try.
is that correct?
-
Sep 22nd, 2002, 09:57 PM
#5
Thread Starter
Member
hello.
================================
"Why don't you just place DDX functions?"
================================
may I know where to place those DDX functions?
can you please explain in beginner terms?
thanks a lot ya,
=o)
-
Sep 23rd, 2002, 02:40 AM
#6
NP.
I'm not sure whether they are called DDX or something similar.
Anyway, MFC makes the data exchange easy by providing a set of helper functions that all start with a 3-letter acronym, I think it's DDX (Dynamic Data eXchange). The CDialog class has a virtual function named DoDataExchange which is called at dialog creation, destruction and a few other occasions (e.g. you explicitly call it). You can override this function (the wizard will probably have done it for you) and place DDX functions inside, they establish a connection between member variables of your dialog class and dialog items.
There are several DDX functions, for different controls and different data, there is one to get the value of an edit control into a CString, there is one to get the value of a group of radio controls into an int, there is one to get the value of an edit control into an int etc.
Look up CDialog: oDataExchange for more information.
In addition to the hand-written method you can also use the wizard to add these functions. Open ClassWizard, select your CDialog-derived class and go to the tab "member variables". There you can add member variables for your controls.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 25th, 2002, 12:58 AM
#7
Thread Starter
Member
yah,
i used class wizard to add avriables for my controls.
ok.. lets say, to make it simple, if i want to get the value of a control in DialogA from DialogB, how can i do that?
coz' i tried creating an object to do it but the problem is they can just get the initialized value of that control. not the updated and latest value of it.
and can I use the properties of a control from anther dialog?
like GetWindowText, SetCurSel etc.
thanks ..
-
Sep 25th, 2002, 01:39 AM
#8
Fanatic Member
Im not an MFC expert here but If I get stuck on a problem, there's always the "global variable" option!!
Make a global class/struct (GlobalRes) and put in it all the variables you want to exchange. Then make a Global instance of it in your main header file "stdafx.h". Then initialize it in your blaapp.cpp file. Then you can modify it from ANY file/class/object and use it from anyone of those!!
That should be easy, but be warned, its dirty and will creep some weird things into your code. But at least it works right? lol.
Regards,
MoMad
-
Sep 25th, 2002, 02:32 AM
#9
Thread Starter
Member
thanks.
i'll try that out...
..so i have to create a new class and put all the variables inside?..
..what about the controls?
hehe...
-
Sep 25th, 2002, 02:47 AM
#10
Fanatic Member
Dont put any controls in the class, just the variables, CString blas, int blai, short blah, etc...
-
Sep 25th, 2002, 02:54 AM
#11
Thread Starter
Member
but actually i have 1 ActiveX control in main dialog and i want to use its properties and methods from the property pages or other dialogs..
humm...
-
Sep 25th, 2002, 05:00 PM
#12
Fanatic Member
I guess u can also put objects in it. But the main use for this class should be simple Resource and Memory Management! I make this sort of class for a lot of my projects. It simplifies things alot.
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
|