tags:

views:

69

answers:

2

I want to make a CFormView and a CListView in a splitterwindow configuration. My problem is how do i transfer my data from the list view to my edit controls on the form view and vice versa. Please help.

A: 

You need a way for the two windows to find each other. For example, add methods so you can set member variables pointing to the other window after constructing them in the parent:

class SplitterView
{
public:
    SetFormView(FormView *pOther)
    {
        mpFormView = pOther;
    }

private:
    FormView *mpFormView;
}

Once they know where the other window is, the communication is pretty easy. For example, on events such as selection changed in the list view, you can then call methods in the other window to update it.

One thing to be careful of is infinite loops where one window updates the other, which reacts by updating the first, which tries to update the other...

Jason Williams
A: 

Thank you very much for your reply. Can I also do this using a dialog box to transfer items selected from List view to Form view? Please bear with me, I am new to MFC. Thanks again.