Skip to main content
gamedev.net
🔒 Locked

DoDataExchange()?

Started by SteveBrown Sep 21, 2000 at 4:34 PM 5 replies 650+ views
Original Post
SteveBrown
SteveBrown
I am new to programming dialog windows. What I am trying to make is a system where there is a list of items to the left and other controls to the right. When an item is selected on the left from the list, I want the controls on the right to portray that items properties and be editable. I have variables put in for the things, vc did the work for setting up all the functions and message maps. I need to know though, how does DoDataExchange() work? The vc help file says not to call it directly. If I change one of the variables associated wiht a control, how do I get the change to be reflected on the dialog window, and how do I get the program to retrieve the data from the window? Thanks for any help!
Gorky
Gorky
First, let class wizard populate most of the code for DoDataExchange.
Hover over your DLG resource, and right click on one of your dlg items and select class wizard. This will bring up class wizard with the dialog/dlg item as the focus. On the second page of property sheet named "member variables", give each control id a member variable.

Now class wizard has populated most of the data for DoDataExchange.
When ever you make a change to each dlg item, that item will save it''s data in the member variable for that item.

For the second part, you have many options.
I suggest double clicking dlg item on the left to allow class wizard to add message handlers.
In each of these add code to set the text for the appropriate item on the right.
e.g.
SetDlgItemText(IDC_TKT_FAX_DEPT_BILL_CODE,m_DFX_Dept_Bill_Code);
where the first item is the dlg item you want to change and the second is the variable that holds the data you want.

That''s a quick summary.
SteveBrown
SteveBrown
Thanks for the help!
Yanroy
Yanroy
I think there is an even easier way. Maybe a slight bit slower, but less code. When you are making your dialog resource, hold down ctrl and double-click the control. It will come up with a fancy little dialog to add a member variable that synchs with the control. I think you already know how to do that part. Now, in your code, just call UpdateData() to get all the info in the dialog loaded into the variables, then edit the variables, call UpdateData(FALSE) to load them back into the dialog.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
Houdini
Houdini
If you change a variable which is associated with a control, you can call UpdateData(FALSE) to update all controls with the data in the variables. Calling UpdateData(TRUE) takes the data in the controls and copies it to the variables that are associated with them.
Houdini

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.