Click here to Skip to main content
15,911,762 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: The Window button Pin
basementman24-Apr-03 8:29
basementman24-Apr-03 8:29 
Generalproblem with CIPAddressCtrl Pin
dudic22-Apr-03 6:30
dudic22-Apr-03 6:30 
GeneralRe: problem with CIPAddressCtrl Pin
David Crow22-Apr-03 7:50
David Crow22-Apr-03 7:50 
Generalchanging the desktop theme Pin
Mahesh Perumal22-Apr-03 6:14
Mahesh Perumal22-Apr-03 6:14 
GeneralRe: changing the desktop theme Pin
David Crow22-Apr-03 6:23
David Crow22-Apr-03 6:23 
GeneralRegistry Problems Pin
Coyotedw22-Apr-03 5:36
Coyotedw22-Apr-03 5:36 
GeneralRe: Registry Problems Pin
David Crow22-Apr-03 5:44
David Crow22-Apr-03 5:44 
GeneralRe: Registry Problems Pin
Coyotedw22-Apr-03 6:00
Coyotedw22-Apr-03 6:00 
GeneralRe: Registry Problems Pin
David Crow22-Apr-03 6:18
David Crow22-Apr-03 6:18 
GeneralRe: Registry Problems Pin
Coyotedw22-Apr-03 7:18
Coyotedw22-Apr-03 7:18 
GeneralRe: Registry Problems Pin
John R. Shaw22-Apr-03 16:24
John R. Shaw22-Apr-03 16:24 
GeneralRe: Registry Problems Pin
Joe Woodbury22-Apr-03 8:47
professionalJoe Woodbury22-Apr-03 8:47 
Generalhandling accelerator Pin
Rage22-Apr-03 5:24
professionalRage22-Apr-03 5:24 
GeneralRe: handling accelerator Pin
eXplodus22-Apr-03 8:05
eXplodus22-Apr-03 8:05 
GeneralRe: handling accelerator Pin
Anonymous22-Apr-03 20:59
Anonymous22-Apr-03 20:59 
Generalcustom control problem Pin
Lior Shoval22-Apr-03 5:08
Lior Shoval22-Apr-03 5:08 
GeneralRe: custom control problem Pin
Roger Allen22-Apr-03 6:14
Roger Allen22-Apr-03 6:14 
GeneralRe: custom control problem Pin
Lior Shoval22-Apr-03 8:25
Lior Shoval22-Apr-03 8:25 
GeneralRe: custom control problem Pin
Roger Allen23-Apr-03 1:46
Roger Allen23-Apr-03 1:46 
Generalsaving a CListCtrl as a file Pin
si_6922-Apr-03 4:43
si_6922-Apr-03 4:43 
GeneralRe: saving a CListCtrl as a file Pin
Rage22-Apr-03 5:07
professionalRage22-Apr-03 5:07 
GeneralGet Ctrl Data out of SubForm Dialog to Main Dialog Pin
triggerdie22-Apr-03 4:37
triggerdie22-Apr-03 4:37 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
Rage22-Apr-03 5:35
professionalRage22-Apr-03 5:35 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
triggerdie22-Apr-03 22:02
triggerdie22-Apr-03 22:02 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
Rage22-Apr-03 23:07
professionalRage22-Apr-03 23:07 
triggerdie wrote:
cause of CDialog has no member m_myEditCtrl

... Of course your CDialog has no m_myEditCtrl variable !!! I cannot guess your variable names Roll eyes | :rolleyes: !! This was only an exemple. Sorry for the misunderstanding. I think the articla was just a basis, you have to work on it to get your data retrieved. The easiest way to do this is the one I gave you. So, let's take it again. Change this in the code of SubFormCollection.h :

instead of
protected:
   CArray<CDialog*, CDialog*> m_Forms; // array with all forms


put
   CArray<CDialog*, CDialog*> m_Forms; // array with all forms
protected:


This will enable you to get at the m_Forms table by setting m_Forms as public.
Now you should have a main dialog, let's say CMainDlg, a CSubFormCollection, and some child dialogs, let's say CChildDlg1 and CChildDlg2 with respectively ressource IDD_SUBFORM1 and IDD_SUBFORM2 (Go in the properties of your dialogs in the ressource editor to set that). Replace these names by your variable names if they are different !!.

First, follow all the steps given in the article, especially step 5 :

CSubFormCollection m_SubForms;

(this in the MainDlg.h file.
and step 6

CRect r;
(GetDlgItem(IDC_SUBFORM_FRAME))->GetWindowRect(&r); // get the position for the subforms
//    m_SubForms.SetRelPos(r);  // if the positioning is absolute use this, else the next line
m_SubForms.SetCenterPos(r);     // centers the subdialog within the static IDC_SUBFORM_FRAME
m_SubForms.CreateSubForm(IDD_SUBFORM1,this); // create the sub forms
m_SubForms.CreateSubForm(IDD_SUBFORM2,this);
m_SubForms.ShowSubForm();


(this in the CMainDlg::OnInitDlg() file.)

Now you have two subForms, with index 0 and 1.
Then, as an example, place an edit box on the ressource of CChildDialog1, open the class wizard, add a member variable m_myEditCtrl of type CEdit.Close the class wizard.

Add a
m_SubForms.ShowSubForm(0);                    


in your code (in CMainDlg::OnInitDlg() for instance), to show the first subForm.

You can now retrieve the text entered in the edit box by the user with :
CDialog *pDlg=(CDialog *)m_SubForms.m_Forms.GetAt(0);
CString str=pDlg->m_myEditCtrl.GetWindowText();


Ouf Big Grin | :-D ... mail me directly your code if you do not get it to run, i'll be glad to help you further.



~RaGE();

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.