Chapter 7 Controls. Scroll bar control 3 Scroll bar control (1/3) Scroll bar codes (interfaces)

Slides:



Advertisements
Similar presentations
Using Macros and Visual Basic for Applications (VBA) with Excel
Advertisements

Office 2003 Advanced Concepts and Techniques M i c r o s o f t Word Project 6 Creating a Professional Newsletter.
1 After completing this lesson, you will be able to: Format text. Format numbers as currency. Use Format Painter. Add borders to cells. Add shading to.
Microsoft Excel 2003 Illustrated Complete A Worksheet Formatting.
Microsoft PowerPoint ® 2003 Carl B. Struck Presentation Graphics n Educational, business, sales and other presentations (slide shows) n Combination of.
Graphical User Interface (GUI) A GUI allows user to interact with a program visually. GUIs are built from GUI components. A GUI component is an object.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
Chapter 4: Working with Windows Types of Windows –Program Windows –Message Boxes –Dialog Boxes Elements of a Window –Window Panes –Scroll Bars –Menus –Tool.
1 Excel Lesson 2 Changing the Appearance of a Worksheet Microsoft Office 2010 Introductory Pasewark & Pasewark.
Tran Anh Tuan A.  Help to modify a control’s behavior by deriving classes of your own from the MFC control classes  Help to build reusable, self-contained.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
February 2006Colby College ITS Formatting Techniques for Excel 2003.
Chapter Seven: Presentation Software (MS PowerPoint 2007) Author(s): Ahmed Dalalah, Ahmed Abusalameh, Mohammad AlZoubi & Khaled Dajani (Prepared By: Ahmed.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Office Illustrated Introductory, Premium Edition A Worksheet Formatting.
Microsoft Office XP Illustrated Introductory, Enhanced A Worksheet Formatting.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
CIS—100 Chapter 15—Windows Vista 1. Parts of a Window 2.
Tutorial 1: An Introduction to Visual Basic.NET1 Tutorial 1 An Introduction to Visual Basic.NET.
Chapter 14. Copyright 2003, Paradigm Publishing Inc. CHAPTER 14 BACKNEXTEND 14-2 LINKS TO OBJECTIVES Add Borders with Borders Button Add Borders with.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
CTS130 Spreadsheet Lesson 4 Working with Cells, Columns, Rows, and Sheets.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
Presented by Dr. Jack E. Johnson at the 2007 NBEA Annual Convention Thursday, April 5, GDP, Distance Learning, & Word 2007 “Perfect Partners in.
1 Lesson 7 Getting Started with Word Essentials Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
1. Chapter 4 Customizing Paragraphs 3 More Paragraph Changes Highlight a paragraph in Word by applying borders and shading. Sort paragraphs to control.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Classic Controls Trần Anh Tuấn A. Week 1 How to create a MFC project in VS 6.0 How to create a MFC project in VS 6.0 Introduction to Classic Controls.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
IC 3 BASICS, Internet and Computing Core Certification Key Applications Lesson 11 Organizing the Worksheet.
Exploring Windows and Essential Computing Concepts 1 Windows Desktop u Windows Basics u Icon u Start Button u My Computer u Network Neighborhood u Recycle.
Chapter 3 The mouse and the Keyboard. Getting input from the Mouse.
Chapter 7 Controls.
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 15 Advanced Tables.
Microsoft Outlook 2010 Chapter 3 Managing Contacts and Personal Contact Information with Outlook.
1. Chapter 15 Creating Charts 3 Charting Data in Word A chart or graph presents data visually. A chart depicts numeric data in a graphical format. If.
Lecture 7 Menu, controls, scroll bars. Menu Menu item sends WM_COMMAND message to the application window Menu is attached to window when the window is.
Bitmap (Chapter 15).
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
Chapter 8 Dialog Boxes and Property Sheet. 2 Two kinds of dialog boxes Dialog boxes –Modal dialog When appear, it takes all ownership of input. It disables.
Lesson 1 - Understanding the Word Window and Creating a New Document
CSI 3125, Preliminaries, page 1 AWT Control. CSI 3125, Preliminaries, page 2 AWT Control The AWT supports the following types of controls: ■ Labels ■
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
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.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked.
Chapter 6: FILE I/O and Serialize CFile class. FILE I/O Serialization and the CArchive Class.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
Chapter 7 Controls. List box control 3 List Box Control(1/8) Listbox control: –Display lists of text strings called items –Optionally sort the items.
Microsoft PowerPoint Prepared by the Academic Faculty Members of IT.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
1 Chapter 6: Creating Oracle Data Block Forms. 2 Forms  Application with a graphical user interface that looks like a paper form  Used to insert, update,
Chapter 12. Copyright 2003, Paradigm Publishing Inc. CHAPTER 12 BACKNEXTEND 12-2 LINKS TO OBJECTIVES Create a Table Enter and Edit Text Delete a Table.
Chapter 5 Using a Template to Create a Resume and Sharing a Finished Document Microsoft Word 2013.
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
Chapter 1: An Introduction to Visual Basic .NET
Excel Tutorial 8 Developing an Excel Application
Working with Dialogs and Controls
CIS 16 Application Development Programming with Visual Basic
Click to edit title TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing arrow to the right on.
Click to edit title TO ADD NEW SLIDE LAYOUTS: Make sure you have the ‘Home’ tab selected at the top of the PowerPoint screen and click the down facing.
Presentation transcript:

Chapter 7 Controls

Scroll bar control

3 Scroll bar control (1/3) Scroll bar codes (interfaces)

4 CScrollBar Class(2/3) Member functions meaning SetScrollRange()Set the min and max range of the scroll bar SetScrollPos()Set the thumb position GetScrollPos()Get the thumb position

Scroll bar notification(3/3) Messages: Add message MACRO in MessageMap –Scroll Bars have no ID. Event Message Handler ON_WM_HSCROLL() or ON_WM_VSCROLL() ON_WM_HSCROLL() or ON_WM_VSCROLL() void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); WM_HSCROLL/ WM_VSCROLL

6 Scroll bar message handler (4/3) WM_HSCROLL/WM_VSCROLL 메시지 핸들러 –nSBCode Scroll bar code (types of event) –nPos Position of the thumb Only use when nSBCode is SB_THUMBPOSITION or SB_THUMBTRACK –pScrollBar Pointer to the scroll bar void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);

Coding Practice Add a edit control and scroll bar control Set the range of the scroll bar to (0, 100) Show the position value of the thumb in the edit control

Use Create Member function Create CScrollBar by hand m_VScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_VERT, rectVert, this, IDC_VSCROLLBAR); m_HScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_HORZ, rectHorz, this, IDC_HSCROLLBAR); m_VScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_VERT, rectVert, this, IDC_VSCROLLBAR); m_HScrollBar.Create (WS_CHILD ¦ WS_VISIBLE ¦ WS_BORDER ¦ SBS_HORZ, rectHorz, this, IDC_HSCROLLBAR);

Coding Practice Attach horizontal and vertical scroll bars as shown below and draw a circle. Adjust the position of the circle using the scroll bar.

List box control

11 List Box Control(1/8) Listbox control: –Display lists of text strings called items –Optionally sort the items and have scroll bar 속성 대화상자 Single Selection List box Multiple Selection List box

CListBox Class CListBox class encapsulates list box controls Creating a List Box –Use CListBox::Create member function m_ListBox.Create (WS_CHILD ¦ WS_VISIBLE ¦ LBS_STANDARD, rect, this, ID); m_ListBox.Create (WS_CHILD ¦ WS_VISIBLE ¦ LBS_STANDARD, rect, this, ID);

List Box Styles StyleDescription LBS_STANDARDCreates a "standard" list box that has a border and a vertical scroll bar, notifies its parent window when th e selection changes or an item is double-clicked, and sorts items alphabetically. LBS_SORTSorts items that are added to the list box. LBS_NOSELCreates a list box whose items can be viewed but not selected. LBS_NOTIFYCreates a list box that notifies its parent when the selection changes or an item is double-clicked. LBS_DISABLENOSCROL L Disables the list box's scroll bar when it isn't needed. Without this style, an unneeded scroll bar is hidden r ather than disabled. LBS_MULTIPLESELCreates a multiple-selection list box. LBS_EXTENDEDSELAdds extended selection support to a multiple-selection list box. LBS_MULTICOLUMNCreates a multicolumn list box. LBS_OWNERDRAWVARI ABLE Creates an owner-draw list box whose items can vary in height. LBS_OWNERDRAWFIXE D Creates an owner-draw list box whose items are the same height. LBS_USETABSTOPSConfigures the list box to expand tab characters in item text. LBS_NOREDRAWCreates a list box that doesn't automatically redraw itself when an item is added or removed. LBS_HASSTRINGSCreates a list box that "remembers" the strings added to it. Conventional list boxes have this style by defa ult; owner-draw list boxes don't. LBS_WANTKEYBOARDI NPUT Creates a list box that sends its parent a WM_VKEYTOITEM or WM_CHARTOITEM message when a ke y is pressed. This style is used to customize the list box's response to keyboard input. LBS_NOINTEGRALHEIG HT Allows a list box to assume any height. By default, Windows sets a list box's height to a multiple of the ite m height to prevent items from being partially clipped.

14 List Box Notifications –LBN_DBLCLK, LBN_SELCHANGE and LBN_SELCANCEL messages require LBS_NOTIFY style setting NotificationSent WhenMessage-Map MacroLBS_NOTIFY Required? LBN_SETFOCUSThe list box gains the input foc us. ON_LBN_SETFOCUSNo LBN_KILLFOCUSThe list box loses the input foc us. ON_LBN_KILLFOCUSNo LBN_ERRSPACEAn operation failed because of insufficient memory. ON_LBN_ERRSPACENo LBN_DBLCLKAn item is double-clicked.ON_LBN_DBLCLKYes LBN_SELCHANG E The selection changes.ON_LBN_SELCHANGEYes LBN_SELCANCELThe selection is canceled.ON_LBN_SELCANCELYes

15 Editing items Add and Delete Items Select items m_list.AddString(_T(“apple”)); m_list.DeleteString(3); // For a single selection list box m_list.SetCurSel(2); // For a multiple selection list box m_list.SetSel(2); m_list.SetSel(3, FALSE);

16 Get selected items // For a single selection list box int nIndex = m_list.GetCurSel(); if(nIndex != LB_ERR){ CString str; m_list.GetText(nIndex, str); } // For a multiple selection list box int nIndex = m_list.GetCaretIndex(); if(nIndex != LB_ERR){ CString str; m_list.GetText(nIndex, str); }

Coding Practice Add buttons, edit box and List box to a dialog application Add and delete an item in the list box using button controls