Tutorials to .com

Tutorials to .com » Database » Foxpro » VFP form the basis of Chapter VII of the Design Guide

VFP form the basis of Chapter VII of the Design Guide

Print View , by: iSee ,Total views: 43 ,Word Count: 3296 ,Date: Sat, 18 Apr 2009 Time: 6:37 PM

7.1 The basic concept

1. Glossary

Form:

That is, the exchange of computer users with a screen interface for data display, enter, modify. The interface can be designed and the definition of a container type, which may include a number of control (or object).

Set the form:

Can contain one or more of the container form.

Data Environment:

In the open or modify a form or report required to open all the tables, views and relationships. It forms the window (similar to a database designer) and the form reflects the form, view the relationship between form and so on. Design data can be used to create and modify the form of the data environment.

2. Form design interface

VFP form the basis of Chapter VII of the Design Guide

Include: the form guide, the form designer, form designer toolbar, form controls toolbar, Properties window

3. Form commonly used in the design of the properties, events and methods to introduce

Properties, events, methods Description Default value
AlwaysOnTop property Form is always in control of whether to open a window on the other False (. F.)
AutoCenter property Control whether the form is initialized when the form is automatically in the main Visual foxpro window center False (. F.)
BackColor property Decided to form the color of the window 255,255,255
BorderStyle property Form a decision whether there is any frame, if the border is a single-frame, two-frame, frame or system. If the BorderStyle to 3 (the system), users can re-form the size of change Three
Caption property Decided to form the text of the title bar shows Forml
Closable property Control whether users can double-click the "Close" box to turn off the form True (. T.)
MaxButton property Whether the form control to maximize button True (. T.)
MinButton property Control whether a form button to minimize True (. T.)
Movable property Control form can move to the new location of the screen True (. T.)
WindowState property Is the smallest form of control, or to maximize the normal state 0 normal
WindowType property Non-form form control mode (default) mode or form. If the form is a model form, the user access to applications in the user interface in any other unit must be closed before the form 0 non-model
Activate event Occurred when the activation form
Click event In control when the left mouse button click
DblClick events In control when double-click the left mouse button
Destroy event As examples of the release of an object when
Init event Form in the creation of the object when
Error events When a method (process) error when running
KeyPress event When a key press and release when
Load event Form in the creation of the object before
Unload Event When the release occurred when the target
RightClick events After you click the right mouse button when
AddObject method Run-time, add the object in the container object
Move Method Moving an object
Refresh method Redraw the form or control, and set all values
Release Method Release form from memory
Show method Showing a form

7.2 Create the form

Wizard can be used form, the form designer, form generator, four ways to create a form programming.

1. To use the wizard to create form

(1) the creation of leaflets table form:

Open the File menu → New → form → Wizard [or from the toolbar to choose commonly used form (F)] → Select → Select the form wizard to choose the style field → choice → Records → Sort → choose to save the way the document is given appropriate name and save location.

(2) create more than one related table form:

Open the File menu → New → form → Wizard [or from the toolbar to choose commonly used form (F)] → choose one-to-many form wizard to select the parent table fields → → → select the sub-form field options selected relations → Select sort records style → → → choice given the right way to preserve the file name and save location.

Note: use the form wizard to create a set of general standards to contain a command button.

Save the form after the system will produce two documents:

Form file: extension. SCX

Forms Note: the extension. SCT

2. Use of a form generator to create form

New File menu → file → new → form → form → menu → choose quick order form and style and to identify fields of.

Note: use the form generator to create some order can not be directly button.

3. The use of design to create a form

New File menu → file → new → form → form designer, the design with form and form control toolbar button to create the necessary preservation → form → form given file name and save location.

Note: The use of design to create the form, the user must set the control properties and event handling code.

4. The use of programming methods to create form

In accordance with object-oriented design approach, the first use of visualization to create a form type, and then type the code copied to the window, set the appropriate environment to add some code to process form documents.

5. Running form

Toolbar from the commonly used click Run button (!) Or from the form menu, select run form the command or input from a command window: DO FORM form file name.

Add 7.3 to the Form Controls

1. The role of common controls

Tags: do not want the user to save the changes to the text, commonly used to add standard controls to write.

Text box: enter or edit the table for non-Notes-type field, the box is generally a one-way text.

Edit box: used to enter or edit field or Remarks fields long, the box can have more lines and a vertical scroll bar.

List box: used to display a set of predetermined for the user to choose the value of one or more may be out, scroll bar to browse through a list of information.

Combo box: A drop-down list box, you can manually select one or enter a value, both the list box and text box features

Check box: used to display a number of options, you can choose one or more.

Form: A form displayed by the browser window of data containers, commonly used to display more than one sub-table relations.

Frame: A tabbed dialog box used to create the type of container, a frame can contain multiple pages, but there can be only one event per page.

Fine-tuning control: for acceptance within the scope of a given data input.

Command button: used to start an event.

Command button group: used to command button into related groups.

Option button group: used to display a number of options, choose to allow only one.

Timer: Yes, within the specified time interval or set to run in accordance with the process, this control is not visible at runtime.

2. Using generators to add controls to the form:

Open the form designer to enter the form → form controls from the toolbar button to choose → lock generator from the toolbar and select the desired control on form → in the Generator tab of the filling on relevant information.

3. The use of data to create environmental controls in the form:

Environment from the data directly to the required field or table until the form is being designed, vfp will be automatically generated to meet the requirements of the control.

To create a Drag the following items to the form
Form Table
Check box Logic-based field
Edit box Remarks Field
OLE bound control General-purpose field
Text box Other types of field

4. Create custom controls

→ Open the form designer as needed from a toolbar control → click with the mouse to draw directly in the form → form controls in the Properties window set the control of the property.

5. The use of browser add control to form

Designer in the form to open form → in the category browser to open a document library, which should be added to the form contains objects from the category → category list, select the class name, and then drag and drop the icon category to form. Category icon at the top of the list category.

Note: if the category is added to form a container object, then drag and drop the icon to the form type in a region, and then cut and paste the object into the container to be.

6. Controls commonly used properties, events and methods

Properties Description
AutoSize property Specify whether the control automatically adjusted based on the size of its contents
ButtonCount property Command group or the specified option button group number
Caption property Specified in the object shown in the text of the title
ControlCount property Designated containers the number of control subjects
ControlSource property Specify the data source object to bind
Enabled property Targeted users can respond to events triggered by
Filter Properties The record does not meet the conditions rule out the possibility. Screening of conditions specified by the given expression
Increment property Click on the arrow or down arrow, the fine-tuning control values increase or decrease the amount of
InputMask property Specified control of input data format and display
MoverBars property Specify whether the list box control to display the mobile button
Name property Specified object reference in the code name used when
Parent property Use a container control object
ReadOnly property Specifies whether the control can edit or update the temporary table with the associated object table or view
RecordSourceType property Specify how to fill the form to open the data source controls
RowSource property Specified combo box or list box control the source of value
ToolTipText property Designated as a control as a "tool tip" text appears
Attribute Value The current state of the specified control
Click event In the controls when the left mouse button click Fangsheng
DblCick events In the controls when the left mouse button double-click Fangsheng
Destroy event As examples of the release of an object when
Init event Occurred in the creation of objects
InteractiveChange events When the change occurs when the value of control
Load event In the creation of the object before
RightClick events Right-click when in
Addobject method Run-time to add the object in the container object
Clear method Clear combo box or list box controls the content of
Refresh method Redraw the form or control, and set all values
KeyPress event When a key press and release when

7.4 modify the form layout

Open the form, enter the form designer, form designer by or display the toolbar menu to amend the order form.

1. Choice for mobile and zoom controls

Options: use the mouse to click the desired control

Mobile: selected controls with the mouse and drag it to a new location or from the Edit menu, select the location of shear and then paste in the new

Zoom: selected controls with the mouse drag the handle until the required size of the size of release

2. Copy and delete form controls

Copy: the selected form of control available from the Edit menu → choose → Copy from the Edit menu, select Paste.

Delete: select the form in accordance with the existing control → Delete key.

3. Control the layout of

The layout of the toolbar can be used to make all forms neatly arranged controls, a reasonable size, symmetrical appearance.

7.5 Custom Forms

1. To change the text font and size

Open the form, enter the form designer to select modified → → Controls → Open the Properties window set the font size and shape, such as the FontName, FontSize, FontBold.

2. Add to the form lines and shapes

Select the toolbar button on the line or shape, the desired location in the form drag the mouse, draw lines or graphics, graphics sector in the square and round, rectangular and oval-shaped between the (attributes window Curvature values from 0 ~ 99). Color and shape of lines can be set in the Properties window.

3. Add graphics to the form

From the form controls toolbar select Image → In the Properties window, select Picture Properties ... click on the column button in the Open dialog box → find the image files to identify →

4. The prospect to set up a form and background color

Toolbar with palette or through the properties window to set properties ColorSource.

5. To create a form set

→ Form Designer to start from the form menu, select Create Form Set → → Design of the first form from the form menu, select Add a new design of another form → form → form → add a new design of another Zhang form ... ...

7.6 Design of custom forms general approach

1. Binding type and data sheet form

(1) to generate the basic form:

→ New → form → new documents into the form designer menu → form → form → fast selected database (table) → select the output style selected field → → identified.

(2) modify the basic form:

1) Drag the mouse to adjust the layout of the field (with the location, size, alignment, etc.);

2) In the Properties window to set the form attribute of the object:

Form (form1):

caption: the importation of the Chinese title of the form

backcolor: Set form background color

autocenter: enable automatic run-time form in the center of the screen

visible: Set whether the form can be seen in the run-time, generally. T.

Control of the field:

autosize: According to automatically adjust to accommodate the size of the content is often used. T.

backstyle: the title field is generally set to transparent, the other can be set to opaque

caption: Chinese input field title

fontname: Font settings control

fontsize: set font size

forecolor: Set font color

(3) The need to add the control:

1) using data environment:

Open the basic form → → click the right mouse button from the shortcut menu, select Data Environment → until the required form fields → label control to add the title field (first draw label control to change the label caption property ).

2) the use of a form control toolbar:

Click to open the basic form → → Toolbar required to control draw controls in the form selected control → → → Right-click the shortcut menu, select from the generator ... → In the dialog box select the required → identified.

4. Add a command button

Add an appropriate number of command button (the button with a single command or command group can be), set up a command group to make use of the command group generator (Right-click and choose generators). Command button to change the title, when required hotkey after the title (/ <A) can be. Such as: Caption for: exit (/ <X), showed the exit button (X)

5. For the preparation of the incident command button code

Command button under the heading of the function represented by the code window, fill in the code. Button code a few commonly used in the following table.

A If.not.bof ()

Skip -1

Endif

Thisform.refresh

Next If.not.eof ()

Skip

Endif

Thisform.refresh

The first Go top

Thisform.refresh

The last Go bottom

Thisform.refresh

From the Thisform.release

2. Type has nothing to do with the data table form

→ New → form → new documents into the form designer to add controls → Properties → Settings → write code.


FoxPro Tutorial Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.