Week 3 C For Win Lecture :.  Mouse Message  Keyboard Message.

Slides:



Advertisements
Similar presentations
Instruction: Use mouses left button. Use mouses left button. If mouse buttons dont work, use arrow keys of keyboard for slide show. If mouse buttons dont.
Advertisements

Instruction: Use mouses left button. Use mouses left button. If mouse buttons dont work, use arrow keys of keyboard for slide show. If mouse buttons dont.
Standard Input Devices section 2a This lesson includes the following sections: · The Keyboard · The Mouse · Variants of the Mouse.
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Tutorial 15 Working with the Event Model. XP Objectives Compare the IE and W3C event models Study how events propagate under both event models Write a.
Customizing Your Toolbars in Microsoft Office Lunch and Learn: June 7, 2005.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Sketchlet Tutorial Defining Interaction and Logic in Sketchlet sketchlet.sf.net Željko Obrenović obren.info/
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Sketchify Tutorial Defining Interaction and Logic in Sketchify sketchify.sf.net Željko Obrenović
CSC 298 Windows Forms.
Visual C++ Lecture 11 Friday, 29 Aug Windows Graphic User Interface l Event driven programming environment l Windows graphic libraries (X11 on Unix,
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Overview of Previous Lesson(s) Over View  Visual C++ provides us with 3 basic ways of creating an interactive Windows application  Using the Windows.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
Lecture Two Event Handling Keyboard and Mouse Input.
Lecture Set 13 Drawing Mouse and Keyboard Events Part B – Mouse and Keyboard Events.
Timer, Animation Responding to Mouse & Keyboard Lab 7 7 McGraw-Hill© 2006 The McGraw-Hill Companies, Inc. All rights reserved.
Direct3D Workshop November 17, 2005 Workshop by Geoff Cagle Presented by Players 2 Professionals.
COM148X1 Interactive Programming Lecture 7. Topics Today HCI Event Handling.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Chapter 3 The mouse and the Keyboard. Getting input from the Mouse.
Events (Alice In Action, Ch 6) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 21 - “Cat and Mouse” Painter Application.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
CIS 3.5 Lecture 2.2 More programming with "Processing"
Object Oriented Programming Dr. Ennis-Cole CECS 5100.
Bitmap (Chapter 15).
Cut, Copy and Paste Slide #s and titles: 2. Identify buttons 3.Steps to copy text 4.Steps to cut & paste 5.Paste Options button image 6.Cut & paste = drag.
1 Actionscript for Flash by Dr SC Li. 2 Understanding more about instances Symbolsgraphics buttons Movie clips Instances (without names) No interaction.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Event Handling Tonga Institute of Higher Education.
Programming Input Devices. Getting the device state Schemes for processing input – Polling – Callbacks Ways to intercept messages from input devices –
How to Back Up In 10 Easy Steps. Step 1: Double click on My computer. You should see something like this. WatchWatch.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
MIS333k(Poynor) Chapter 2. Intro to VBA Events Where to plug in your programs?
William H. Bowers Elephants, Mice and Minnies. William H. Bowers Topics Pointing Mice Elephants Mouse Buttons.
Computer Vocabulary Computer
 2002 Prentice Hall. All rights reserved. 1 Outline Mouse Event Handling Keyboard Event Handling Graphical User Interface Concepts:
JavaScript Events.
Word 2010 Text Basics In this lesson you'll learn the basics of working with text, including how to insert, delete, select, copy, cut, paste, and replace.
Programming with Visual Studio MFC and OpenGL. Outline Creating a project Adding OpenGL initialization code and libraries Creating a mouse event Drawing.
CIS 338: Events Dr. Ralph D. Westfall April, 2011.
Implement User Input Windows Development Fundamentals LESSON 2.4A.
Chapter 14 Timers and Idle Processing Department of Digital Contents Sang Il Park.
CSE 154 LECTURE 10: MORE EVENTS. Problems with reading/changing styles Click Me HTML window.onload = function() { document.getElementById("clickme").onclick.
Chapter2: Drawing a Window. Drawing with the GDI.
Introducing Scratch Learning resources for the implementation of the scenario
Chapter 3 Keyboard Input Department of Digital Contents Sang Il Park.
THE MOUSE Left Click THE MOUSE Right Click.
Events and Event Handling
Scratch for Interactivity
Programming Input Devices
Interfacing.
Jim Fawcett Derived from a presentation by Dmitri Volper Su ‘2001
Introduction to Computers
Summer 2001 James Amyot Robert Gowans
A keyboard generates two scan codes when the user types a key
Chapter 1: An Introduction to Visual Basic 2015
JavaScript and Events.
Visual Basic Properties, Methods and Events
CSE 154 Lecture 11: More Events.
Chapter 5 The MFC Collection Classes
Windows Programming Lecture 12
Chapter 4 Menu and Chapter 6 File I/O
Chapter 5 The MFC Collection Classes
Exercise 1 Modify some parameters in the histogram.js and see what would happen (one by one) 20 in Line 2  in Line 3  in Line 15  .9.
Event Driven Programming Anatomy – Handle
Presentation transcript:

Week 3 C For Win Lecture :

 Mouse Message  Keyboard Message

 Windows uses a number of different messages involving the mouse.  These message fall into two categories :  Client-area mouse messages  Nonclient-area mouse messages  Mouse Events will be learned :  The press and release of a mouse button  The double click of a mouse button  The movement of a mouse

 Client-Area Mouse Messages

 Nonclient-Area Mouse Messages

 The press and release of a mouse button:  Mouse-Down Messages: User locate a position and press a left or right or middle mouse button. The message will be sent  Mouse-Up Messages: After pressing a mouse button, user release it. A mouse-up message is sent Example : WM_LBUTTONDOWN  WM_LBUTTONUP WM_RBUTTONDOWN  WM_RBUTTONUP

 The syntax of mouse-down(up)messages is :  afx_msg void OnxButtonDown(UINT nFlags, CPoint point);  afx_msg void OnxButtonUp(UINT nFlags, CPoint point); Meanings :  x : replaced with L(left), R(Right), or M(Middle)  point : identify the location of the cursor  nFlags : state of mouse button

 Example :

 The double click of a mouse button  When two clicks of the same button occur within a very short period of time.  The second button-down message will be replaced by a WM_xBUTTONDBLCLK message the window's WNDCLASS includes the class style CS_DBLCLKS

 The movement of a mouse:  After pressing one of mouse buttons, depending on the requirement, the user may not need to immediately release button. User can drag and move mouse to a new position. At that time the message WM_MOUSEMOVE is sent continuously  nFlags Indicates whether various virtual keys are down

 Example : BOOL m_bTracking ; CPoint m_ptTo; CPoint m_ptFrom;  OnInitDialog : m_bTracking = FALSE;

 Each key in our keyboard has a code that OS can regconize

 The Key-Down Effect :  When user press a key, the message WM_KEYDOWN is sent  The syntax : void OnKeyDown(UINT nChar, UINT nRepCnt,UINT nFlags ); nChar : specify the virtual code of the key that was pressed nRepCnt : specify the number of times counted repeatedly as the key was held down. nFlags : specify the scan code, extended-key flag, context code, previous key-state flag, and transition-state flag.

 If user need to use keyboard message. Do two steps :  Step 1: Add details to function PreTranslateMessage  Step 2: Check nChar in OnKeyDown function to do something OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) if (nChar == ‘{ký t ự }') {do yourself }(Ex: ‘A’,’B’,’1’,…) if (nChar == {Mã ký t ự ả o}) {do yourseft }

 Example:  int NumofLetter[30];  OnInitDialog : for(int i = 0; i < 30 ; i++) NumofLetter[i] = 0;