
CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 1 Chapter 10 Basic Graphical User Interface Concepts (Main Page) 10.1 Intrinsic controls. 10.2 Components dialog. 10.3 ActiveX controls discussed in this book. 10.4 Database ActiveX Controls presented in Chapter 18. 10.5 Common TextBox properties and methods. 10.6 Program that demonstrates using TextBoxes controls. 10.7 MaskEdit control in the Components dialog. 10.8 Pop-up menu displayed when a MaskEdit control is clicked with the right mouse button. 10.9 Property Pages dialog for the MaskEdit control. 10.10 Some MaskEdit control properties. 10.11 Some common mask characters. 10.12 MaskEdit control at design time. 10.13 Demonstrating the MaskEdit control. 10.14 Property Pages dialog for MaskEdit control of Fig. 10.12 and 10.13. 10.15 Common ComboBox properties methods and events. 10.16 ComboBox styles. 10.17 Demonstrating the ComboBox control. 10.18 Common ListBox properties and methods. 10.19 ListBox styles. 10.20 Multiple selection in a ListBox. 10.21 MultiSelect property values. 10.22 Demonstrating the ListBox control. 10.23 HScrollBar control. 10.24 Common scrollbar properties and methods. 10.25 Demonstrating scrollbars. 10.26 Sliders. 10.27 Common Slider properties and methods. 10.28 TickStyle property values. 10.29 Demonstrating the Slider control. 10.30 Menu Editor dialog. 10.31 An expanded menu. 10.32 Checked menu items. 10.33 Program with two menus. 10.34 Menu Editor dialog for the program of Fig. 10.33. 10.35 Demonstrating pop-up menus. 10.36 MsgBox dialog generated by Visual Basic. 10.37 MsgBox constants for specifying the number and type of buttons. 10.38 MsgBox constants for icons. 10.39 MsgBox constants for specifying the number and type of buttons. 10.40 MsgBox return values. 10.41 Demonstrating the function MsgBox. 10.42 MsgBox constants for specifying the number and type of buttons. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 2 Pre- ferred Control Icon Prefix Description CheckBox chk Acts as a toggle. (Ch. 7) ComboBox cbo Displays a drop-down list. (Ch. 10) Data dat Navigates data in a database. DirListBox dir Displays a directory box. (Ch. 14) DriveListBox drv Displays a drive list box. (Ch. 14) FileListBox fil Displays a file list box. (Ch. 14) Frame fra Acts as a container for other controls. (Ch. 6) Image img Displays images. (Ch. 9) Label lbl Displays static text. (Ch. 2) Line lin Draws lines. (Ch. 9) ListBox lst Displays a list. (Ch. 10) OLE ole Acts as an OLE container. OptionButton opt Displays options from which the user can choose only one. (Ch. 10) PictureBox pic Displays images. Also acts as a container for other controls. (Ch. 9) scrollbars hsb, vsb Specify a range of values. (Ch. 10) Shape shp Draws graphical shapes. (Ch. 9) TextBox txt Control for user input. (Ch. 10) Timer tmr Raises an event after a specified interval. (Ch. 9) Fig. 10.1 Intrinsic controls. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 3 Fig. 10.2 Components dialog. Pre- ferred Control Icon Prefix Description CommonDialog dlg Provides several common dialog boxes such as Open, Save, etc. (Ch. 9) FlatScrollBar fsb A scrollbar that provides a visual response when the mouse is positioned over the scrollbar. (Ch. 11) ImageCombo imgcbo An enhanced ComboBox that is capable of displaying images and text. (Ch. 11) ImageList ils Stores a series of images. (Ch. 11) MaskedEdit msk An enhanced TextBox that can control the format of text entered by the user. (Ch. 10) RichTextBox rtf An enhanced TextBox that provides basic text editor capabilities. (Ch. 11) Slider sld Represents a range of values. (Ch. 10) UpDown upd Allows scrolling through a set of values. (Ch. 11) Fig. 10.3 Some ActiveX controls discussed in this book. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 4 Pre- ferred Control Icon Prefix Description ADO Data ado Supports connecting to a database. Control DataCombo dbc An enhanced ComboBox that is popu- lated automatically with data from a data- base. DataGrid dgd A table that is populated automatically with data from a database. DataList dbl An enhanced ListBox that is populated automatically with data from a database. Hierarchical flex A table that is populated automatically FlexGrid with data from a database. This table is read-only (data cannot be modified). Fig. 10.4 Database ActiveX Controls presented in Chapter 18. Property/method Description Properties Enabled Specifies whether or not the user can interact with the control. Index Specifies the control array index. Locked Boolean. Specifies whether or not the user can type in the TextBox. MaxLength Specifies the maximum number of characters input. Default of 0 corre- sponds to any number of characters. MousePointer Specifies the shape of the mouse pointer when over a TextBox. Multiline Specifies whether or not the TextBox contains more than one line. PasswordChar Specifies the masking character for text displayed in the TextBox. Scrollbars Specifies either horizontal scrollbars, vertical scrollbars or both horizontal and vertical scrollbars for the TextBox. This property is used with the Multiline property. Text Specifies the TextBox text. ToolTipText Specifies what text is displayed as the TextBox’s tool tip. Visible Specifies whether or not the TextBox is visible. Method SetFocus Transfers focus to the TextBox. Event Procedures Change Called when text in TextBox changes. Clicked Called when TextBox is clicked with the mouse. GotFocus Called when TextBox receives the active focus. LostFocus Called when TextBox loses the active focus. Fig. 10.5 Common TextBox properties and methods. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 5 Property/method Description KeyDown Called when a key is pressed while the TextBox has the focus. KeyUp Called when a key is released while the TextBox has the focus. Fig. 10.5 Common TextBox properties and methods. 1 ' Fig. 10.6 2 ' Demonstrating the TextBox Control 3 Option Explicit ' General declaration 4 5 Private Sub txtInput_Change() 6 txtDisplay.Text = txtInput.Text ' Copy to other TextBox 7 End Sub tool tip mouse pointer Fig. 10.6 Program that demonstrates using TextBox controls. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 6 Fig. 10.7 MaskEdit control in the Components dialog. Selected MaskEdit Activex control Pop-up menu Properties menu item that displays Property Pages dialog Fig. 10.8 Pop-up menu displayed when a MaskEdit control is clicked with the right mouse button. Tabs Fig. 10.9 Property Pages dialog for the MaskEdit control. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 7 Property Description AllowPrompt Specifies whether or not the prompt character is acceptable input. AutoTab Specifies whether or not the focus is transferred to the next contol in the tab order when the required number of characters is input. Enabled Specifies whether or not the user is allowed to interact with the con- trol. Format The format the text is displayed in when the control does not have the focus. HideSelecton Specifies whether or not the selected text appears highlighted when the control loses focus. Mask A String that describes the input mask. Masking characters are shown in Fig. 10.11. MaxLength Maximum number of characters allowed as input. MousePointer Specifies the shape of the mouse pointer. Text Text displayed in control. Fig. 10.10 Some MaskEdit control properties. Mask character Description # A numeric character is required in this position. A decimal point which is treated as a literal (a character that is simply displayed in the MaskEdit control. , A thousands separator which is treated as a literal. / A date separator which is treated as a literal. : A time separator which is treated as a literal. \ The character immediately following the backslash is treated as a lit- eral. Backslash is often used with the other mask symbols: a, A, etc. & An ANSI character in the ranges 32 to 126 and 128 to 255 (see Appen- dix B for a complete listing of the ANSI character set). > Converts characters to uppercase. < Converts characters to lowercase. A An alphanumeric character is required at this position. a An alphanumeric character is optional at this position. 9 A numeric character is optional at this position. ? An alpha character is required in this position. Fig. 10.11 Some common mask characters. © Copyright 1999 Prentice Hall. All Rights Reserved. For use only by instructors in courses for which Visual Basic 6 How to Program is the required textbook. CHAPTER 10 BASIC GRAPHICAL USER INTERFACE COMPONENTS 8 Fig. 10.12 MaskEdit control at design time. Initial form startup. Button has the focus. Focus transferred to the MaskEdit control when the Tab key is pressed. MaskEdit control only accepts numeric input. The user can- not modify the paren- theses or hyphen. As soon as the last digit is input, the focus is transferred to the Dial button.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages27 Page
-
File Size-