Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Referencing Parent Dialog Box

snowboardjorgesnowboardjorge Member Posts: 2
I have a modal dialog box that creates another modal dialog boox when a button is clicked, the second dialog retreives user input text but I need to send the CString back to the first dialog. Does anybody know how to do this?

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : I have a modal dialog box that creates another modal dialog boox
    : when a button is clicked, the second dialog retreives user input
    : text but I need to send the CString back to the first dialog. Does
    : anybody know how to do this?

    [color=Blue][italic]GetParent()[/italic] function called from the dialog #2 will return the pointer to the dialog #1. Simply cast it to the type of the dialog #1 and call its methods to pass the string. Or simply declare the string as public in dialog #1 and set it from code of dialog #2:[/color]
    [color=Black][code]void CMyDialog2::PassTextBack (CString& text)
    {
    ((CMyDialog1*) GetParent ()) -> m_strBuf = text;
    }[/code][/color][color=Blue]This ^^^ assujmes that [italic]CMyDialog2[/italic] has the [italic]"CString m_strBuf;"[/italic] declared.[/color]
Sign In or Register to comment.