Results 1 to 12 of 12

Thread: communication between main dialog box and property pages!!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40

    Unhappy 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.......



  2. #2

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40
    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)

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40

    Talking

    haha ok.
    i'll try.
    is that correct?

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40

    Talking

    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)

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40

    Talking

    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 ..



  8. #8
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    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
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

  9. #9

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40
    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...

  10. #10
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    Dont put any controls in the class, just the variables, CString blas, int blai, short blah, etc...
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

  11. #11

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    in e middle of nowhere..
    Posts
    40

    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...

  12. #12
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    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.
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width