Click here to Skip to main content
15,881,089 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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();
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
Rage23-Apr-03 23:10
professionalRage23-Apr-03 23:10 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
eXplodus22-Apr-03 8:10
eXplodus22-Apr-03 8:10 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
Joan M22-Apr-03 21:35
professionalJoan M22-Apr-03 21:35 
GeneralRe: Get Ctrl Data out of SubForm Dialog to Main Dialog Pin
triggerdie22-Apr-03 22:21
triggerdie22-Apr-03 22:21 
GeneralQuestion about Int64. Pin
George222-Apr-03 4:26
George222-Apr-03 4:26 
GeneralRe: Question about Int64. Pin
Tim Smith22-Apr-03 4:40
Tim Smith22-Apr-03 4:40 
GeneralRe: Question about Int64. Pin
George222-Apr-03 16:26
George222-Apr-03 16:26 
GeneralRe: Question about Int64. Pin
John R. Shaw22-Apr-03 16:42
John R. Shaw22-Apr-03 16:42 
GeneralRe: Question about Int64. Pin
George222-Apr-03 19:43
George222-Apr-03 19:43 
GeneralPixels - char (difficult) Pin
JensB22-Apr-03 3:52
JensB22-Apr-03 3:52 
GeneralRe: Pixels - char (difficult) Pin
Hans Ruck22-Apr-03 4:01
Hans Ruck22-Apr-03 4:01 
GeneralRe: Pixels - char (difficult) Pin
Jim Crafton22-Apr-03 4:40
Jim Crafton22-Apr-03 4:40 
GeneralCrash address, doesn't exist in .MAP file Pin
dandy7222-Apr-03 3:39
dandy7222-Apr-03 3:39 
GeneralRe: Crash address, doesn't exist in .MAP file Pin
Tim Smith22-Apr-03 3:53
Tim Smith22-Apr-03 3:53 
GeneralRe: Crash address, doesn't exist in .MAP file Pin
dandy7222-Apr-03 4:28
dandy7222-Apr-03 4:28 
GeneralRe: Crash address, doesn't exist in .MAP file Pin
Tim Smith22-Apr-03 4:42
Tim Smith22-Apr-03 4:42 
GeneralRe: Crash address, doesn't exist in .MAP file Pin
dandy7222-Apr-03 5:10
dandy7222-Apr-03 5:10 

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.