IS 118 Introduction to Development Tools - PowerPoint PPT Presentation

is 118 introduction to development tools n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
IS 118 Introduction to Development Tools PowerPoint Presentation
Download Presentation
IS 118 Introduction to Development Tools

play fullscreen
1 / 27
IS 118 Introduction to Development Tools
151 Views
Download Presentation
erasmus
Download Presentation

IS 118 Introduction to Development Tools

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. IS 118 Introduction to Development Tools VB Chapter 03 IS 118

  2. Objectives • Have a clear understanding of the important features and the role various controls play in the user interface for data-entry operations • Set the tab order for the controls placed on the form • Understand the nature and uses of various events IS 118

  3. Obtaining Open-Ended Input • Text box • Has a Text property • Should have a label giving a clue what goes in the box • Masked Edit Box • Has a Mask property • Mask can contain placeholders (#,A) or literals (-,()) • Has a Text property • The exact content of the box, including literals • Has a ClipText property • Content of the box, without literals IS 118

  4. Focus • Control must have focus to accept data input • Press Tab key until you get to the control • Click on the control • By code, using the Focus method • Focus method should be part of button click events or error handling procedures • When a text box gets focus, a blinking cursor appears in box • Enter event is triggered when a control receives focus IS 118

  5. Comparing Text Properties • Setting at design time • Can only be done with text box • Setting at runtime • With text box, can set to anything • With masked edit, text must match mask pattern • Clearing at runtime • With text box, set to zero-length string • 3 steps for masked edit: • Clear the mask • Set text to zero-length string • Redefine the mask IS 118

  6. Highlighting Text • SelectedText property of text box gives the text that is highlighted • Corresponding property for masked edit: SelText • SelectionStart property of text box gives the position where highlight begins • Corresponding property for masked edit: SelStart • SelectionLength property of text box gives the length of highlighted text • Corresponding property for masked edit: SelLength IS 118

  7. Highlighting the Text Len(txtName.Text) returns number of characters. SelectionLength = Len(txtName.Text) will cause all characters in text box to be selected IS 118

  8. Highlighting the Text Text in txtName is highlighted when user tabs in. User can type new name without using the Delete key to get rid of old text. Makes application more friendly IS 118

  9. Arranging Many Controls • Group box • Used to group related data fields • Controls inside box treated as one logical unit • If you delete the group box, all controls deleted • Tab control • Organizes a window into logical tabbed pages • Both considered “containers” • They have the capability to hold other controls IS 118

  10. Data with Limited Number of Choices • Radio button • Only one button in a group can be selected • Good for mutually exclusive options, i.e. Male or Female • To allow multiple radio buttons to be selected on a window, use multiple containers • Check box • User can select as many items as he/she wants • Good for independent, rather than mutually exclusive options • Both have Text and Checked properties • Text property is the text next to the control • Checked can be True or False IS 118

  11. Longer List of Known Items • List box • Contains a list of items a user can select from • User can not enter items not in the list • User may have option to select multiple items • Good alternative to check boxes • Combo box • Contains a list of items a user can select from • User may enter items not in the list • User can only select one item • Good alternative to radio buttons IS 118

  12. Common Methods and Properties • SelectedItem property • Indicates the item selected (the text) • SelectedIndex property • Indicates the position of the item clicked • The first item has a SelectedIndex value of 0 • Items.Add method • Adds items to list box or combo box • Items.Count property • Gives the number of items in the list or combo box IS 118

  13. Selecting Items from the List Box • SelectionMode property determines how items are selected • When set to One, only one item can be selected • When set to MultiSimple or MultiExtended, user can select multiple items • GetSelected method used to determine whether or not an item is selected • Syntax: Listbox.GetSelected(Index) IS 118

  14. Selecting Items from the Combo Box • Combo box has a text box area and list box • DropDownStyle property determines whether or not user can enter data not in list • DropDown style (default) • Fixed height; user can select from list or enter text • Simple style • Adjustable height; user can select from list or enter text • DropDownList style • user can only select an item from the list IS 118

  15. Graphics in the Visual Interface • The Picture box • Has an Image property • Has a SizeMode property • Normal: size of picture box drawn on form sets boundary for the picture • StretchImage: size of image adjusted to fit the picture box • AutoSize: size of picture box adjusted to fit image • CenterImage: image appears in center of picture box • Use only company logos or art that is professionally designed for this application IS 118

  16. Setting the Image Property • Setting at design time • Set the Image property in the Properties box • Setting at runtime • Use the Image.FromFile method to load the picture • If you use this image, you run the risk that someone has moved or deleted the file • Write a routine to allow the user to select the picture in the event it has been moved or deleted IS 118

  17. Naming Conventions: Prefixes IS 118

  18. Setting Tab Order • Tab order: the order in which a VB control receives focus when user presses Tab key • Determined by control’s TabIndex property • Tab order is an important component of a user-friendly interface • user should not jump all over the form when he/she tabs • Form must have focus to set tab order IS 118

  19. The Tab Order IS 118

  20. Common Events • Form Load event • occurs when form is loaded into memory • before form is displayed • all controls are set to initial states • Click event • occurs when a user clicks a control • normally associated with a button • SelectedIndexChanged event • occurs when the user selects an item in the list box or combo box IS 118

  21. Common Events • KeyPress event • occurs when the user presses a key • often used for data validation • Enter event • occurs when a control receives focus • performs some “preparatory” activities • Leave event • occurs when user leaves a control • perform some finishing touches, such as field validation IS 118

  22. An Application ExampleThe Environ-Pure Project • Analyze and define requirements • An easy to use interface to take orders from distributors • Define the controls needed for the visual interface • Determine the data fields to be entered • Determine the appropriate type of control for each data field • Set the Tab Order • Window has a vertical layout, so tab order should flow from top to bottom IS 118

  23. An Application ExampleThe Environ-Pure Project • Code the Event Procedures • Several types of procedures needed • Form Load procedure sets default values • Validation procedures needed for several controls • Radio buttons should be enabled only if this is a rush order • Need procedures to save the data and to exit the application • Test the Project • Create a test plan to test every control • Try to make the application break! IS 118

  24. The Visual Interface IS 118

  25. Summary • Different controls have different uses • text boxes for open-ended data • masked edit boxes for data with defined pattern • radio buttons for data with limited number of mutually exclusive choices • check boxes for data with limited number of independent choices • list boxes for relatively large list with independent choices • combo boxes for relatively large list with mutually exclusive choices IS 118

  26. Summary • Containers are used to hold other items • group boxes used to group related data fields • tab controls used to group data into tabbed pages • Change tab order of controls to make interface more user-friendly • form must have focus to change tab order IS 118

  27. Summary • Different events can have different uses • Form Load event initializes values of variables and controls • Click event responds to user clicks on buttons, etc • SelectedIndexChanged event occurs when the user clicks on list boxes and combo boxes • KeyPress event previews keystrokes before displaying in control • Enter event performs preparatory tasks, such as highlighting text • Leave event performs finishing touches IS 118