Click here to Skip to main content
16,004,453 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher4-Aug-03 15:55
John M. Drescher4-Aug-03 15:55 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley4-Aug-03 17:33
Terry O'Nolley4-Aug-03 17:33 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher4-Aug-03 17:39
John M. Drescher4-Aug-03 17:39 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley4-Aug-03 18:07
Terry O'Nolley4-Aug-03 18:07 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher4-Aug-03 18:15
John M. Drescher4-Aug-03 18:15 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher4-Aug-03 18:20
John M. Drescher4-Aug-03 18:20 
AnswerRe: Is there a better way to handle dialog class variables? Pin
PJ Arends4-Aug-03 17:02
professionalPJ Arends4-Aug-03 17:02 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley4-Aug-03 17:57
Terry O'Nolley4-Aug-03 17:57 
This was a good pointer that I have bookmarked. Thanks!

Let me explain what I am doing.

I've incorporated Chris Maunder's excellent CGridCtrl into a project. I query a remote SQL database and populate the grid with the record data. When a user double clicks on a record, another dialog fires up with all of that record's data in it. What that second dialog box needs is the record id from the previous dialog box.

Dialog A: Contains a grid control populated with database rows and a hidden edit control.
When a user double-clicks a row in the grid, the record ID from that row is copied to a hidden edit control. :
SetDlgItemText(IDC_CRECORDID, csKey);

Dialog B: Needs to access the record ID in the edit control from Dialog A:

Cwnd* wParent = GetParent(); // get pointer to Dialog A
CString csKey; // will hold the edit control text
wParent->GetDlgItemText(IDC_CRECORDID, csKey); // get the text

The code above to me seems a lot cleaner than doing all of that variable assigning and editing of the class wizard supplied mappings.

I have no problem with the concept of assigning control member variables, but I still see creating a control just so I can assign a member variable to it just so I can hide it just so I can use it as a storage location for an integer as a kludge.

Isn't there a way to just pass variables from one dialog to another?








GeneralRe: Is there a better way to handle dialog class variables? Pin
PJ Arends4-Aug-03 18:17
professionalPJ Arends4-Aug-03 18:17 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley5-Aug-03 4:10
Terry O'Nolley5-Aug-03 4:10 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher4-Aug-03 18:27
John M. Drescher4-Aug-03 18:27 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley5-Aug-03 4:20
Terry O'Nolley5-Aug-03 4:20 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher5-Aug-03 4:51
John M. Drescher5-Aug-03 4:51 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley5-Aug-03 5:02
Terry O'Nolley5-Aug-03 5:02 
GeneralRe: Is there a better way to handle dialog class variables? Pin
John M. Drescher5-Aug-03 5:28
John M. Drescher5-Aug-03 5:28 
GeneralRe: Is there a better way to handle dialog class variables? Pin
Terry O'Nolley5-Aug-03 6:10
Terry O'Nolley5-Aug-03 6:10 
GeneralStore procedure Pin
PrasadD4-Aug-03 12:38
PrasadD4-Aug-03 12:38 
GeneralRe: Store procedure Pin
David Crow5-Aug-03 2:53
David Crow5-Aug-03 2:53 
GeneralRFX_Binary Pin
FJK4-Aug-03 12:01
FJK4-Aug-03 12:01 
Generalchar array declaration Pin
edujule4-Aug-03 12:00
edujule4-Aug-03 12:00 
GeneralRe: char array declaration Pin
Ted Ferenc4-Aug-03 12:11
Ted Ferenc4-Aug-03 12:11 
GeneralRe: char array declaration Pin
Miszou4-Aug-03 16:19
Miszou4-Aug-03 16:19 
GeneralRe: char array declaration Pin
David Crow5-Aug-03 3:10
David Crow5-Aug-03 3:10 
GeneralBrowse Button in an Dialog Box Pin
ppathan4-Aug-03 11:46
ppathan4-Aug-03 11:46 
GeneralRe: Browse Button in an Dialog Box Pin
valikac4-Aug-03 13:05
valikac4-Aug-03 13:05 

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.