|
Forms and Controls
With the introduction of the form to the code
environment a programmer can create true window applications and
be free from the single window database applications of old.
There are many solid and highly valuable applications written
years ago which can be dusted off and renovated. Now SmartWare
programmers can compete for the applications which today's firms
and end users are asking for.
A form is a window and behaves like the windows we
all have come to use. The form can hold controls such as
buttons, fields, graphs, pictures, text boxes, combo boxes, and
list boxes. The forms are created in the Form Editor.
The code associated with the form and the controls of the form can
be accessed from the Form Editor.
From the Database module choose File -- Modify
-- Form-View. Select a form to modify and it will be opened
in the Form Editor. The code that is associated with this
form is governed by the SPL Editor which can be accessed from the
Form Editor. From within the Form Editor choose from the
menu, Edit -- View-Code to open the SPL Editor.
The Toolbars
The Form Editor has three toolbars which are very
useful.
Property Sheets
Fields
ToolBox
If Property Sheet is not present the commands Edit
Toolbars Property Sheet Show will provide a means of
accessing the property sheet. The property sheet will show
and control the configuration of the form and the controls on the
form.
Within Edit Toolbars are options for Fields and
ToolBox.
If a database is attached to the form the fields
are available to the form. These fields can be dropped on to
the form and act as edit controls. If the fields do
not appear, this option may need to be set to Show.
Databases can be attached via the menu option Attach.
The ToolBox is a toolbar containing the most common
controls a form will use. these controls can also be created
from the menu with the Create option.
Smartware syntax is expanding with the addition of event driven
programming. Here is a very short attempt to answer some of
the most frequently asked questions concerning syntax.
1.
In form views file names and field names are separated with the
double dot operator.
example
CUSTOMER..FirstName
2.
In SQL queries file names and field names are separated with the
single dot operator.
CUSTOMER.FirstName
example
CUSTOMER.FirstName
3.
In SQL queries, literals are set in single quotations - not double
quotations. In all other areas of SmartWare literals are set in
double quotations. Single quotations are a standard
convention of SQL and not SmartWare.
SELECT *
from NATION
WHERE
NATION.FirstName = 'Johnson'
4.
If a field name includes a space, use square brackets to enclose
it. [ ] or double quotations. As a general rule use
square bracket all the time, even if there are no spaces in the
field name.
example
[First
Name]
Events are monitored by SmartWare, when these
events fire the code associate with the event is executed. Code
sample:
Function
Button1_DoubleClick()
file load form-view "05.vwf"
End
Function
|
A List of Common Controls
|
Controls
are very common in today's world. Controls can include:
Buttons
List
Boxes
Combo
Boxes
Boxes
and Rectangles
Charts
Label
and Notes
Pictures
Data
Source
Page
Break
Lines
Tables
ActiveX
Controls
These
controls can be placed on a form. In code a control uses its
Control Name. The Toolbox in the Form Editor will provide access
to these controls as will the menu options. SmartWare uses a
Command Reference model in which the menu options can represent
valid code. If you wish to create a control via code, the
menu structure is identical to the Command Reference.
|
Property Sheet of a Control
|
The following will detail the options available for
the Form that are offered in the Property Sheet. To make a change
to a setting, simply Left Click your mouse on the Property you
want to change and the property will turn blue. Clicking on the
Property Title a second time will lock the property in place. You
may change the property at any time. The Controls that are marked
with True or False are changed by simply clicking the check box.
The following Controls will offer a drop down box when clicked:
Font Name; Border Style; and Window Border.
If the property sheet is not visible, it can be
accessed in the Form Editor with the commands: EDIT -- TOOLBARS --
PROPERTY-SHEET -- SHOW
The General Property Sheet Controls
Section
The Section property is used to set the section
that the control appears in. Forms have one section, the detail
section, so all Form controls should have "0" for their Section
value. Window Reports have multiple sections and therefore
multiple section values.
Control Name
The Control Name property is used to set the name
by which the control will be referred through SPL (SmartWare
Programming Language).
Position Properties
The following controls, Left, Right, Top, Bottom,
Width and Height are designed to allow you to place the Form View
in the exact position on the screen you desire. You will notice
that when building a Form View, there is a grid presented that
corresponds to inches. The defaults are in inches. Changing any of
these values will immediately resize the working area for the form
box. Typically, the Left and Top Controls will remain at 0 which
can be interpreted and the upper left corner of the form starts at
the upper left corner of the screen.
Left
The default is: 0.00 inches
Top
The default is: 0.00 inches
Right
The default is: 5.00 inches
Bottom
The default is: 3.00 inches
Width
The default is: 5.00 inches
Height
The default is: 3.00 inches
Font Name
If you desire to change font for the item you are
working on, click on the font name and you will be presented with
a listing of all fonts currently installed on your computer.
Select the font you want. Form Views can a have a different font
for any of the components of the form.
Font Size
If you desire to change the font size of the item
on the Form View you are working on, click on the Control and type
the size of the font you desire. The only limitation of this is
the size that a given font will support. SmartWare does not
support fractional size font. (8.5)
Font Italic
The default is False, meaning No. To italicize the
font you are working on, click in the empty square box to the
right of the control. This will italicize the font. To change back
to regular appearance, click and the check mark will go away.
Font Underline
The default is False, meaning No. To underline the
font you are working on, click in the empty square box to the
right of the control. This will underline the font. To change back
to regular appearance, click and the check mark will go away.
Font Weight
The default is Bold. Click on this control and you
are presented with a drop down box that will offer the following
options: Thin, Extra Light; Light; Normal; Medium; Semi Bold,
Bold, Extra Bold, and Heavy.
The font options give full flexibility to control
the appearance of the field names and data.
Value
This property of a control can be many things.
If the control is an edit field, the value will be the text of the
edit field. The Value property can be used in code. For
clarity, the value of a control is the value the control is at
present holding. For example a field holds a value in each
of its records. As a reminder, Control Name identifies the control
in code, whereas value is what is held by the control.
Back Color, Fore Color and Border Color
These controls are designed to alter the colors of
your Form View background, foreground, and border. The default
colors are RGB 0,0,0. Click on the control you desire to change
and you will notice an icon appear to the right of the color
control. This is the Windows palette. Click on this icon and you
will be presented with the Windows color palette and you can
choose an existing color or blend any combination of Red, Green
and Blue to customize the appearance of your Form view. When you
change the color of any of these controls, the 0,0,0 default color
listed will change to reflect the blended combination of Red,
Green and Blue.
Elsewhere in the documentation are details of the
RGB command, new with this version. The color palette can be used
to experiment with exact color combinations values to be used with
the RGB function in SPL programs.
Border Style
Click on this control and you are presented with
three options for Border Style: Sunken, Flat and Transparent
Visible
The Visible property is used to set whether the
control is shown at run-time.
Tab Stop
If you desire the Tab key to move from field to
field in the input order, leave this the default of True. This
applies to controls on form, not when you are building a form.
Each control that can be part of the input order has a "Tab Stop"
and "Tab Index" property. If you want the control to be part
of the input order, you set "Tab Stop" to Yes. If you don't
want a control to be part of the input order, you set it to "No".
To set the order, you go to the control you want to
be first in the input order and set the "Tab Index" property to 0,
then the next to 1, etc.
Tab Index
The Tab Index property is used to set the input
order of the controls. When you edit this property, all other
control's Tab Index properties will also be affected.
Title
Click this control and type in the text you would
like to see appear on the title of the Form View you are working
on. This change will take immediate effect. The title of a form is
used to name the window. There are many commands which are
used to control the properties of the windows in the user
environment. The title of a form is the name of the window
it represents.
Window Border
Click here and there will be three options: Thin,
Sizable and None. The default is Sizeable. This properties
will effect how the window opens and whether it can be resized.
Be care when using these properties as they can restrict the
behavior of a window in code.
Modal
The Modal property is used to set the whether the
form is modal. A form that is modal is like a dialog box.
Everything under a modal form is disabled, and you cannot use
menus.
System Menu
The System Menu property is used to set whether the
form's title bar has a system menu on the left. The System
Menu is the set of three icons in the upper left corner
representing Maximize, Minimize, and Close.
Maximum Enabled
This control enables a window to be maximized. The
default is True. If you do not want this Form View to be
maximized, click to false.
Minimum Enabled
This control enables a window to be Minimized. The
default is True. If you do not want this Form View to be
minimized, click to false.
Center Window
The default is false. If you want this Form View to
always center on the screen, click to Yes.
Sort
If you desire a sort to be executed upon loading
the Form View, type in the name of the sort you want. Upon loading
the view, it is automatically sorted.
Query File
If you desire a query to be executed upon loading
the Form View, type in the name of the query you want or browse to
the query file. Upon loading the view, it is automatically
queried.
Show Query Results
If you want the results of the pre selected query
to be shown, leave this control at its default, true. If you wish
that the results are not shown, click to false.
|