1 / 23

MFC Dialog Application

MFC Dialog Application. Steps to Build MFC Dialog in VS.Net 2003 Instructor : Dr.James Fawcett Prepared by : Priyaa Nachimuthu Summer 2004 priyaa.n@gmail.com. Text Generator in action. Intent. Accept text entered into the top EditBox.

dawnl
Download Presentation

MFC Dialog Application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MFC Dialog Application Steps to Build MFC Dialog in VS.Net 2003 Instructor : Dr.James Fawcett Prepared by : Priyaa Nachimuthu Summer 2004 priyaa.n@gmail.com

  2. Text Generator in action

  3. Intent • Accept text entered into the top EditBox. • Transfer text to the second EditBox as it is typed – illustrates use of text controls. • When user hits Add button the contents of the top edit box will be transferred to a list box. Note: You must #include “stdafx.h” at the top of every *.cpp file in your server implementation.

  4. Construction Steps - Summary • Run Application Wizard • Select MFC Application project • Select Dialog-based • Pull controls from control palette onto dialog in Resource View. • Add message handlers for every event you want to handle. • You can either right-click on dialog class in Class View to add handler • Or you double click on the control you want to handle, e.g., EditBox or Button. • When you double click, you get a handler for the most common message for that control. That may or may not be what you want. • You get more control by using the first method. The second method is faster. • Add code in message handlers, perhaps by calling a server module providing the computational engine for your interface. • Compile, Edit, and Run repeatedly until you get the behavior and appearance you want.

  5. Resulting Dialog Structure

  6. Construction Steps – Creating a MFC Project • Create a blank solution and add a new project • Select Visual C++ Projects - MFC Application

  7. Construction Steps – Application wizard • You will be directed to MFC Application wizard

  8. Construction Steps – Application Type • Select Dialog –based application

  9. Construction Steps – UI Features • Choose the desired user interface features

  10. Construction Steps – Advanced Features • Uncheck ActiveX controls if none is used in the application

  11. Construction Steps – Resource view • On finish,App wizard directs to a resource editor

  12. Construction Steps – Populating a dialog • Use tool box to populate dialog

  13. Construction Steps – Adding a variable • Right click on the control (Edit Box) to add a variable

  14. Construction Steps – Add variable wizard • Select the variable type,type in the variable name, and choose category as value for Edit Box control

  15. Right click on the control (List Box) to add a variable Construction Steps – Adding a variable

  16. Construction Steps – Add variable wizard • Select the variable type,type in the variable name, and choose category as control for List Box control

  17. Construction Steps – Adding an event handlerfor a button control • Double click on the control or choose an event handler from the control’s properties window

  18. Construction Steps – Adding an event handler for an Edit Box • Double click on the control or choose an event handler from the control’s properties window

  19. Construction Steps – Adding a Windows Message Handler • In the main dialog’s properties window,select the right most Messages icon which lists all windows message handlers

  20. Construction Steps – Adding a Windows Message Handler • Choose a message handler ( WM_LBUTTONDOWN – OnLButtonDown handler )

  21. Construction Steps – Adding code for event handlers • Add code for event handlers in MFCDialogDemoDlg.cpp

  22. Construction Steps – Adding code for OnOK event handler • Add code for event handlers in MFCDialogDemoDlg.cpp

  23. Add Code, Compile, and Run

More Related