If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Passing DDX Control Variables between Dialogs (Parent->Child)

Hello,
I apologize in advance, I'm very new to programming in general, especially C++, and I'm trying to update inherited code as best I can so please bear with me.

I have a main dialog which has (DDX?) controls for the user. eg a slider, and a combo box.
Previously, an image adjusted by these controls was in the same dialog.
I need to put this image in a New, separate dialog but it still must be controlled by the slider and combo box on the main dialog.
(I hope that makes sense)

My question is how can I pass the control's variables between the dialogs? I have, say,

Even if someone could even point me to an appropriate MSDN article or a tutorial, I'm happy to do the reading - I just can't seem to hit on the right search parameters, or my C++ to English translations aren't as good as they should be yet.

Re: Passing DDX Control Variables between Dialogs (Parent->Child)

Originally Posted by Grue42

Hello,
I apologize in advance, I'm very new to programming in general, especially C++, and I'm trying to update inherited code as best I can so please bear with me.

I have a main dialog which has (DDX?) controls for the user. eg a slider, and a combo box.
Previously, an image adjusted by these controls was in the same dialog.
I need to put this image in a New, separate dialog but it still must be controlled by the slider and combo box on the main dialog.
(I hope that makes sense)

My question is how can I pass the control's variables between the dialogs? I have, say,

But I get errors including: Missing default parameter for parameter 2

I also need to pass the image array, is that perhaps the same method?

Even if someone could even point me to an appropriate MSDN article or a tutorial, I'm happy to do the reading - I just can't seem to hit on the right search parameters, or my C++ to English translations aren't as good as they should be yet.

Thanks so much!
Cheers!

You do it the same way you set any other variables in another class. In your case one possible way would be to create a CComboBox pointer in your ImageDlg class and set it after you create the dialog. For example,

Re: Passing DDX Control Variables between Dialogs (Parent->Child)

Originally Posted by Grue42

I have a main dialog which has (DDX?) controls for the user. eg a slider, and a combo box.
Previously, an image adjusted by these controls was in the same dialog.
I need to put this image in a New, separate dialog but it still must be controlled by the slider and combo box on the main dialog.
(I hope that makes sense)

My question is how can I pass the control's variables between the dialogs?

Actually I fail to understand what is this passing about. There must be some image characteristics visualized by the controls, so it seems normal to communicate the essential characteristics themselves but not the controls those are visualized by.

Re: Passing DDX Control Variables between Dialogs (Parent->Child)

Originally Posted by Igor Vartanov

Actually I fail to understand what is this passing about. There must be some image characteristics visualized by the controls, so it seems normal to communicate the essential characteristics themselves but not the controls those are visualized by.

I'll answer as best I can, it's inherited software so I'm trying to come up to speed.
An array is generated with each pixel's shade of gray. Then it's using imgPlot2 (an NI IMAQ?) which draws the image.

I thought if I could point to the array and the slider values I could call imgPlot2 to create the image in the new dialog box. I'm also not sure (yet) if the sliders will stay on the parent dialog box, or move to the image dialog box so I thought it might be important to be able to pass those values around.

...Was that clear as mud?
So I guess maybe I need some kind of pointer to the array and controls I need, like GCDEF suggested? Will I be able to call a pointer created in the main dialog from the child dialog?

Re: Passing DDX Control Variables between Dialogs (Parent->Child)

I thought if I could point to the array and the slider values I could call imgPlot2 to create the image in the new dialog box. I'm also not sure (yet) if the sliders will stay on the parent dialog box, or move to the image dialog box so I thought it might be important to be able to pass those values around.

Please note, here you're constantly talking about values while your intention is passing controls. This was, and remains, my main confusion from the beginning. Control (slider) is a visual representation of its value (integer number), so why to pass the control but not the number itself?

Re: Passing DDX Control Variables between Dialogs (Parent->Child)

Passing controls from one view to another can quickly lead to code that is difficult to maintain. I've worked on code where much of the business logic is base on which dialog has been opened and what is the parent's, parent of that dialog. Trust me, working on code like that is no fun. Generally when I work on something like that, I'll switch the code over to more of a doc/view architecture where each view (i.e. dialog) doesn't have a dependency on other views (dialogs), but rather only interacts with the 'document'.

In the case of a Dialog app (where there is no built-in doc/view mechanism), it's simply to create a 'document' and pass it to each of the dialogs.

I've got a simple sample of this that I'll post shortly (once I find it).