C++
  Home arrow C++ arrow Page 2 - Using MFC in C++ Part 4: Controls, DDX and...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C++

Using MFC in C++ Part 4: Controls, DDX and DDV
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 37
    2001-12-17

    Table of Contents:
  • Using MFC in C++ Part 4: Controls, DDX and DDV
  • Controls explained
  • The push button control
  • The check box control
  • The radio button control
  • The list box control
  • The group box control
  • DDX and DDV explained
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using MFC in C++ Part 4: Controls, DDX and DDV - Controls explained


    (Page 2 of 9 )

    Controls are the building blocks of an application hierarchy, and are used to provide users with a way to easily enter input. Some controls are bi-directional (accept input, and display out), while others are uni-directional (only accept input or only display output). Controls are created as part of a dialog box in a resource file.

    The EDITTEXT control

    One of the most popular controls in C++ is the edit box. The edit box is represented in C++ through MFC as the EDITTEXT control. The syntax of the EDITTEXT resource looks like this:

    EDITTEXT [Control Id], [X Pos], [Y Pos], [Width], [Height], [Style Options]

    The Control Id is a user #defined numerical value, which is usually stored in a separate file. Because we are creating an edit box, the ID should be prefixed with “IDE_”, such as “IDE_NAME”. The x pos, y pos, width and height are self-explanatory. The style options define how the edit box will be displayed. Some default styles, such as WS_VISIBLE, WS_BORDER, WS_CHILD and WS_TABSTOP should be used. Also, to allow a user to scroll the edit box, the ES_AUTOHSCROLL style macro should be used. Style macros can be Ored together. A sample EDITTEXT control would be declared like this:

    EDITTEXT IDE_NAME, 20, 20, 50, 12, WS_VISIBLE | WS_CHILD | WS_TABSTOP | ES_AUTOHSCROLL

    The EDITTEXT control has a number of functions, which can be used to manipulate its contents, check for valid values, etc. But before I describe them, let’s talk about buttons.

    More C++ Articles
    More By Mitchell Harper


     

    C++ ARTICLES

    - Multiplying Large Numbers with Karatsuba`s A...
    - Large Numbers
    - Dijkstra`s Shunting Algorithm with STL and C...
    - Brief Introduction to the STL Containers
    - The Standard Template Library
    - Templates in C++
    - C++ Programmer Alerts
    - C++ Programming Tips
    - First Steps in (C) Programming, conclusion
    - First Steps in (C) Programming, continued
    - First Steps in (C) Programming, introduction
    - C++ Preprocessor: Always Assert Your Code Is...
    - C++ Preprocessor: The Code in the Middle
    - Programming in C
    - Temporary Variables: Runtime rvalue Detection







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway