Multiple Document Interface (MDI) application

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

1 Windows CIS*2450 Advancing Computing Techniques.
Chapter 7: Sub and Function Procedures
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Excel and VBA Creating an Excel Application
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
Automating Tasks With Macros
Getting Started with VB .NET
Multiple-Document-Interface (MDI) Windows MDI programs enable users to edit multiple documents at once. MDI programs enable users to edit multiple documents.
MDI windows Single-document-interface (SDI)
CVEV 118/698 Visual Basic Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
A Guide to Oracle9i1 Creating an Integrated Database Application Chapter 8.
MENUS AND THE MENU EDITOR Elements of a Menu Menu bar Menu title Separator bar Menu items.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 13: Advanced GUI and Graphics
1 Multiple Document Interface (MDI) Windows. Single Document Interface (SDI) A program that can only support one open window or a document For Example,
Creating Menu. Objectives Create a menu system for a form –Create a menu –Create a menu titles –Create a menu items –Create a submenu –Modify menu –Edit.
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Chapter 8: String Manipulation
Neal Stublen Practice Solution  Create a new solution  Add a WinForms project  Add a Class Library project  Reference the library.
Saving and Loading Simple Text Files A sequential file stores characters one after the other like songs on a cassette tape. New characters are added to.
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
Visual Basic Chapter 1 Mr. Wangler.
1 Graphical User Interfaces Part 2 Outline Multiple Document Interface (MDI) Windows Visual Inheritance User-Defined Controls.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Getting Started with Application Software
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 6 Multiple Forms.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Multiple Forms, Standard Modules, And Menus
Multiple Forms and Standard Modules
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
MDI vs. SDI MDI – Multiple Document Interface SDI – Single Document Interface In an SDI application, each form acts independently of the others. A MDI.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
Lập trình trên Windows với Microsoft®.NET Giảng viên : Hồ Hoàn Kiếm.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 – Graphical User Interfaces Part 2 Outline.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
VB.NET Additional Topics
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Visual Basic Programming Chapter Six Notes Repetition and the Do Statement ADDING ICONS TO YOUR FORM –It is possible to add an ______________ to your title.
Basic Editing Lesson 2.
This eCPIC Quick Guide has been developed to assist System Administrators with creating Hierarchy Grids in eCPIC. The Hierarchy Grid functionality allows.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Visual Basic CDA College Limassol Campus Lecture:Pelekanou Olga Semester C Week - 1.
Win32 Controls & ActiveX Integration In this presentation… –Introduction to the new Win32 controls. What they are? How they are enabled? Potential uses.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Lesson 3 — Menus, MDIs, and Simple Loops Microsoft Visual Basic.NET, Introduction to Programming.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
Compound Data Types Part13dbg. 2 Point A Point is a simple built-in struct that stores a pair of screen coordinates. Instantiate a Point: Point aPoint.
DateTime, Code Regions, and Multiple Form Applications Part13dbg.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
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.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Multiple Forms and Menus
Standard Controls.
Lecture Set 11 Creating and Using Classes
Chapter 13 Additional Topics in Visual Basic
Presentation transcript:

Multiple Document Interface (MDI) application Part 1

Objectives Understand the characteristics of MDI applications Organize the procedures between forms in MDI applications Understand the role of standard forms in an MDI application Integrate menus in an MDI application and create context menus Understand the relationships between events in an MDI application Manage and organize the forms that make up an MDI application

Solution Organization

Characteristics of MDI Programs Single-document interface applications Create one instance of a particular form Multiple-document interface (MDI) applications Create multiple instances of the same form Display those multiple form instances such that they appear inside the region of another form Excel is an MDI application, for example

MDI Applications You can use three different types of forms in an MDI application An MDI parent form acts as the container for the MDI child forms in the solution An MDI child form always appears inside the visible region of its MDI parent form A project may have one or more MDI child forms Standard forms can be displayed anywhere on the screen and are not contained by the MDI parent form Standard forms are typically displayed as dialog boxes

Characteristics of MDI Applications MDI child forms can not be extended beyond the visible region of the containing MDI parent form Iconified MDI child forms do not appear on the task bar The user positions the icon inside the visible region of the MDI parent form Menus of MDI parent and MDI child forms are integrated

Displaying an MDI Child Form Code to create MDI child form appears in MDI parent form Create the child form instance Dim frmCurrentChild As New frmMdiChild() Designate the form as a child form frmCurrentChild.MdiParent = Me Display the child form frmCurrentChild.Show()

Organizing Procedures in MDI Applications (1) The following list describes the problems shared by nearly all MDI applications Procedures and data must often be shared by both MDI parent forms and MDI child forms An MDI parent form often needs to know which MDI child form instance is active From the MDI child form, you must often reference members of the MDI parent form or the MDI parent form itself

Organizing Procedures in MDI Applications (2) When organizing the procedures and variables in an MDI application, consider the following rules Locate the procedures that create instances of the MDI child forms in the MDI parent form In the MDI child form(s), create the procedures responsible for managing each instance of the MDI child form To share a global reference to the MDI parent form, declare a Friend or global variable in a module file When the MDI parent form loads, store a reference to the MDI parent form in the Friend or global variable

Standard Forms in MDI Applications MDI applications can have standard forms Characteristics Standard forms typically do not have menus Standard forms are typically displayed as modal dialog boxes

Menus and MDI Applications Each MDI parent form and any MDI child form in a solution can have its own menu system MDI application menus have unique characteristics One menu bar appears below the title bar of the MDI parent form An MDI parent form’s menu appears when no MDI child forms are loaded When an instance of an MDI child form is loaded or has focus, the menu of the MDI parent form is merged with the menu of the MDI child form Standard forms in an MDI application can have an associated menu but typically they do not

Merging Menus Menus of MDI parent and MDI child forms are merged based on the following property values: MergeOrder property Applies to a MenuItem and contains an Integer value Indicates the relative order in which two menus or menu items will be merged MergeType property Works in conjunction with the MergeOrder property Defines whether one menu will replace another menu, whether one menu will be added to another menu, or whether menu items will be merged together

The MergeType Property The MergeType property has a data type of MenuMerge Possible enumeration values Add - menu on the MDI child form will be added to the menu of the MDI parent form MergeItems - menu items on the MDI child form menu will be merged with the menu items on the MDI parent form menu Remove - MDI parent form menu or menu item will not appear in the merged menu Replace - causes the menu of the MDI child form to replace the menu appearing on the MDI parent form

Merging Menus (1)

Merging Menus (2)

Merging Menus (3)

Using Menus to Select MDI Child Forms To select and display an MDI child form from a menu Set the MdiList property of a menu item to True This setting causes the menu item to display a list of MDI child form instances The caption appearing in the menu is the same as the caption appearing in the title bar of the MDI child form The process is automatic - you need not write any statements to display the MDI child forms

Arranging MDI Child Forms The LayoutMdi method applies to the MDI parent form Use to configure display of child forms Four valid enumeration values ArrangeIcons - iconified MDI child windows are arranged along the bottom of the MDI parent form Cascade - visible MDI child windows are arranged such that each MDI child window appears below another MDI child window and is indented TileHorizontal - divides the MDI child forms horizontally to fill the visible region of the MDI parent form TileVertical - divides the MDI child forms vertically to fill the visible region of the MDI parent form

Context Menus Context menus typically appear when the user right-clicks on a control instance or the form itself To create a context menu: Create an instance of the ContextMenu control Create the menu items in-place Associate the context menu with a form or control instance by setting the ContextMenu property of the desired form or control instance to the context menu

Context Menus (Illustration) Context menu title cannot be changed Menu items

MDI Event Relationships Windows fires various events as the user navigates from form to form in an MDI application Events The Closing event fires for both the MDI parent and MDI child forms Fires first for all children and then the parent Event can be cancelled The Enter event fires for the MDI child form getting focus Use to update status information The Leave event fires just before an instance of the MDI child form loses focus

Order of Closing Events

Managing MDI Child Forms There is no Forms collection to manage the loaded MDI forms of an application Create a class to enable the developer to add and remove forms from the collection, and enumerate the collection with a For Each loop

Summary MDI application consists of Child forms MDI form and multiple MDI child forms Child forms Can be multiple instances of the same class, or each child can be an instance of different classes Basics of building an MDI application Designate one form as an MDI form by setting its IsMdiContainer property to True Add another form (Form2) to the project, which becomes a child form Because the form is defined as a class, the (parent) MDI form must instantiate a new (child) form2 (Form2Temp) Declare Form2Temp’s MdiParent property to be the MDI form itself Finally, show Form2Temp