cis 338 additional controls l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CIS 338: Additional Controls PowerPoint Presentation
Download Presentation
CIS 338: Additional Controls

Loading in 2 Seconds...

play fullscreen
1 / 21

CIS 338: Additional Controls - PowerPoint PPT Presentation


  • 225 Views
  • Uploaded on

CIS 338: Additional Controls. Dr. Ralph D. Westfall April, 2011. Additional Interface Controls. TextBoxes, ListBoxes, Buttons, etc. are relatively simple parts of an interface VB.NET offers some more complex controls

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CIS 338: Additional Controls' - andrew


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cis 338 additional controls

CIS 338: Additional Controls

Dr. Ralph D. Westfall

April, 2011

additional interface controls
Additional Interface Controls
  • TextBoxes, ListBoxes, Buttons, etc. are relatively simple parts of an interface
  • VB.NET offers some more complex controls
    • MenuStrips make it possible to choose from multiple items, in an organized fashion
    • ToolStrips provide a graphic way (icons) for users to select actions
possible menus in applications
Possible Menus in Applications
  • File menu if your program uses files for input and/or output
  • Edit menu – could use code to copy, cut and paste data in your TextBox controls
  • Windows – can have more than 1 with VB's Multiple Document Interface (MDI)
menu issues
Menu Issues
  • menu = choices for user
    • usually drop down and give more choices
  • make menu items similar to common ones, where possible
    • e.g., File, Edit, View, Tools, Window, Help
    • easier to learn and use
    • don't force users into this pattern if your choices don't fit well with common ones
setting up a menustrip
Setting Up a MenuStrip
  • drag/drop a MenuStrip control from Toolbox (Windows Forms) onto form
    • [click in "tray" below form to get focus]
  • type in caption in Type Here at form top
    • put & before keyboard shortcut letter
  • add subItem choices below where it says Type Here
  • add new items on right
menustrip shortcuts
MenuStrip Shortcuts
  • can use Alt key for top level selections
    • [Alt] first letter is default top level shortcut
    • put & before any other letter for top level menu shortcutting (F&ormat)
    • underscore will show when press Alt key
  • setting up shortcut key (combinations) to select without using menu
    • drop down helps create combinations
    • best to follow common patterns
      • e.g., make copy be Ctrl-C (Ctrl+C)
multiple level issues
Multiple Level Issues
  • naming convention: mnu[top][2nd][3rd]
    • set in properties window
    • e.g., mnuFileNewWindow (IE browser)
  • triangle on right points to a submenu
  • … (3) dots after text means get more information (i.e., leads to a dialog box)
  • shortcut key shows on right if set = True
other menu item capabilities
Other Menu Item Capabilities
  • click dropdown triangle in Type Here
    • select Separator to create horizontal bar
      • has a name, just like other menu items
    • can also put a ComboBox or Textbox in menu to provide more choices for user or allow to type in a choice
invisible menu choices
Invisible Menu Choices
  • can use for choices that show up with rest of menu items based on a user action e.g.,
    • when another (not a child) form is visible
  • can create in Menu Editor like others
    • add a new top level choice to an existing menu
    • uncheck Visible for top level item
invisible menu choices 2
Invisible Menu Choices - 2
  • identify the event that will trigger the specified menu to become visible
  • create code for an event handler (e.g. double click a Button)
  • type code in the handler to show the menu
    • mnu[ ].Visible = True
code for menu items
Code for Menu Items
  • click lowest level items (on form)
    • 2nd level items if 2 levels
    • usually wouldn't add an action until get to lowest level menu item
  • type in code to handle selection in window
    • example: MsgBox(" [ ] menu item OK")
multiple level menus
Multiple Level Menus
  • top level choices open second levels
    • 2nd opens 3rd, etc.
      • e.g., Tools>Macros>Macros IDE … (VB)
      • e.g., View>TextSize>Larger (IE)
  • VB.NET allows many levels ( >10 )
    • how many menu levels are too much?
      • HCI (human computer interaction) experts: limit menu levels to not more than 3 (3 or less)
vb toolstrips
VB ToolStrips
  • icons to control program
    • e.g., at top of screen in IE, Word, etc.
    • when user clicks, runs a command or changes a setting
      • e.g., sends to printer, changes font size
adding a toolstrip
Adding a ToolStrip
  • select ToolStrip control and drop on form
    • change Anchor property if desired
    • use dropdown to select items for it
    • adjust properties of added items, as desired
configuring toolstrip buttons
Configuring ToolStrip Buttons
  • right click ToolStrip for options
    • Insert Standard Buttons provides buttons commonly used in Microsoft applications
  • set item values in Properties window
    • use a meaningful Name (btn[name])
    • set ToolTipText property for text to show on a mouseover
toolstrip buttons 2
ToolStrip Buttons - 2
  • set DisplayStyle to appropriate value
    • Image or Text
  • set Style to appropriate value (previous versions)
    • PushButton – runs code
    • ToggleButton – on/off
      • like B button for bold in Office
    • DropDownButton – drop down menu
toolstripmenuitem properties
ToolStripMenuItem Properties
  • some ToolStripMenuItem properties
    • Checked – if True, shows check on item
    • Enabled – False means grayed out
    • Visible – can't see it if this property is False
    • ToolTipText – show explanatory information for the menu item when user mouses over it
toolstripmenuitem properties18
ToolStripMenuItem Properties
  • additional properties
    • Text – menu text
    • Name – object's name in code
    • ShortcutKeys – special key(s) that can run code instead of clicking menu
      • function keys (F1, etc.)
      • key combinations ( [Ctrl] [Z] )
    • ShowShortcutKeys defaults to True
coding toolstrip buttons
Coding ToolStrip Buttons
  • click on ToolStrip button to get into Code window
    • add code as desired
coding toolstrips
Coding ToolStrips
  • can add buttons in code

'general declarations

Dim btnExit As New ToolStripButton()

'in a Sub

btnExit.Text = "Exit"

ToolStrip1.Buttons.Add(btnExit)

imagelist being deprecated
ImageList Being Deprecated?
  • in Components section of Toolbox now
    • drag and drop it onto form
    • right click it, select Properties, click … (3 dots) by Images property
    • click Add button (get from directory):
      • Microsoft Visual Studio Graphicsthese images are in some folder in your Visual Studio installation (can someone find it?)
      • select pictures