Visual Basic
Command Control Button
The Command button is a
common control frequently
used in VB programming. This is one of the first controls that
beginners learn to place
onto a form and then to code an "event procedure" for the command
control object. An event procedure is something that happens in
response to a user action such as a click
or a "mouse over". (If an object on a form has no corresponding code
written by the programmer, nothing will happen if the user clicks on the
control or attempts any other action with that control.)
Double-clicking
on a Command button in the toolbar will place it onto
the center of your form. Left click on it the "draw" it onto the form
by dragging the mouse and at the same time, holding down the left mouse
key while dragging. Release the left mouse key when the object
is the size you want it to be. You can also "drag" an object in the
work area by first selecting the object with a single mouse click then
dragging the object by positioning the mouse pointer over the object,
holding down on the left mouse key, and moving the object to a new
location in the work area, then releasing the left mouse button to stop
the move and finally, by clicking somewhere off the object to deselect
the
object that was just moved.
While the mouse pointer is over the Command button, click and release the left mouse button
to highlight (select) the Command button. You will see resizing handles appear which you can
drag diagonally, horizontally, or vertically to change the size of the Command button. The only reason
you would want to do this is to fit a large caption onto the button. Most of the time, you will
not need to resize the Command button. Beginners like to play with the resizing so have fun with it.
Another way to place a Command button onto a form is to single-click on the Command button
in the Toolbar. Then place the mouse pointer over the form and hold down on the left mouse
button while dragging a short diagonal line from corner to corner where you want the button
to be placed. If the size is not right, left-click on the button and drag the re-sizing handles
to make it the size you need.
EDIT BOX
An edit box is a control used to either display text,
to request text, or to do both. It it provided as a rectangular control
with a sunken white background and 3-D borders.
To add an edit box
|
BOOL CLabelDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CEdit *Musician = new CEdit;
Musician->Create(WS_CHILD | WS_VISIBLE,
CRect(10, 50, 150, 70), this, 0x1552);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
RADIO BUTTON
A radio button is a Windows control made of two
sections: a round box
O and a label. The label informs the user as to what the control is used
for. The user makes his or her decision by selecting or clicking the
round box
8. In practical usage, a radio
button is accompanied by one or more other radio buttons that appear and
behave as a group. The user decides which button is valid by selecting
only one of them. When the user clicks one button, its round box fills
with a (big) dot:
8. When one button in the
group is selected, the other round buttons of the (same) group are
empty. The user can select another
button by clicking a different choice, which empties the previous
selection. This technique of selecting is referred to as
mutually-exclusive.
CHECK BOX
| A checkbox control has two states, "checked" and "unchecked." It can be
applied wherever a choice is expected of the user, such as agreeing to
the conditions set by a vendor before installing a software or selecting
multiple choice answers. The checkbox is based on the CButton class of
the MFC (Microsoft Foundation Class) Library. Using MFC Check Box
controls in a program is fairly simple to learn.
LIST BOX
The user makes a selection by clicking in the list.
Once clicked, the item or line on which the mouse landed becomes
highlighted, indicating that the item is the current choice. Once an item
is selected, to make a different selection, the user would click another.
The user can also press the up and down arrow keys to navigate through the
list and make a selection.
As far as item selection is concerned, there are two
types of list boxes: single selection and multiple selection.
One of the main reasons for using a list box is to
display a list of items to the user. Sometimes the list would be very
large. If the list is longer than the available space on the control, the
operating system would provide a scroll bar that allows the user to
navigate up and down to access all items of the list. Therefore, you will
have the option of deciding how many items to display on the list.
COMBO BOX
A combo box is a Windows control that holds a list of
items. Each item can be a null-terminated string or it can be made of a
bitmap and a string. In fact, there are various types of combo boxes.
|
As far as looks are concerned, there are two types of
combo boxes. The most regularly used combo box is made of two sections.
The main part is an edit box. On the right of the edit box, there is a
button with a down pointing arrow:
To use this type of combo box, the user would click
the down pointing arrow button. This causes a list of items to display:
If the user finds the desired item in the list, he or
she can click it. The item clicked becomes the selection and it gets in
the edit box side of the combo box:
If the user does not find the desired item, he or she
can click the down pointing arrow. In this case, no selection is made and
the combo box remains as it was before the button was clicked, whether it
had an item or not.
A combo box is called "Drop Down" or Drop List
if it is made of an edit box and a down pointing arrow, as
described above. Another type of combo box is referred to as
Simple. This kind displays its items like a list box. The user
does not have to click an arrow button to display the list. When a
simple combo box displays, the user can locate the desired item in
the list and click it. The selected item becomes the value of the
edit side.
|
A combo box is used to display a list of items to the
user to select from. A combo box allows the user to select only one item
from the list. If the number of items is higher than the allocated space
can accommodate, the combo box is equipped with a vertical scroll bar,
whether it is a drop type or a simple kind.
A combo box (especially the drop kinds) has the
advantage of saving space as it can use only as much space as a
combination of an edit box and a small button.
MENU DESIGN
|
A menu is a list of actions the user can perform on
an application. The actions are presented in one or more groups. There
are broad categories of menus: the main menu and the context menu.
A main menu, also called a top-level menu, displays
categories of menu items using a range of items called a menu bar:
|
When the user clicks an item of the menu bar, the
item clicked opens its list:
After a list has been displayed, the user can then
use an item from the list. Each item of the list is primarily a word or
a group of words on a line. Different menu items are used for different
reasons. For example, some menu items simply display a word or a group
of words. Some other items display a check mark. This indicates that
the item toggles the availability or disappearance of an object.
When a menu item is only meant to lead to a
sub-menu, such a menu item is called a popup menu. There are two types
of popup menus. If the menu displays on top of a window, which is the
type of menu under the title bar, the word on top, which represents a
category of menu, is a popup menu. If a menu item is equipped with an
arrow in its right , which means the menu item has a submenu, such a
menu item is also a popup menu. Popup menus are used only to represent
a submenu. No inherent action is produced by clicking them, except that,
when placed on top, such menu items allow opening the submenu.
To create menus that belong to a group, menu items
are separated by a horizontal line called a separator. Separators are
created differently in MSVC 6 and MSVC 7.
|
CONSTRUCTOR
In object-oriented programming, a constructor (sometimes shortened to ctor) in a class is a special type of subroutine called at the creation of an object.
It prepares the new object for use, often accepting parameters which
the constructor uses to set any member variables required when the
object is first created. It is called a constructor because it
constructs the values of data members of the class.
A constructor resembles an instance method,
but it differs from a method in that it never has an explicit
return-type, it is not inherited (though many languages provide access
to the superclass's constructor, for example through the
super keyword in Java),
and it usually has different rules for scope modifiers. Constructors
are often distinguished by having the same name as the declaring class. They have the task of initializing the object's data members and of establishing the invariant of the class, failing if the invariant isn't valid. A properly written constructor will leave the object in a valid state. Immutable objects must be initialized in a constructor.
Programmers can also use the term constructor to denote one of the tags that wraps data in an algebraic data type. This is a different usage than in this article.[dubious ] For more information, see algebraic data type.
Most languages allow overloading
the constructor in that there can be more than one constructor for a
class, each having different parameters. Some languages take
consideration of some special types of constructors:
1.parameterized
2.default
3.copy
4.dynamic
5.conversion
DESTRUCTOR
In object-oriented programming, a destructor (sometimes shortened to dtor) is a method which is automatically invoked when the object is destroyed. Its main purpose is to clean up and to free the resources
(which includes closing database connections, releasing network
resources, relinquishing resource locks, etc.) which were acquired by
the object along its life cycle and unlink it from other objects or
resources invalidating any references in the process. The use of
destructors is key to the concept of Resource Acquisition Is Initialization (RAII).
In binary programs compiled with the GNU C Compiler, special table sections called .dtors
are made for destructors. This table contains an array of addresses to
the relevant functions that are called when the main() function exits.[1] A function can be declared as a destructor function by definining the destructor attribute __attribute__ ((destructor)) for a static function
In a language with an automatic garbage collection
mechanism, it would be difficult to deterministically ensure the
invocation of a destructor, and hence these languages are generally
considered unsuitable for RAII.
In such languages, unlinking an object from existing resources must be
done by an explicit call of an appropriate function (usually called
Dispose()). This method is also recommended for freeing resources rather than using finalizers for that.
DIALOG BOX
A dialog box is a rectangular window whose main role is to
host or hold other Windows controls. For this reason, a dialog box is referred
to as a container. It is the primary interface of user interaction with the
computer. By itself, a dialog box means nothing. The controls it hosts
accomplish the role of dialog between the user and the machine.
A dialog box has the following characteristics:
|
- It is equipped with the system Close button
. As the only system button, this button allows the user to dismiss the dialog and ignore whatever the user would have done on the dialog box.
- It cannot be minimized, maximized, or restored. A dialog box does not have any other system button but Close.
- It is usually modal. The user is usually not allowed to continue any other operation until the dialog box is dismissed.
- It provides a way for the user to close or dismiss the dialog. Most dialog boxes have the OK and the Cancel buttons, although this depends on the application developer. When the dialog has the OK and the Cancel buttons, the OK button is configured to behave as if the user had pressed Enter. In that case, whatever the user had done would be acknowledged and transferred to the hosting dialog box, window, or application. Pressing Esc applies the same behavior as if the user had clicked Cancel.
Walang komento:
Mag-post ng isang Komento