0% found this document useful (0 votes)
38 views8 pages

Content Server Menus 2005

Content Server Menus 2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views8 pages

Content Server Menus 2005

Content Server Menus 2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

MENUS (VISUAL BASIC 2005)

Cosma Emil
Ovidius University of Constana, Faculty of Economic Sciences, Telephone 0766/221615, E-mail:
[email protected]

The menus are interface objects that offer the user a series of options, which allow the selection and
running of some processing operations. In one way or another, almost every graphical interface contains a
menu. A menu appears usually at the top of the application windows, has a standard structure, and,
generally, every operation that could be executed within an application must have a corresponded in its
menu in order to perform. The user creates for him/her a mental model of the applications structure by
simply analyzing the menus and the menu articles, the menu representing a way through which the user
communicates the system what operations to do at a given time.

Keywords: Basic, Financial Functions, Menus, Submenus, MenuItems, MenuStrip

A menu usually consists of a bar (Menu Bar, zero level menu), which contains many elements (options).
Every menu element can have an own list of menu elements that groups within a submenu. The elements
included in a submenu can also have their own submenus (in this case, the submenu has sometimes the
name of menu). Those are connected to a vertical submenu that is going to be activated only when
choosing the option. The users choice of vertical menus options may lunch a processing operation or the
display of a new vertical submenu (fig.1).

Menu

Submenu fig. 1

Although there is no theoretical limit to the number of submenus that may be introduced when running an
application, it results practically that there is a limit of two submenu levels that succeed the main menu.
When a menu element contains a submenu, an arrow appears on its right side. The corresponding submenu
appears when placing the mouse cursor on that particular menu element.

 Main menus
Internal, the zero level menus consist of the MenuItems collection of the MainMenu control. The menu
items create another MenuItems collection, each of it being attached to the menu it belongs to. Regarding
the visual aspect, the zero level menus are also MenuItem type objects, just the same as every element
included within a menu or a submenu situated within a lower menu hierarchy.
Example:
 When having an opened form within the design environment (Text Property: Financial Functions),
one should select the MenuStrip control from the Toolbox. This will be added to the form, having
the name of MenuStrip1, but it may change (Name Property) to a suggestive name (ex.
MnuFunction). One may type the menus text value after selecting the Type Here box within the
form, which stands also for the menus title (here Function). After introducing the text related to
1330
the first menu, a new Type Here box will appear for adding either an element from submenu, or
another zero level menu (fig. 2):

fig. 2

 Within the zero level menu, one should introduce successively the desired options in the Type Here
box (fig. 3).

fig. 3

 Submenus
Example:
 The submenus have to be introduced (fig. 4):

fig. 4

 Menus Up to Date
 The introduction of a new element. One may select the menu element that is located
at an inferior position to the new elements location. Mouse right-click on: Insert,
MenuItem (fig. 5).

1331
fig. 5

 The deletion of an element. One should select the menu element, mouse right-click,
Delete.
 The introduction of a separator. One may select the menu element that is inferior to
the place where the separator will be located. Mouse right-click: Insert, Separator
(fig. 6).

fig. 6

 The addition of a contextual menu


Example:
 A Button type control should be added to the form. This button will be connected with the
contextual menu, therefore the elements included in it will become visible when the user right-
clicks on the button.
 One should add the ContextMenuStrip control from the Toolbox. The control will be visible in the
reserved area that is located inferior to the form.
 The text value of the first contextual menu element should be introduced within the text box that is
situated under the ContextMenuStrip location, and afterwards, other elements could also be
introduced.
 Within the Properties window, for the introduced button, the ContextMenuStrip1 value has to be
placed within the ContextMenuStrip property (fig. 7).

1332
fig. 7

When running the program, the contextual menu elements will by displayed if one right-clicks on the
Button1 control (fig. 8):

 Access keys

fig. 8

The access keys allow the user to run over a menu hierarchy by pressing different keys together with the
Alt key. For instance, if the access key of the Function menu is F, and the access key of the PV element
from the Function menu is P, then the Alt+F keys combination followed by pressing the P key, has the
same effect as selecting, using the mouse, the PV menu element from the Function menu. When
introducing the text value of a menu element, if one places an ampersand (&) before the letter, this will be
defined as an access key and therefore will appear underlined (fig. 9).

1333
fig. 9

The standard principle of the graphical interface utilization is the fact that every menu element should be
accessible by means of using an access keys combination. The access keys for the zero level menus should
have no duplicate and all access keys for the menu elements belonging to each individual menu should also
be unique. Although the access keys are mostly consisted of the first letter of the menu elements title, in
order to avoid the duplicate, one may use another letter within the word. For example, using E&xit in the
Exit option, allows the Alt+X key combination to become the access key for the Exit menu element.
 Shortcuts
Keyboards shortcuts (ShortcutKeys property) invoke the menu elements functionality. Shortcuts are
actually keys combinations; for instance, Ctrl+P is the combination for the PV option of the Function
menu (fig.10).

fig. 10

Shortcuts are composed of the control keys (Ctrl, Shift, Alt), the functional keys, the letters and the ciphers.
For instance, the shortcut for the Exit element could be defined as the Alt+X combination.
 The names of the menu components
The text values that are introduced within the Type Here boxes do not actually represent the name of the
menu or of the menu elements. These text values as Function or Windows- are just the menu elements
titles, namely their visual impress. On the other hand, the name of a menu element is an identifier used in
the program sequences of the Menu object and it is never seen by the users. It is not recommended to
1334
utilize the names of the menus or of the menu elements given by the Visual Basic programming
environment (the name of every menu or menu element is formed by the concatenation of the word
ToolStripMenultem together with a number representing the order in which that particular menu or menu
element has been added to the form).
A better approach would be to give some significant names to the menu elements at least to those
introduced within the program code. A helpful convention for menus would be the utilization of the mnu
prefix, followed by that particular menus title for example, mnuFunction and mnuWindows. Regarding
the menu elements, the elements title will be attached to the menus name for instance, the PV menu
element of the Function menu has the name of mnuFunctionPV (fig.11).

fig. 11

 Events launched through menu


When the user selects a menu element (Click event), one code sequence may be activated just the same
way as the click event is generated by a button type control. The event procedure of the Exit element (the
name mnuFunctionExit) may be edited using the code editor (double-click on the menu element) (fig.12):

Private Sub mnuFunctionExit_Click(ByVal sender As


MsgBox("Exit!")
Me.Close()
End Sub

1335
fig. 12

BIBLIOGRAPHY
1. Cosma Emil (2007) VISUAL BASIC VBA 2007 Studio 2005, Ed. MATRIX ROM,
Bucureti
2. Harold Davis (2004) VISUAL BASIC pentru Windows, Ed. Corint, Bucureti;
3. McFedries VBA(2006) Ghid pentru nceptori, Ed. TEORA, Bucureti
4. Parsons Andrew (2005) Wroxs Visual Basic, Express Edition, www.wrox.com
5. Rod Stephens (2005) Visual Basic, Programmers Reference, www.wrox.com
6. Walnum Clayton (2003) VISUAL BASIC.NET, Ed. B.I.C. ALL, Bucureti

1336
Copyright of Annals of the University of Oradea, Economic Science Series is the property of Annals of the
University of Oradea, Economic Science Series and its content may not be copied or emailed to multiple sites or
posted to a listserv without the copyright holder's express written permission. However, users may print,
download, or email articles for individual use.

You might also like