Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDialog dissapears... ? Pin
Calder23-Jan-04 22:34
Calder23-Jan-04 22:34 
AnswerRe: Dialog dissapears... ? Pin
Antti Keskinen23-Jan-04 22:57
Antti Keskinen23-Jan-04 22:57 
GeneralRe: Dialog dissapears... ? Pin
Calder23-Jan-04 23:33
Calder23-Jan-04 23:33 
GeneralRe: Dialog dissapears... ? Pin
Antti Keskinen23-Jan-04 23:57
Antti Keskinen23-Jan-04 23:57 
GeneralRe: Dialog dissapears... ? Pin
Calder24-Jan-04 4:08
Calder24-Jan-04 4:08 
GeneralRe: Dialog dissapears... ? Pin
Antti Keskinen24-Jan-04 21:22
Antti Keskinen24-Jan-04 21:22 
GeneralRe: Dialog dissapears... ? Pin
Calder25-Jan-04 12:15
Calder25-Jan-04 12:15 
GeneralRe: Dialog dissapears... ? Pin
Antti Keskinen26-Jan-04 5:24
Antti Keskinen26-Jan-04 5:24 
What update do you mean ?

If you mean how to update the data members, then I suggest you familiarize yourself with the concept of RFX, or Record Field Exchange. This practise is used to get data from the data source and save it into local variables (members of the CRecordset-derived object, such as CStrings, ints etc). When you issue a MoveNext call, the actual pointers inside the results list (handled by the CRecordset object) are moved forward. Then DoFieldExchange, an overriddable virtual function gets called. In here, if you issue a set of certain function calls (RFX calls), you can load the data in the currently selected row into the local variables you specify. We are not interested how the actual database or result browsing works: the CRecordset object offers an interface through which we can copy the desired data away into local variables.

The rest is quite simple: following the same logic, you implement a Dialog Data Exchange (DDX) routine, in which you copy the contents of the variables from the CRecordset object into local variables of the dialog class (member variable to member variable, respectively). After this, you let the DDX routine (DoDataExchange virtual function on the dialog class) to "bind" these local variables into the actual controls of the dialog resource. This means that whenever the DDX routine is ran, data is copied from either the local variables into the controls, or vice-versa.

The same bi-directionality is implemented in the CRecordset object, but it works a bit differently (See the CRecordset documentation for more info, especially AddNew and Update member functions).

Hope this clears it up a bit. See MSDN documentation for a complete explanation. Naturally, experimenting with both DDX and RFX is the best way to learn how to use them. But if you understand the basic concept: "Binding a local attribute of a class into a control's data/manipulation or into a query's result row's column", you've taken a huge leap forwards.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
Generalshow/hide a pane in static splitter window Pin
gailya23-Jan-04 21:57
gailya23-Jan-04 21:57 
GeneralRe: show/hide a pane in static splitter window Pin
Antti Keskinen23-Jan-04 23:00
Antti Keskinen23-Jan-04 23:00 
GeneralCScrollview data plotting & grabbing the plotted data Pin
JHAKAS23-Jan-04 19:41
JHAKAS23-Jan-04 19:41 
GeneralDisplaying text in MDI Pin
hurr1can323-Jan-04 19:32
hurr1can323-Jan-04 19:32 
GeneralRe: Displaying text in MDI Pin
Antti Keskinen23-Jan-04 23:04
Antti Keskinen23-Jan-04 23:04 
GeneralHelp the Newbie(plz) Pin
MrNiceBerG23-Jan-04 18:46
MrNiceBerG23-Jan-04 18:46 
GeneralRe: Help the Newbie(plz) Pin
monrobot1323-Jan-04 20:33
monrobot1323-Jan-04 20:33 
GeneralRe: Help the Newbie(plz) Pin
Antti Keskinen23-Jan-04 23:24
Antti Keskinen23-Jan-04 23:24 
GeneralRe: Help the Newbie(plz) Pin
MrNiceBerG24-Jan-04 5:19
MrNiceBerG24-Jan-04 5:19 
GeneralRe: Help the Newbie(plz) Pin
MrNiceBerG27-Jan-04 18:55
MrNiceBerG27-Jan-04 18:55 
GeneralDetachable tab control... Pin
Neha23-Jan-04 18:14
Neha23-Jan-04 18:14 
GeneralRe: Detachable tab control... Pin
Antti Keskinen23-Jan-04 22:43
Antti Keskinen23-Jan-04 22:43 
GeneralRe: Detachable tab control... Pin
Marcello25-Jan-04 8:15
Marcello25-Jan-04 8:15 
GeneralProblem in SearchPath Pin
SiddharthAtw23-Jan-04 17:46
SiddharthAtw23-Jan-04 17:46 
GeneralRe: Problem in SearchPath Pin
Mukkie25-Jan-04 7:56
Mukkie25-Jan-04 7:56 
GeneralRe: Problem in SearchPath Pin
SiddharthAtw26-Jan-04 17:24
SiddharthAtw26-Jan-04 17:24 
GeneralRe: Problem in SearchPath Pin
Mukkie27-Jan-04 7:35
Mukkie27-Jan-04 7:35 

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.