Steps to Build Frame Window Recipe Application

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Step-by-Step: Add a Graphical Hyperlink USE the Special Events Final presentation that is still open from the previous exercise. 1.Go to slide 4, and click.
Copyright  Oracle Corporation, All rights reserved. 1 Creating an Application: The AppBuilder for Java IDE.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
CIS 338: Creating ActiveX Controls Dr. Ralph D. Westfall March, 2003.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Building an MFC Application Using the Wizard. Terms Solution – A container for related projects – An executable or DLL – May be constructed from multiple.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Creating a Web Site to Gather Data and Conduct Research.
Website Development with Dreamweaver
Visual C++ Lecture 11 Friday, 29 Aug Windows Graphic User Interface l Event driven programming environment l Windows graphic libraries (X11 on Unix,
Fall 2005 Using FrontPage to Enhance Blackboard - Darek Sady1 Using FrontPage to Enhance Blackboard 1.Introduction 2.Starting FrontPage 3.Creating Documents.
MFC Windows Programming: Document/View Approach More detailed notes at: 360/notes-html/class15.htm.
Teach Yourself Windows 95 Module 4: Using Microsoft Exchange for Faxes and .
USING WORDPRESS TO CREATE A WEBSITE (RATHER THAN A BLOG) STEP-BY-STEP INSTRUCTIONS.
Applications Development
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
How to Create Visual Presentations with Microsoft PowerPoint.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Topics Introduction Scene Graphs
Copyright © Curt Hill More Components Varying the input of Dev-C++ Windows Programs.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
FOCUS II Demonstration Simply click the mouse to advance through the presentation. Or; Tap the right arrow key on the keyboard to advance through the slides.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Chapter 7 Controls. 2 Introduction (1/4) Control –Special kind of window –Designed to convey information to the user or to acquire input –Reduce the tedium.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Adding/Removing Responsible Party This module will discuss how to add and remove Responsible Party information.
Chapter 6: FILE I/O and Serialize CFile class. FILE I/O Serialization and the CArchive Class.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Creating a Google Site For a Digital Portfolio Purpose.
Spell Checker web service (you build a web client that interacts with the service) The client uses a servlet class and a JSP page. The user passes information.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Copyright © 2007 by Pearson Education 1 UNIT 6A COMBINATIONAL CIRCUIT DESIGN WITH VHDL by Gregory L. Moss Click hyperlink below to select: Tutorial for.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
© Ms. Masihi.  A Web page contains text and images that convey specific information to viewers.  To create a new web page, open Dreamweaver and select.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
Steps to Build Frame Window Recipe Application
Creating LOVs and Editors
Writing simple Java Web Services using Eclipse
Using a template to create a document
European Computer Driving Licence
Looking at our “Getting Started” application
Building a User Interface with Forms
Chapter 2 – Introduction to the Visual Studio .NET IDE
Administrator Training
Using a set-up file to read ASCII data into SPSS
1. Introduction to Visual Basic
MFC Dialog Application
Word and the Writing Process
C# Programming: From Problem Analysis to Program Design
An Introduction to Computers and Visual Basic
ADDING COMMENTS TO AN EXCEL WORKSHEET.
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
Understanding the Visual IDE
Tutorial 3 – Creating a Multiple-Page Report
1. Open Visual Studio 2008.
An Introduction to Computers and Visual Basic
Constructors, GUI’s(Using Swing) and ActionListner
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Microsoft Excel 2007 – Level 2
Presentation transcript:

Steps to Build Frame Window Recipe Application Camen Vaca Ruiz MFC Windows Applications Syracuse University

Goals of the Project Display a static text message in the center of the client area. Show current mouse coordinates in a text message above the static message. Show current mouse coordinates in static control above the message from item 2., demonstrates how that can be done. Toggle the message from item 2. on and off, using a menu selection labeled “toggle” Syracuse University

Running Application Syracuse University

Build a blank solution Syracuse University

Single Document Interface Syracuse University

Construction Steps- Resource Editor Click on View/ Resource View FWRecipe/menu/IDR_MAINFRAME. That shows the menu bar. Edit item, and select each of its items in turn and hit the delete key to remove them. Type in the word Toggle in the box below the Edit tag. You can simply hit Delete. Syracuse University

RESOURCE VIEW- Add menus Compile the program to see an empty frame window with the normal system menu When you click on edit you will see the single Toggle item grayed out. It is grayed out because we have not defined a message handler for that yet. Syracuse University

Use class wizard to add Menu Handler To add a handler in the menu option: Right click on Toggle/ Add Event Handler … Choose CMainFrame unde Class Name Change Function handler name to OnToggle Click “Add and Edit” Add the code of the example to the function body Syracuse University

Construction Steps- Add Member variable To add a member variable Click Menu View  Class View (excellent view for navigating around your code and initiating class wizard activities) Right click on CmainFrame class and select Add Member Variable. Enter the type BOOL and name m_bToggle. MAKE SURE YOU SELECT Private – Public is the default selection. Click Finish This creates a private member variable named m_bToggle in the CmainFrame class to hold the state of the menu toggle. Syracuse University

Construction Steps- Add Member variable Syracuse University

Construction Steps- Add a function Right click on CmainFrame in the Class View again Select Add Member Function Enter the return type BOOL and the name getToggle This time leave the selection of Access as public. This will create an accessor function for your view to get the state of the toggle. Add the code “return m_bToggle;” to the function body. Syracuse University

Adding a function Syracuse University

Adding a function Syracuse University

Steps to support View Go to Class View Double click on the CChildView class View the inline function OnPaint() that the wizard has defined for you. Add the code from the class example to the OnPaint() function Syracuse University

Adding Message Handlers Right click on the CChildView class Choose Properties. Click on Messages button Select WM_LBUTTONDOWN, and Add Repeat for WM_MOUSEMOVE and WM_CREATE Note that the class wizard has already provided the message hanler for the WM_PAINT message (the OnPaint function we looked at before). Syracuse University

Adding Message Handler for Mouse Syracuse University

Adding code to message Handlers Add code from the class example to OnMouseMove and OnLButtonDown message handler functions, skipping the last four lines in OnMouseMove. Add member variables (int) m_DisplayX, m_DisplayY, m_MouseX, m_MouseY, m_TriangleX and m_TriangleY as private Do that using the wizard like we did before, or add them manually by typing into the class declaration. These code additions will draw the static text in the center of the diagram, draw a triangle at the cursor when the left button is clicked, and show the mouse coordiates in a text messge. Compile and show that this works. Syracuse University

Adding code and some variables Syracuse University

Add Static Control to Client Area Now, we want to add the static control to also show mouse coordinates. Go to the FileView and double click on resource.h to see the contents of that file in the edit window. Add #define IDC_STATIC1 and pick a number to enter on the right which is one more that the highest number shown in the top group. Add 1 to the value of _APS_NEXT_COMMAND_VALUE. Add the member variable m_pCStatic as a private data member of the CChildView class typed as Cstatic*. Go to the ChildView::OnCreate function and add the statements: m_pStatic = new CStatic(); CRect rect(CPoint(100,70),CSize(90,22)); m_pCStatic->Create(“”,WS_CHILD|WS_VISIBLE|WS_BORDER, rect, this, IDC_STATIC1); This creates the static control. Add the bottom four lines of code from the CChildView::OnMouseMove function in my example. Syracuse University

Add Static Control to Client Area Now, we want to add the static control to also show mouse coordinates. Go to the Solution Explore Double click on resource.h to see the contents of that file in the edit window. Add #define IDC_STATIC1 and pick a number to enter on the right which is one more that the highest number shown in the top group. Add 1 to the value of _APS_NEXT_COMMAND_VALUE. Syracuse University

Add Static Control to Client Area Add the member variable m_pCStatic as a private data member of the CChildView class typed as Cstatic*. Go to the ChildView::OnCreate function and add the statements: m_pStatic = new CStatic(); CRect rect(CPoint(100,70),CSize(90,22)); m_pCStatic->Create(“”,WS_CHILD|WS_VISIBLE|WS_BORDER, rect, this, IDC_STATIC1); This creates the static control. Add the bottom four lines of code from the CChildView::OnMouseMove function in my example. Syracuse University

Static variable defined in ChildView.h Syracuse University

Add Code to Handle Messages Syracuse University

Initialize Members in Main and Child Classes Finally, we need to give initial values to the member variables we added to CMainFrame and CChildView. Add the intializer : m_bToggle(TRUE) to the CMainFrame::CMainFrame() constructor. Add the intializers to the CChildView::CChildView() : m_DisplayX(100), m_DisplayY(100), m_MouseX(0), m_MouseY(0), m_TriangleX(-1), m_TriangleY(-1), m_pCStatic(NULL) and add to the CChildView::~CChildView() destructor: delete m_pCStatic; Be sure you have these include directives in your ChildView.cpp file: #include "MainFrm.h" #include <sstream> #include <iomanip> using namespace std; Compile and see the running program in all its glory. Syracuse University

Initialize MainFrame Member Syracuse University

Initialize Child View Members Syracuse University

Running Application Syracuse University

Structure of FWRecipe Program Syracuse University

Initialize Members in Main and Child Classes Finally, we need to give initial values to the member variables we added to CMainFrame and CChildView. Add the intializer : m_bToggle(TRUE) to the CMainFrame::CMainFrame() constructor. Add the intializers to the CChildView::CChildView() : m_DisplayX(100), m_DisplayY(100), m_MouseX(0), m_MouseY(0), m_TriangleX(-1), m_TriangleY(-1), m_pCStatic(NULL) and add to the CChildView::~CChildView() destructor: delete m_pCStatic; Compile and see the running program in all its glory. Syracuse University

Closing Notes Test application by compiling and running each time you add a new Windows Message Handler. Make sure you #include “stdafx” in the cpp file for each server module you add – we haven’t used any server modules in this example, but you will want to for any relatively complex application. Test each server module as a stand-alone module, using its test stub, before you call it from the interface code. Your server modules are usually called by the interface message handlers: They affect transformations on the application’s data in response to user inputs. Syracuse University