Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ClassWizard member variables.

Posted on 1999-06-28
1
Medium Priority
?
332 Views
Last Modified: 2013-11-20
I have a simple application based on the document/view "paradigm" with the CFormView base view class. I draw little checks and stuff and assign member variables to them. Eg. I'll put in a checkbox and assign it a BOOL m_CheckBox variable through ClassWizard. Now, in this same dialog I have a button that I want to be enabled/disabled depending on whether or not the box is checked. Apparently I can't just say m_button.EnableWindow(m_CheckBox) without first doing a call to UpdateData()... is this how it's supposed to be? And on a side question... does UpdateData() update -all- DDX variables for the particular dialog?

In terms of style and efficiency... what's better? Making a call to UpdateData() everytime I receive a message from the checkbox saying it's been clicked and using the BOOL m_CheckBox variable I created or creating a CButton m_CheckBox control variable that I can tinker with to get the value...

OnCheckBoxClicked(?)
{
UpdateData();
m_ButtonCtrl.EnableWindow(m_CheckBoxVar);
}

or

OnCheckBoxClicked(?)
{
m_ButtonCtrl.EnableWindow(m_CheckBoxCtrl.GetState() & 3);
}

Which one is "correct"? That "& 3" is in there to mask of the state to see if it's clicked or not... Thanks!
0
Comment
Question by:jguerin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
naveenkohli earned 40 total points
ID: 1308238
Using the first appraoch will make sure that m_CheckBoxVar data is updated everytime. But this will make all the data of your form also updated which you may not be interested in at this stage.

Therefore you may want to go with second option. That willavoid the overhead of updating all control variables.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question