CPS613

Module 04-Editor

Toronto Metropolitan University University

Learning Objectives

In this module you will learn how to
  • implement menu, tool, status and progress bars in VB.net
  • use build-in forms such as about box, save and open dialog boxes
  • perform some file operations in VB.net
  • work with rich textboxes

Module Description:

Summary

In this module you will be develop a small editor app with a menu, tool bar, and status bar.

User Interface and Interaction

The application will behave like ModuleEditor.zip

This rtf editor is a miniature word processor: in addition to being able to enter and delete text, the user will be able to select text and change its font or colour. The user interface consists of a main window containing a menu strip, toolbar strip, and status bar with progress bar, and other windows containing rich text documents that can be edited. One the documents is active at a time.

  1. The menu strip (MenuStrip control) contains three top-level menus: File, Edit, and Help, which all contain very standard functionality:
    • File provides the file operations for this module:
      • New - Opens a new richtextfile (.rtf) document with the name "Document X" where X is the order in which this document has been opened during the session. This document becomes the active document
      • Open ... - Opens an OpenFileDialog box to find a richtextfile (.rtf) document to open, and opens that document which then becomes the active document. The caption of the window containing that document shows the full path of the document.
      • Save - saves the active document
      • Save As ... - Opens a SaveFileDialog box to choose where to save the active document. The file is saved, and the caption of the window containing that document shows the new full path of the document.
      • Exit - closes the program.
    • Edit provides simple operations to edit selected text in the active document:
      • Font ... - Opens a FontDialog box to select the new font for the selected text in the active document.
      • Color ... - Opens a ColorDialog box to select the new colour for the selected text in the active document.
    • View and Windows menus will come prebuilt in the form you will be using.
    • Help has one menu item:
      • About - initiates an AboutBox that displays application information.

  2. The tool bar strip (ToolStrip control) replicates six of the menu options:
    • It contains three sections separated by separators for functions from the File, Edit, and Help menus.
    • Each section contains on button for each of the choices in the menu that has an associated icon: new, open, save, Font, colour, about. Each button should have a representative icon and have the same functionality as its corresponding menu item.

  3. The status bar contains two control elements: a Status Label and a Progress Bar. These are used to display the status and progress of each file operation .
    • Status Label - updates to reflect the current status of the program. For example, the status label should show the name of file being opened.
    • Progress Bar - shows the current progress of an ongoing process.

Implementation Details

  1. The main form for your project should be and MDIParent form. Once you have added that form to your project, make sure that it is the startup object for your project. To do this, double-click on My Project in the solution explorer, and select that form as the startup object (under Application > General).

  2. This MDI form contains a lot of the infrastructure that you will need for this module. The challenge of the module is to add the missing functionality and remove the unnecessary functionality.

  3. You will need a second form that works as a template for the documents being edited. This form will contain a single RichTextBox control that should fill the entire form and be resized along with it. (This can be done in the Design view by configuring the appropriate properties)

Handouts

In the Handouts directory you will find:

References

References for this module are in the Windows and Forms Reference.
Explanations of all VB features needed for all the modules can be found at the General Assignment References page


This page is maintained by Sophie Quigley (cps613@cs.torontomu.ca)
Last modified Thursday, 10-Oct-2024 23:36:14 EDT