Menu
Is free
registration
the main  /  Internet/ Visual foxpro programming lessons. How to close the viewport

Visual foxpro programming lessons. How to close the viewport

It is an application that is an object-oriented and visually programmable language. Visual FoxPro fully complies with the new requirements for modern design and development tools software... Users of any skill level can use the Visual FoxPro language, and if you just start learning, you can use the wizards for creating databases, applications, tables, forms and reports.

In addition, this language will help you to quickly create and more complex programs or applications using constructors and an object-oriented language, using not only the base Visual FoxPro classes, but also external libraries. This collection will be useful both for a simple acquaintance with the capabilities of Visual FoxPro 8.0, and for completing a complete training course for working with the system. In addition, it contains many useful topics and more experienced users... For the convenience of studying the material, this application is made with illustrations in the form of help, which allows for easy navigation and find the necessary sections with descriptions.

Features Tutorial for Visual FoxPro:

  • the opportunity to get acquainted with the capabilities of Visual FoxPro 8.0 or complete a complete training course for working with the system.

Advantages:

  • the ability to view high-quality submitted material, made with illustrations in the form of help, which allows for easy navigation and find the necessary sections with a description.

See also programs:




Official source
For OS Windows XP, 98, ME, 2000, 2003
Distribution size 4.54 Mb
Interface language Russian
Program Free of charge
Updated 2012/07/27
Latest version 8

Quick start is short description fundamental principles of working in a programming environment FoxPro for Windows version 2.5, was created so that you can get acquainted with the capabilities and organization of the system with the least amount of time. This guide is not full description and contains only the basic principles and points of working with databases. This description designed for beginners - users who first encountered FoxPro and do not know which side to approach it. Here you will find a description of the basic rules for viewing, creating and editing DBF databases, get basic skills in the programming environment FoxPro 2.5 for Windows

Note that when using FoxPro all the necessary information is always "at hand". FoxPro provides context sensitive help so that you can always get information about any system window, dialog, or menu command as you use it. For help, just press the F1 key.

Now, let's start with the simplest.

Chapter 1. Opening and viewing a table (DBF file).

This chapter describes how you can view an already created database.

A table is a file that contains ordered information. These files are sometimes referred to as .DBF files because they have the .DBF extension.

FoxPro contains a very powerful tool for viewing and editing table information. To get acquainted with these possibilities, we will use the already created table: CUSTOMER.DBF, which contains information about customers.

How to open and view a table

Place the cursor in the command window by clicking in it. Type set default to c: \ foxpro \ tutorial and press ENTER.

From the File menu, choose the Open command. The "Open" dialog will appear. Make the TUTORIAL directory active. From the Type list, select Table / DBF. And, having selected the CUSTOMER.DBF file, click the "Open" button.

Figure 1.1 Opening a table

This table is now active and to view it in the "Base" menu, select the "View" command. A preview window will appear. The information in the viewport is presented in rows and columns. Columns are called fields, rows are records. The viewport is usually not large enough to allow you to see the entire table at once. In order to see the different parts of the table, you need to scroll the viewport horizontally and vertically.

In the viewport, you can control the display of data on the screen, for example, you can change the width of individual fields.

How to change the width of the field

Move the cursor between the COMPANY field heading and the CONTACT field heading. This line is called the header separator. When you hit the title separator, the mouse pointer changes its appearance. And now, by clicking the mouse, set the required field size.

How to move a field

Point with the mouse to the heading of the CNO field. And by clicking the mouse button, move the title until it is between COMPANY and CONTACT.

Figure 1.2 Moving a title in a table

You can see all the fields at the same time by switching to the record view. In this mode, the fields of each record are arranged one below the other.

How to view data in record view mode

From the View menu, choose By Records. The view mode will change.

Fig. 1.3 View by records

Another way to view the data is to split the viewport into two sections using the split marker — the black rectangle in the lower-left corner of the viewport.

How to split the viewport

Place the mouse over the split marker. The mouse pointer changes. Move the window break marker behind the CONTACT field.

Splitting the viewport allows you to:

    scroll through fields in one section without moving fields in another;

    work with one section in the view by records mode, and with another in the tabular view mode.

How to select a section and change its mode

Select the right section by hovering over it and clicking. From the View menu, choose By Records.

Figure 1.4 Selecting a Partition

Since the sections are linked, scrolling will highlight the same entry for both sections. You can unlink sections and scroll through the entries in one section while leaving the entries in the other section unchanged.

Unlinking sections

From the View menu, choose Link Sections. The marker next to the Link Sections command disappears. Scroll through a few entries.

How to close the viewport

The window is closed as standard for WINDOWS systems, double-click the viewport control menu button, or press CTRL + F4.

Working with the Memo window

Now let's open another table containing information about sellers who participated in some commercial transactions, this is the file: SALESMAN.DBF

This table defines a NOTES field between the ONO and NAME fields and contains the words Memo or memo. This field is of a special type; it can contain an unlimited amount of any information. Since the amount of information can be very large, it is difficult to display it in a small area. To view and edit this information, use the memo-field editing window.

By looking at a memo field, you can immediately tell from the first letter of the word memo whether the field contains information or not. An uppercase "M" indicates that the memo field contains information, and a lowercase "m" indicates that the field is empty.

How to view memo field data

Open the memo field edit window. To do this, double-click on the word Memo.

Figure 1.5 Viewing Memo Field Data

In the window for editing a memo-field, you can not only view it, but also edit it. To close the memo field viewer, double-click the viewer control menu button.

Chapter 2. Data management.

In the previous chapter, you learned how to view information in a table. But what if it turns out that you need to view information of a given type? For example, you might want to know everything about customers who spent over $ 5,000 or just the name and number of each customer. FoxPro allows you to quickly retrieve and view information that meets specified conditions. The process of retrieving this information is called a "request".

How to open a query window

From the File menu select the Open command and in the FOXPROW \ TUTORIAL \ directory select the CUSTOMER.DBF file and click the Open button. Then, from the "File" menu, select the "New" command. In the "Create File" dialog, set the "Request" option, and then click the "Create" button. A request window will appear.

Rice. 2.1. How to open a query window

The query window specifies the information to be retrieved from the tables. The extracted information is placed in the viewport. You can work with this window as it was done in the previous chapter.

The Result Fields list in the query window specifies which fields you want to display in the browser. By default, all fields are displayed in a newly opened table.

The Selection Criteria area specifies which records you want to retrieve from the table. If the area is empty, the query retrieves all records from the table.

Let's say you don't need to view the CNO, ADDRESS, ZIP and ONO fields. Then we need to specify only those fields that are needed.

How to set fields for the query result

In the query window, select the Fields check box. The Select Query Fields dialog will appear.

Rice. 2.2 Setting the fields for the request

Click the Delete All button to clear the Selected Fields list. And put COMPANY, CNO, CONTACT, PHONE, CITY, STATE and YTDPURCH in the "Selected fields" list, for this select the required field in the "Table Fields" list and click the "Add" button. Each of the above fields will appear on the screen with the CUSTOMER prefix, which means that the field belongs to the CUSTOMER table. When finished, click the "Ok" button. The selected fields will appear in the Result Fields list in the query window. When you run a query, the fields in the viewport appear in the order specified in the query window.

How to fulfill a request

In the request window, click the "Run" button. And you will have a browser with the selected fields.

Rice. 2.3 Executing a request

If in the process of working with the viewing window it turns out that there is no longer a need for the CONTACT field, then simply remove it from the request.

How to remove a result field from a query

Close the browser displaying the query result. Check the "Fields" box. Remove the CONTACT field from the Selected Fields list by highlighting it in the list and clicking the Delete button. Click the "Ok" button. Note that the CONTACT field is no longer listed in the Result Fields list. And execute the request.

Now that the result fields are selected, you can set the order in which the data will be presented. For example, you can display data by city in alphabetical order.

How to arrange fields in a request

Close the browser with the displayed query result. In the query window, select the Order check box. In the "Order of query fields" dialog, place CUSTOMER.SITY in the "Order criterion" list. To do this, select it and click the "Add" button. And check the "Ascending" box.

Rice. 2.4 How to arrange fields in a request

To return to the request window, click the "OK" button. Notice that 1 and an up arrow appear next to CITY in the Result Fields list. The number 1 means that CITY has the first priority when ordering the data, and an up arrow means that the data is displayed in ascending order.

Click the Run button. The data can be ordered in any way. For example, you can sort data by state and by city within a state.

How to order by multiple fields

Close the viewport. Check the "Order" box. Place CUSTOMER.STATE in the Order Criterion list. Set the order of the fields, for this move the button to the left of STATE with the mouse so that the STATE field is above the CITY field. Click the "Ok" button. Now STATE is preceded by the number 1, and before CITY - 2, which means the priority for data ordering. And click the "Run" button.

So far, all records have been looked up in the CUSTOMER table. But suppose you want to view only those companies that are located in Ohio. Using the Criteria area of ​​the query window, you can execute such a query almost immediately.

Setting selection conditions

To retrieve only the specified records, you must specify the selection conditions. Each selection condition consists of a table field, a comparison option, and a value to be compared with the field's contents.

How to set the selection conditions.

Close the viewport. In the query window, click the box below Field Name to display the Field Name list. Highlight CUSTOMER.STATE

Rice. 2.5 How to set selection conditions

In the list of comparison options, the default is "like". Type OH (Ohio) in the text box below Sample. This creates a selection condition to view records only for Ohio companies. In the same way, you can set several selection conditions. The introduced selection condition requires that the STATE field be similar to OH. STATE is a field, "like" is a comparison option, and OH is the value to compare the contents of the field to. The "like" comparison indicates that the STATE field must be OH in order for the record to satisfy the request. The result of executing the query is shown in

Rice. 2.6 Result of query execution

Other options for selection conditions

Let's try to withdraw companies located in Ohio or Michigan. Close the viewport. Click on the comparison options entry field and select the value "from the list". In the Sample field, type MI (Michigan) after OH. Don't forget to include a comma.

Rice. 2.7 Comparison option: "in the list"

Click the Run button. A browser will appear showing all companies located in Ohio and Michigan, because "listed" means that STATE must contain one of the items specified in the Sample text box to be included in the result.

Other selection conditions: equal, more, less, within; work in the same way. For more detailed information, refer to the reference: "User's Guide. FoxPro. Relational Database Management System for Windows".

Chapter 3. Working with the table.

This chapter describes how to create your own user table and how to add, delete, and modify entries in it.

Creation of the table structure.

First, decide what information should be put into the table.

      Surname, name, patronymic of the employee;

Date of Birth;

    Profession;

    Wage;

    A comment;

Each of the listed values ​​will be stored in the corresponding field of the table.
How to create a table structure

From the File menu, choose New. The "Create File" dialog will appear. Select the "Table / DBF" option and then click the "New" button. The "Table Structure" dialog will appear

Rice. 3.1 Creating a table structure

The cursor is in the Name text box. Now you can add the name, type and width of each field.

How to describe table fields

Type "name" in the "Name" text box. Press Tab or click in the Type list. Set the type to "Character". Press the Tab key or click on the "Width" field, then type 25 or use the arrows to increase the width to 25. Next, describe the rest of the fields. The result is shown in

Rice. 3.2 Description of table fields

The Des field indicates the number of decimal places in the numeric field. Since the "salary" field stores the value of the monetary amount, you must specify the number 2.

After entering all the values, press the "Ok" button. The "Save As" dialog will appear. Enter the name of the table: TEST, if necessary, specify in which directory it should be written and click the "Save" button. FoxPro then asks, "Do you want to enter data records now?" Click the "Yes" button.

Entering data into a table

A view window will appear in edit mode by records. Add the following data to the table:

    Ivanov Sergey Nikolaevich

    accountant

Press CTRL + PGDN or double-click the memo field to enter information in the memo field. A memo window appears in which you can enter your comments.

Rice. 3.3 Entering Comments in the Memo Window

Close the memo window. Note that the letter "M" in the word Memo is uppercase, which means that the data in the field has already been entered. Add a few more employees and close the viewport.

Now, suppose you have purchased a scanner and want to add photographs of your employees to the table.

How to change the structure of a table

From the Base menu, select the Customize command. In the upper left corner of the "Database settings" dialog, click the "Modify" button. The "Table structure" dialog will appear. Move the cursor to the "comment" field and click the "Insert" button. New_field appears above the comment field. Replace "new_field" with "photo". In the "Type" list, select "General", and then click the "Ok" button. When prompted by FoxPro if you want to save your changes, click Yes. In the "Database settings" dialog press the "Ok" button.

Entering graphic data into the table

First of all, you need to add a photo of the employee to the clipboard.

From the Record menu, choose the Edit command. The mode of modification by records is set in the viewing window. Double click on the "photo" field. A window for editing a field of the General type will appear. From the Edit menu, choose Paste. The picture contained in the clipboard will appear in the window.

Rice. 3.4 Writing an image to a table

How to add new entries

From the Record menu, choose the Add command. A browse window will appear in the add mode, where you can add new employees.

How to delete an entry

In the table view mode, mark the fields for deletion. To do this, to the left of the field, click the delete marker.

Rice. 3.5 Deleting an entry

How to package a table

From the Base menu, choose the Pack command. A message appears asking if you want to package the table. Click the "Yes" button. Now choose View from the Base menu and make sure that all selected entries have been deleted.

Chapter 4. Generating reports

This chapter describes how to use the Query Box to quickly generate reports from your data.

Chapter 2 talked about displaying information in a viewport using a query. Another way of presenting information is a report.

A query is required to generate a report. We'll use the query created in chapter two.

How to open a request

From the File menu, choose the Open command. In the "Open" dialog that appears, select the TUTORIAL directory. In the Type list, select Request. Select the file you want (GSCHAP5.QPR) and click Open.

As the first report, let's make a list phone numbers all customers from California.

Generate a telephone list report as shown in Figure 4.1.

Rice. 4.1 Generating a Phone List Report

Include the following fields: COMPANY, PHONE, CONTACT, CITY, and STATE. Selection criterion: STATE is similar to CA. And most importantly, in the "Output" list, select the "Report / Label" value. Click the Run button.

The report starts scrolling on the screen.

After viewing the report, press ESC.

The above report contains the correct information, but its clarity can be improved.

How to create a report form

Check the "Options" box. In the "Query input parameters" dialog, select the "Report" option, check the "Standard report" checkbox, and in the "Standard query report" dialog in the "Save as" field, type the name gschap6.frx.

Rice. 4.3 Formation of the report form

Click the "Ok" button and the "Run" button.

The complete image of the entire page of the report can be seen in the "Page View" window, as shown in Figure 4.4.

Rice. 4.4 Image of the report page

The image of the report page gives an idea of ​​how the report will look on paper.

In the "Page View" window, you can enlarge the image (the Zoom in button), you can zoom out (the Zoom out button), view the next or previous page (the Forward / Back buttons). Click "OK" to exit.

Now let's look at the created report form and make some improvements to it in the report layout window.

How to open a report form

From the File menu, choose the Open command. In the "Type" list, select the "Report" value, and open the file: GSCHAP6.FRX.

In the report markup window, the GSCHAP6 report form will appear, shown in Figure 4.5.

Rice. 4.5 Report Form

The report form is divided into three bands:

    The Header strip contains information that appears at the top of each page in the report.

    The Details bar is printed once for each entry that meets the selection criteria.

    The Footer bar contains information that is displayed at the bottom of each page in the report.

Using the set of icons on the left side of the markup window, you can make the necessary changes to the report. For example, Figure 4.6 shows the layout of the report with the changes made.

Rice. 4.6 Making changes to the report

How to fulfill a request

Minimize the report window. Click the Run button. Please note that the report contains the changes made.


Rice. 4.7 Final report

And you can print this report on a printer.

Conclusion

We examined the basic possibilities of working with databases in the FoxPro environment, this is not limited to its capabilities, but for further work you need to have at least basic knowledge of the FoxPro programming language. If you decide to continue your acquaintance with the possibilities of using FoxPro, or if you have any difficulties, it is advisable to use the reference "Microsoft FoxPro for Windows", which you will receive along with the FoxPro software package.

Let's briefly consider other main features of working with databases:

Screen creation.

The FoxPro system is used to view data in a variety of ways. You can view the data table in the viewport, you can view the fields of each record, and using "screen creation" you can create your own method for viewing / modifying data by placing data in the desired places on the screen or pages. FoxPro's capabilities in this regard are simply unique.

Menu creation.

In a matter of minutes, you can create your own menu system, with all the necessary commands to work with your databases, and not use standard system FoxPro menu.

Project creation.

All elements: screens, reports, queries, menus ... can be combined into a single unit called a project.

The project is used to manage elements in the process of creating an application. Having created a project and specifying the files that should be included in it, you can use this project to build an application (.APP) or an executable file (if you have a FoxPro Distribution Kit)

Ok. In the dialog comment src = h4 style = m. Click the button

You are getting started with Visual FoxPro 8.0. Many of the things you will have to work with (menus, toolbars, dialog boxes) will seem familiar because they are specific to the Windows environment. | To run the program from the main windows menu follow these steps:

  • Visual FoxPro Main Window

    In fig. 2.2 shows the main window of Visual FoxPro, as it looks after the launch of the program. | It has seven main objects: the window title, menu bar, toolbar, status bar, work area, Command window, and the Task Pane Manager dialog box.

  • System menu and system buttons

    The title of the main window contains a small copy of the program icon, the text "Microsoft Visual FoxPro" and buttons to control the size of the main window. When you click on the icon of the icon, a system menu opens, containing commands for moving and resizing the main window. Table

  • Introduction to the Standard Visual FoxPro Toolbar

    Visual FoxPro has a large number of toolbars used to create forms, reports, and queries. We will consider them in detail in the corresponding chapters. Now you will get acquainted with the standard toolbar (Fig. 2.3), which is used in all modes of operation. | Rice. 2.3.

  • A quick tour of the Visual FoxPro menus

    When working with Visual FoxPro, you can use both the toolbar buttons and the menu bar, all of which are hierarchical commands. When you select a specific command, its submenu opens.

  • Exiting Visual FoxPro

    To exit Visual FoxPro, you need to Close it. To do this, use one of the following methods: | select the Exit command from the File menu; | select Close in system menu main window of Visual FoxPro;

  • Taskbar manager

    Visual FoxPro 8.0 includes a task manager to help you develop your application. The links in its window allow you to launch the New Application and Database Wizard, open the Help system, open the recently opened application or database, and much more.

  • Visual FoxPro Help

    When developing applications in Visual FoxPro, as in any other system, it is often necessary to review the capabilities of programming tools, individual commands and functions. In Visual FoxPro, in addition to the traditional help system, you can find the information we are interested in in the built-in documentation, numerous examples, and on the Web pages.

  • Help window

    In fig. Figure 2.11 shows the Visual FoxPro help window that opens when you select the Microsoft Visual FoxPro Help command from the Help menu. | This window is divided into two areas.

  • Using the Contents Tab

    The first tab in the Help window is the Contents tab (see Figure 2.11). This tab takes the most traditional approach to getting help information. | The first time you open the Contents tab, you see a list of Help topics.

  • Finding Help by Subject Index

    To search for help on a subject index, open the Index tab (Fig. 2.13) of the help system window. At the top of the tab there is a field for entering a keyword by which the search will be carried out.

  • Using the Search tab

    To search by keywords and phrases use the Search tab. In the Search for next words input box, enter the word or phrase you want to search for. If you want to find a phrase, you must enclose it in single or double quotes.

  • Favorites tab

    The Favorites tab (Fig. 2.16) allows you to create a list of the most frequently used topics in the help system, the selection of which should be done quite simply. | By default, this tab is empty. To add a help topic to the Favorites tab, you need to do the following:

  • Viewing online help information

    The Visual FoxPro Help System contains a wealth of information needed to develop applications. To receive latest news About Visual FoxPro, you can open the corresponding Web page directly from the main Visual FoxPro window.

  • Lyudmila Omelchenko Daria Shevyakova SELF-TEACHER St. Petersburg "BHV-Petersburg" 2005 UDC 681.3.068 + 800.92 Visual FoxPro 9 LBC 32.973.26-018.1 O-57 Omelchenko L. N., Shevyakova D. A. O-57 Self-instruction manual Visual FoxPro 9.0 ... - SPb .: BHV-Petersburg, 2005 .-- 608 p .: ill. ISBN 5-94157-632-3 Considered Visual FoxPro 9.0 - a powerful software package designed to build professional database applications. An integrated application development environment and the creation of basic objects such as classes, tables, queries, forms, reports with its help are described. Export and import of data, as well as publication of data on a Web server are considered. Shows how to design, build, and test client-server applications. Attention is paid to the features of the next version of the popular package, as well as additional capabilities for working with XML Web services and interaction with other applications (Microsoft Visual Studio .NET and Microsoft SQL Server 2000). Numerous examples and illustrations will help you quickly master and successfully apply the presented material in practice. For programmers and database developers UDC 681.3.068 + 800.92 Visual FoxPro 9 LBC 32.973.26-018.1 Group of preparation of the publication: Editor-in-chief Deputy. ch. editor Head. editorial office Editor DTP Proofreader Cover design Head. production Ekaterina Kondukova Igor Shishigin Grigory Dobin Natalia Dovgulevich Natalia Karavaeva Victoria Piotrovskaya Igor Tsyrulnikova Nikolay Tverskikh License ID No. 02429 dated 24.07.00. Signed for printing on 18.03.05. Format 70 1001/16. Offset printing. CONV. print l. 49. Circulation 5000 copies. Order No. "BHV-Petersburg", 194354, St. Petersburg, st. Yesenin, 5B. Sanitary and Epidemiological Conclusion for Products No. 77.99.02.953.D.006421.11.04 dated 11.11.2004 issued by the Federal Service for Supervision of Consumer Rights Protection and Human Welfare. Printed from finished transparencies in the State Unitary Enterprise "Printing House" Nauka "199034, St. Petersburg, 9 line, 12 ISBN 5-94157-632-3 © Omelchenko L. N., Shevyakova D. A., 2005 © Design, publishing house" BHV- Petersburg ", 2005 CONTENTS INTRODUCTION ............................................ .................................................. ............. 1 How to use this book ................................. .................................................. ................. 2 How the book is structured ............................. .................................................. ............................ 2 Special elements of the book .................. .................................................. ........................ 3 CHAPTER 1. GETTING TO KNOW VISUAL FOXPRO .................. .................................... 5 Modern relational DBMS .......... .................................................. ......................... 7 Visual FoxPro Objects ..................... ..................................... ............................................. 10 What's New in Visual FoxPro 9.0 ............................................... ........................ 12 CHAPTER 2. GETTING STARTED WITH VISUAL FOXPRO ................. .............................. 15 Starting Visual FoxPro ................ .................................................. ........................................ 15 Main Window of Visual FoxPro ..... .................................................. ....................................... 15 Taskbar Manager ....... ..................... .................................................. ...................... 27 Visual FoxPro Help System ....................... .................................................. .......... 30 CHAPTER 3. THE PROJECT AS A MEANS OF COMBINING THE ELEMENTS OF THE APPLICATION .............................. ............................. 39 Creating an application project ................. .................................................. ...................... 39 Menu-driven project management ...................... .................................................. .45 Project element management ............................................. ......................................... 46 Using the wizard to create a project ... .................................................. ......... 47 CHAPTER 4. CREATION OF THE PROJECT DATABASE ................................. ............ 57 Creating a database in the project window ............................... ............................................. 57 Creating a database outside the project ................................................ ................................. 61 Tables - the basis of the database ........... .................................................. ......................... 62 Table design window ..................... .................................................. ......................... 68 Indices ....................... .................................................. .................................................. ... 78 Relationships between tables ........................................... ................................................ 82 Integrity data ................................................. .................................................. ....... 85 IV Contents CHAPTER 5. FORM AS A MEANS OF ENTRYING AND EDITING DATA .............................. .......................... 89 Creating a Form Using the Wizard .................. .................................................. ......... 90 Starting the form ..................... .................................................. .............................................. 97 Form Objects. .................................................. .................................................. ............. 97 Actions performed with form objects .............................. ................................. 101 Changing the sequence of entering information in the form fields ......... ................. 105 CHAPTER 6. FORM DESIGNER ................... .................................................. 109 Form designer window .............................................. .................................................. 109 Creating a Shape ............................................... .................................................. ............. 113 Setting shape parameters ................................. .................................................. ..... 114 Form Environment ......................................... .................................................. ...... 116 Procedure for setting shape parameters ............................. 122 Placing objects in the shape ... .................................................. .................................. 123 CHAPTER 7. CREATING AND PRINTING REPORTS ........ ............................................. 157 What is a report. .................................................. .................................................. ............ 157 Recommendations for Report creation ................................................ ................................ 157 Reporting tools .............. .................................................. .............................. 158 Using the wizard to create a single-table report ............. ...................... 158 Viewing the prepared report ........................ .................................................. ....... 168 Print report ........................................ .................................................. .......................... 169 CHAPTER 8. CREATING A REPORT USING THE REPORT DESIGNER .............. ................................................. 173 Report designer window ............................................... ............................................. 173 Using the Quick Report Command for placing fields .................................... 175 Setting the environment of the report environment ... .................................................. .. ..................... 179 Properties of report objects ......................... .................................................. ..................... 182 Placing objects in the report ........................ .................................................. ............. 188 Adding Header and Totals Areas to the Report ............................. ............................ 200 Creating a simple report .................. .................................................. ........................... 201 Creating a free-form report ................. .................................................. .......... 203 Creating a tabular report .................................... .................................................. ..... 205 Grouping data in the report ........................................ ................................................. 207 Using variables in the report .............................................. ............................... 211 Report Page Layout ............... .................................................. .............................. 213 Multi-column report ................. .................................................. .............................. 215 CHAPTER 9. REQUESTS TO THE DATABASE ............ ................................................. 217 Query Builder ................................................ .................................................. ... 218 Formation of the list of fields p of the resulting query table ............................... 221 Order By tab of the query designer .......... .................................................. .......... 225 Setting conditions for selecting records .................................. .......................................... 227 Multi-table queries ..... .................................................. ........................................ 233 Grouping of query fields ...... .................................................. .................................... 237 Changing the names of fields in the request ........ .................................................. ........ 241 Chapter V CHAPTER 10. CROSS TABLES AND DIAGRAMS .............................. 243 Cross tables ................................................. .................................................. . 243 Data export .............................................. .................................................. ............... 254 Construction diagrams ................................................. .................................................. ... 254 CHAPTER 11. APPLICATIONS MENU ......................................... ......................... 261 Preparing to create a menu .................... .................................................. .................. 261 Actions required to create a menu ......................... ....................................... 262 Launching the menu builder ....... .. .................................................. .................................. 262 Menu creation ............. .................................................. .................................................. 264 Saving, generating and launching menus ........................................... .............................. 278 Creating a Popup Menu ................ .................................................. .................... 279 CHAPTER 12. CREATING THE APP HELP SYSTEM ............... 281 Status bar ... .................................................. .................................................. ..... 281 Usage dialog boxes.................................................. ................................. 282 Creating an HTML Help System .......... .............................................. 285 Using the Help System in applications ................................................ .. 293 CHAPTER 13. MANAGING THE PROJECT AND CREATING THE APPLICATION .......... 297 Defining the properties of the project window ........................ .................................................. ..... 297 Setting project parameters ......................................... .................................................. 299 Setting the main program of the project ............................................. ......................... 302 Using the Exclude Option ..................... .................................................. ................. 303 Cleaning the project from deleted files .................................................. ....................... 303 Building the project ........................ .................................................. ............................... 303 Visual FoxPro Component Gallery .............. .................................................. ............... 306 CHAPTER 14. VALIDITY CONDITIONS, STORED PROCEDURES, TRIGGERS, SUBMISSION OF DATA ..................... ................. 315 Conditions for the validity of data entry at the record level ......................... .................. 315 Conditions for the validity of data entry at the table field level ....................... ......... 323 Using Data Views ..................................... .................................... 325 CHAPTER 15. ADVANCED DATA ENTRY FACILITIES ...... ........................ 337 Displaying data in a tabular form .................. ....................................... 337 Creating a Tabbed Form ...... ............................... .................................................. . 356 Form set .............................................. .................................................. ...................... 360 Timer .......................... .................................................. .................................................. . 361 Adding data to the list ............................................ ............................................. 364 CHAPTER 16. LIBRARIES CLASSES AND ACTIVEX COMPONENTS ................. 367 Using Class Libraries ........................ .................................................. ...... 367 Using ActiveX-components in the form ..................................... ........................ 374 Using the Object Browser ...................... .................................................. ......... 390 CHAPTER 17. ADVANCED REPORTING TOOLS ..................... 395 Using Data Views in Reports ......... ..................... .............................. 395 Labels .................. .................................................. .................................................. ..... 396 Using one-to-many relationships in reports ................................. ........... 404 VI Table of Contents CHAPTER 18. ADVANCED FACTORS OF DATA ... 409 Output of query results .. .................................................. ..................................... ..... 409 Saving query results in HTML format ...................................... ............... 412 Using the Select command in programs ............................. .................................. 414 CHAPTER 19. VISUAL OBJECT-ORIENTED PROGRAMMING ....... .................................................. ......... 419 Using Classes ...................................... .................................................. ........... 419 Using nested objects ................................... .......................................... 434 Custom Classes ... .................................................. ......................................... 437 Viewing class information and defining an icon for its designations .......... 447 Formation of the list of libraries used in constructors of forms and classes ........................... .................................................. ....... 450 Create User-Based Forms lski classes ................................................ .. 450 Using a Form to Create a Class .......................................... ....................... 454 Class Browser ....................... .................................................. ............................ 455 Creating a toolbar .................. .................................................. ................. 458 CHAPTER 20. MULTIPLAYER WORK IN THE LOCAL NETWORK ........................ ............................................... 463 Locking types .................................................. .................................................. ......... 463 Automatic blocking ...................................... .................................................. .... 463 Full table lock and change lock ... ....... 465 Locking a table ........................................ ..................................... ........................... 466 Locking recordings .................... .................................................. ................................... 466 Unlocking tables and records ......... .................................................. ................ 468 Data sessions ............................. .................................................. ............... 469 Using buffers ................................ ...................... ............................................ 470 Using transactions ... .................................................. ........................................ 474 CHAPTER 21. LINKING AND IMPLEMENTATION OF OBJECTS, EXPORT AND DATA IMPORT ............................................... ...................... 475 Visual FoxPro and OLE Objects ..................... .................................................. .................. 475 Linking an OLE Object ........................... .................................................. ................... 481 Editing an OLE object .......................... .................................................. ............. 484 Deleting an OLE Object ................................ .................................................. .................. 484 Using Object-Oriented Programming .......................... .... 484 Transferring Data from Visual FoxPro to Other Applications ..................................... ...... 486 Import Dan n ................................................. .................................................. ............. 488 Using data from Visual FoxPro in Microsoft Word ............................ ............. 491 CHAPTER 22. REMOTE DATA REPRESENTATIONS .............................. ..... 497 Defining an ODBC Data Source ........................................ ................................ 497 Named Connection ............... .................................................. .............................. 500 Connection constructor ................. .................................................. ............................. 500 Configuring Remote Views and Connections in the Options Dialog Box .......... .................................................. ................................... 503 Creating a Remote Data View .......... .................................................. ... 505 Table of Contents VII Shared Connections ... .................................................. ..................... 513 Combining local and remote data representation ..................... .... 514 Customizing a View Using a Database Dictionary ...................................... 516 CHAPTER 23. DATA TRANSFER FROM VISUAL FOXPRO TO CLIENT-SERVER PLATFORM .................................... ........... 519 Using the Growth Wizard to Transfer Data to a Database SQL data Server ................................................. ............................................... 519 CHAPTER 24 . PUBLICATION OF DATA ON THE WEB SERVER ................................. 531 Web Publishing Wizard ... .................................................. .............................................. 531 Configuring Web Settings -pages using the wizard ........................................ 535 Creating a Web page .................................................. ............................................... 539 Editing the created Web pages ............................................... .................... 543 CHAPTER 25. SETTING VISUAL FOXPRO PARAMETERS ...................... .......... 545 Options of the tabs of the Options window ................................... ................................................. 546 APPENDIX. INSTALLING VISUAL FOXPRO .............................................. 573 System requirements ............................................... .................................................. ..... 573 Installing Visual FoxPro ......................................... .................................................. ....... 573 Customizing Visual FoxPro ....................................... .................................................. ........ 575 GLOSSARY ........................................ .................................................. ........... 579 INDEX .................................... ........................................ 589 VIII CONTENTS INTRODUCTION In recent years, rumors have sprung up from time to time that Microsoft will end support software product Visual FoxPro. But again they turn out to be the intrigues of ill-wishers. And another a new version Visual FoxPro 9.0 is a direct confirmation of this. Despite the emergence of new database management systems, Visual FoxPro continues to be one of the most popular programs in this area. This is primarily due to the fact that when creating new versions, Microsoft maintains compatibility with previous versions. Therefore, the applications you create can be used in the future. Visual FoxPro implements all the attributes of relational database management systems. The database maintains data integrity using primary keys and relationships between tables. You can use triggers and stored procedures to handle events for adding, deleting, or modifying table records using the database itself. Visual FoxPro is an object-oriented, visual-programmable, event-driven language that fully meets the new requirements for modern software design and implementation tools. Visual FoxPro can be used by users different levels preparation. If you are just starting to master Visual FoxPro and you need to develop a simple application as soon as possible, the wizards for creating databases, tables, applications, forms, reports, etc. will help you. For the development of large and complex projects, appropriate designers and an object-oriented language are used , which allows you not only to use base Visual FoxPro classes and external libraries, but also to create custom classes. This book is of interest both for beginners familiar with Visual FoxPro 9.0, and for those with experience with this system of developers. The book sequentially describes the entire process of creating complete applications: creating a database and its tables, designing forms for entering and viewing data, creating queries and reports, as well as other means of displaying and processing database information. The book contains a large number of illustrations that will help you get acquainted with the material presented in it. 2 INTRODUCTION HOW TO USE A BOOK If you are just starting to learn Visual FoxPro, the chapter order suggested will allow you to go from easy to difficult to learn this software. If you are familiar with Visual FoxPro, you do not need to read the book from start to finish. In the table of contents of the book, you can see which chapters are of most interest to you, and study only them. You can learn a lot by just skimming through the book. It has specially highlighted moments that will catch your eye when you scroll through it. How to build a book The book assumes a sequential study of material from simple to complex. Chapters 1 and 2 of the book are introductory. You will learn how to start Visual FoxPro, how to get help in it, get acquainted with the elements of the main program window and what is new in Visual FoxPro 9.0 compared to previous versions. In Chapter 3, you will learn about the project, which is a means of combining elements of an application. After completing Chapter 4, you will learn how to create a database, its tables, indexes, relationships between tables, and determine data integrity conditions. Chapters 5 and 6 explore how to create forms for entering and editing data using a wizard and form designer. Chapters 7 and 8 focus on designing simple reports. After reading Chapter 9, you can create a query of any complexity. Chapter 10 introduces you to creating crosstabs and charts. The application uses a menu to launch forms, reports and programs. Chapter 11 talks about creating such an application menu. After reviewing the first eleven chapters and analyzing the examples presented to your attention, you can create applications yourself. The following chapters build on the knowledge gained in the first chapters and are devoted to advanced tools for creating forms, queries, reports. Chapter 12 discusses how to develop an effective HTML help system for your application. Chapter 13 discusses some additional questions project management, including the creation of an executable (exe) file. Chapters 14 through 18 discuss advanced database management, multi-tabular forms and reports, and the use of ActiveX components in forms. Chapter 19 introduces you to the object-oriented approach to building database applications. You will learn how to create classes and objects based on them. Chapter 20 is devoted to the work of Visual FoxPro on a local network. INTRODUCTION 3 Visual FoxPro is not an isolated system and can effectively interact with other Windows applications. After reading Chapter 21, you will learn how to work with compound objects (OLE), export and import data. You will learn how to install the ODBC driver, how to create a remote data view and configure its parameters in Chapter 22. Chapter 23 introduces you to porting data from Visual FoxPro to a client / server platform using the Growth Wizard. Visual FoxPro has the ability to generate a Web page using the information contained in the database. This is discussed in Chapter 24. For effective work Visual FoxPro uses the parameters that are discussed in the last chapter of the book. The appendix walks you through installing Visual FoxPro 9.0. The book also contains a glossary describing Visual FoxPro terms. Special Elements of the Book There are many special inserts in the book that are highlighted in a special way. They contain Additional Information that makes it easier to read and search for information: NOTE Notes are about the consequences of certain actions. NOTE Tips provide some tips you need to know to get the most out of Visual FoxPro. NOTICE Warnings should help you avoid problems. They tell you what to fear and what to do to avoid mistakes. The book uses different types of fonts: new terms are in italics; the text that you must enter from the keyboard is in bold italic; menu commands, names of buttons, tabs, options, check boxes, dialog boxes, areas, etc. are in bold; names of functions, properties, methods, databases, tables, table fields are in monospaced font. The two keys connected by a plus sign is a key combination. Press the first key and, without releasing it, press the second. Then release both. The authors express their gratitude to the publishing house "BHV-Petersburg" for long-term fruitful cooperation and assistance in the preparation and writing of the book. 4 Introduction Chapter 1 About Visual FoxPro The changes taking place in our country in recent years could not but affect the fields of informatics and computer technology. Ten years ago, working with databases was a lot of professional programmers... The systems themselves were not designed to simple user... The main consumer of such systems was the military-industrial complex. With the emergence of banks, joint-stock companies, private companies, databases have found wider application. People understand that information is money. Losing it or getting it late can be costly. This is what explains such a rapid growth information technologies and the rapid development of database management systems (DBMS). Relational Databases The first database management systems emerged in the mid-1960s and supported a hierarchical data model in which parent / child relationships existed between records. After a short time, network databases were developed, based on a much more complex network model... Each of these models had advantages and disadvantages that played a key role in the development of the relational model. In 1970, an article by IBM researcher Dr. E. F. Codd on the relational data model revolutionized the way we store and process information. The first relational databases were developed on the basis of this model in the seventies of the last century, and now they are considered as the standard for modern commercial DBMS. In relational databases, all information is summarized in tables, the rows and columns of which are called records and fields, respectively. These tables were called relations1, so the model was called relational. Entries in tables are not repeated. Their uniqueness is provided by a primary key containing 1 Relationship - a mathematical term from set theory, which formed the basis of the relational data model. IN English language the word "relation" corresponds to the word "relation", hence the name "relation". - Ed. Chapter 1 6 is a set of fields that uniquely identify a record. For quick search information in the database, indexes are created on one or more fields of the table. Index values ​​are stored in an ordered manner and contain references to table records. Primary and foreign keys are used to automatically maintain the integrity of related data in different tables. To fetch data from multiple related tables, the values ​​of one or more of the matching fields are used. For example, the registration table is long-distance calls can contain the following information: Íîìåð çàêàçà Êîä óñëóãè Íîìåð òåëåôîíà Äàòà ðàçãîâîðà Êîä ãîðîäà Ïðîäîëæèòåëüíîñòü ðàçãîâîðà Ñòîèìîñòü Ïðèìå ÷ àíèå Records of long-distance calls are recorded in the registration book, as a table in chronological order (Figure 1.1.). Each line has the same structure and consists of eight fields. In this example, these are the following fields: Order number, Service code, Phone number, Call date, City code, Call duration, Cost. Fig. 1.1. LOGGING INTERMEDIATE SPOTS BY ARRAY In relational databases, fields can have different data types (numeric, string, date type, etc.), but for each record, the data type of the field remains the same. One of the important advantages of the database is the fast retrieval of the information stored in it. Using the telephone address book, in which the data is sorted by last name, you can find a phone number by the last name of its owner. However, if the long distance book entries are ordered chronologically, you will have to spend a significant amount of time getting Visual FoxPro 7 a list of customers who have ordered a call to a specific city, or figuring out which area the most profitable subscribers live in. telephone company with long conversations. Computer databases come to the rescue. They, despite the huge amount of information stored in them, provide a high speed of searching for the necessary information. In such databases, the user can search for any parameter of interest. Moreover, computer databases are very compact. A database containing several thousand records can fit on one floppy disk. Database management systems are used to create a database, change its structure, edit and retrieve data. Modern relational database management systems contain: a set of tools for creating tables and relationships between related tables; database administration tools; developed user interface which allows you to access the information stored in the database; development tools for applications using databases. In fig. 1.2 shows an example of intercity accounting telephone conversations using two relational database tables in Visual FoxPro. Fig. 1.2. Reads Intermediate Phone Speakers Using the Television Tables Chapter 1 8 Fig. 1.3. Reading in the standard video, containing information about the customers of the telephone company Fig. 1.4. Information Writing, Reference Information With Visual FoxPro 9 Fig. 1.5. Graphical presentation of information about the number of hardware. For example, you can get information about all long-distance calls of a certain customer for any period of time; print the entire table or just selected records and fields in various formats. For example, in Fig. 1.3 shows a tabular report containing the addresses of the telephone company customers. In fig. 1.4 shows one of the variants of a newsletter containing the names and surnames of clients from the same table; display database information graphically. For example, in Fig. 1.5 data on the number of long-distance calls for clients are displayed in the form of a diagram; carry out the necessary calculations when generating reports and selecting data from tables. Currently, there are more than ten popular DBMS for personal computers. Traditionally, one of the most widespread in Russia and the CIS countries is the Visual FoxPro DBMS, the new version of which, Visual FoxPro 9.0, contains additions and improvements that expand the capabilities of the system. 10 Chapter 1 Visual FoxPro Objects Visual FoxPro consists of individual components that are used to store, display, and edit information. In Visual FoxPro, all information is stored in a database, which consists of tables, relationships between tables, indexes, triggers, and stored procedures. Each table has a unique name and is stored in a separate file, the name of which is the same as the name of the table. The created file has the dbf extension. Each table you create can have indexes associated with it, which are used to organize data and quickly find the records you need, and one table can have multiple indexes. Separate files are used to store the values ​​of the Memo and General fields. Memo fields of tables contain text information, and General fields are typically used to store binary information and data from other Windows applications. Visual FoxPro implements triggers that allow you to centrally process events that occur when any changes to the database are made. You can also create stored procedures that are part of the database and can be used to describe tables, validate input data, define default values, and so on. Data views are an extremely convenient and useful means of accessing a database. Data Views allow you to combine table data and display it in more convenient form ... You can select only the table fields you are interested in, combine multiple fields into one field, calculate totals, and specify new table field names. Typically, the number of views in a database far outnumbers the number of tables. As the database is used, their number is constantly growing. In many information systems, access to data, including viewing, adding and editing, is carried out only through the use of data views. This approach allows for flexible control over access to information. When using views to select data in forms, reports, when creating queries, and in programs, the same rules apply as for tables. Editing the data included in the presentation is possible only under certain conditions. For example, if it is created based on only one table. Forms, reports, queries and programs are used to display and edit data. Designers are used to create forms, reports, and queries. Therefore, these components are often referred to as design objects. Forms and reports are composite objects because they are composed of smaller objects (such as fields, buttons, charts, frames, OLE components, and so on) called interface objects. Forms are used to view or enter data into tables. Data can be entered directly into tables, but using a form is a faster and more efficient way to enter. The form contains some or all of the table fields in which you enter information. You can use the Form Builder or the Form Designer to create forms. The Form Wizard contains a number of templates that define the relationship between the faces that are placed on the form in the Visual FoxPro 11 tabs, the way the data is displayed, and the order in which the fields are placed. A form designer is used to create complex shapes. Reports are used to print the information contained in the database. Examples of reports are price list of goods, list of buyers, turnover list. As a rule, reports are created in the event that information needs to be transmitted to someone in hard copy. To create reports in Visual FoxPro, just like for forms, you use a wizard and a report designer. Using the Report Wizard, you can quickly create your own report based on the templates available. Using the Report Designer allows you to create reports of arbitrary complexity, including multi-level data grouping and the placement of calculated fields. Queries are a means of fetching data from one or more tables. In Visual FoxPro, you can use either the Query Designer or the specialized Structured Query Language (SQL) to create a query. Query results can be displayed in a form, displayed as reports and charts, or saved in a table you specify. Programs written in the Visual FoxPro language are object-oriented. With the help of them, you process events in the form, create objects, perform various calculations, manage the database. For convenience, you can combine programs into libraries. To create forms in Visual FoxPro, you can use not only base classes, but also create your own. For example, you can define a form class that has a specific background color and a standard set of buttons for manipulating data. To standardize development, it is helpful to have one or more custom classes for each base class. Classes created in Visual FoxPro are stored in class libraries. To combine the components of the created application, a project is used, which includes all the components listed above. Using a project simplifies application development and maintenance. Each component is stored in a separate file, and the names of the files containing the main components you specify yourself, and the names of the files containing the objects associated with the table coincide with the name of the table. Based on the type of object it contains, Visual FoxPro automatically assigns an extension to each file to help identify the object. The list of file extensions is given in table. 1.1. Table 1.1. Ðàñøèðåíèÿ èìåí ôàéëîâ îáúåêòîâ Visual FoxPro Íàèìåíîâàíèå îáúåêòà Ðàñøèðåíèÿ Ïðîåêò prj, fpc, cat, pjx, pjt Áàçà äàííûõ dbc Òàáëèöà Visual FoxPro dbf Ñîñòàâíîé èíäåêñíûé ôàéë cdx Memo-ïîëå è ïîëå òèïà General frt Ãëàâà January 12 Òàáëèöà 1.1 (îêîí ÷ àíèå) Íàèìåíîâàíèå îáúåêòà Ðàñøèðåíèÿ Ôîðìà scx Çàïðîñ qpr Îò ÷ åò frx, frm Ïî ÷ òîâàÿ íàêëåéêà lbx, lbl ìåíþ mnx áèáëèîòåêà êëàññà vcx Ïðîãðàììà, áèáëèîòåêà ïðîãðàìì, òåêñò ìåíþ, prg, fxp, mpr, qpr òåêñò çàïðîñà Ðèñóíîê bmp, jpg, gif, ico, dib , cur, ani Recording wav This New Arrival in Visual FoxPro 9.0 Visual FoxPro is an ever-evolving system. Compared to the previous version, Visual FoxPro 9.0 takes one more step in expanding the system's functionality, improving the existing tools related to the development environment interface and error handling, adding new commands, base classes and functions, and expanding the existing ones. The new version has all the capabilities for working with XML Web services, as well as improved compatibility with Microsoft Visual Studio .NET and Microsoft SQL Server 2000. Visual FoxPro has extended table designer tools. New data types can be used for table fields: Binary Blob and Text Varbinary. The Blob data type is used for structures containing information about a data block. It is used to store binary information of any type, for example, ASCII characters, executable files, byte streams. The Varbinary data type contains hexadecimal values. It is similar to the Character type, but for data of this type, empty spaces are not filled with insignificant information. A new type of index, Binary, has been introduced, which is based on Boolean expressions and is used for both free tables and database tables. This index takes up significantly less space and therefore improves the speed of index use. Objects placed on the form have new properties. Let's consider the most interesting ones. The Anchor property sets the absolute and relative positions and sizes of the object relative to all four sides of the container object, solving the problem of automatically positioning and resizing objects on the form when it is resized when the Resize event occurs. About Visual FoxPro 13 The Rotation property of Label, Line, and Shape objects allows you to display labels for large objects of the EditBox class as text flowing from bottom to top. The AutoComplection property of the TextBox object allows you to remember the values ​​entered in the field and, when you enter a new value, to show this list for easier input. This property is useful when entering data in a field that has a small set of options. The AutoHideScrollBar property of the ListBox allows you to hide the scroll bar when all rows are visible and show it back when not all rows fit in the ListBox. The PictureMargin and PictureSpacing properties of the CommandButton, OptionButton, and CheckBox objects control the position of the image relative to the edge and text of the object. The MousePointer property for the columns (Column object) and headers (Header object) of the Grid object at the stage of class or form editing sets the required form of the mouse pointer when it enters the field of this object. The SET PATH TO command now has an ADDITIVE property that allows you to add new paths to existing ones, and the length of all paths has increased from 1024 to 4096. In the Project Manager, you can now execute the Modify command when you select a class library, and not a separate class of this library. Visual FoxPro 9.0 launches the Class Browser with the selected class library. Developers will be pleased with the changes in the report designer. Configuring all objects (location of an object in the report strip, style of design, printing conditions, protection against alteration) placed in the report is carried out using the properties dialog box. All parameters of the report itself (page layout, adding header and total areas to the report, grouping data, setting report variables, saving the report as a class) are also set using the Report Properties dialog box. The changes have been made to custom properties and methods. When you create new properties and methods, you can assign default / initial values ​​to them. Enhanced options for customizing Visual FoxPro, carried out from the Options dialog box, which is opened by the Options command from the Tools menu. Enlarged the list of file groups defined by the File Locations tab. The View tab now has a List display count that lets you set the maximum number of list items to display when using IntelliSense. The set of parameters set on the Reports tab has been significantly expanded. 14 Chapter 1 Chapter 2 Getting Started with Visual FoxPro You are getting started with Visual FoxPro 9.0. Many of the things you will have to work with (menus, toolbars, dialog boxes) will seem familiar because they are specific to the Windows environment. Starting Visual FoxPro To start the program from the Windows main menu, follow these steps: 1. Click the Start button located at the bottom of the screen. 2. In the opened Windows main menu, select the Programs command. The menu for this command appears. 3. Select the Microsoft Visual FoxPro 9.0 command from the menu. The main window of Visual FoxPro 9.0 will open on the screen (Fig. 2.1). TIP To launch Visual FoxPro 9.0 faster, you can create a shortcut on the desktop and assign keys to it quick call... Then it will be enough to press the specified key combination in any Windows window, and the program will start. In addition, for the convenience of launching the application, you can use the panel Quick start Windows system by placing the Visual FoxPro program icon on it. Visual FoxPro Main Window 2.1 shows the main window of Visual FoxPro as it looks after starting the program. It has seven main objects: the window title, menu bar, toolbar, status bar, work area, Command window, and the Task Pane Manager dialog box. The title bar is at the top of the main window and contains three objects: a copy of the Visual FoxPro program icon, the title of the main window, and icons to control that window. The menu bar contains a hierarchical Visual FoxPro menu. The list of menu items depends on the type of active window. 16 Chapter 2 Fig. 2.1. Visual FoxPro 9.0 Main Window Visual FoxPro provides the user with a wide variety of toolbars for working with databases, forms, reports, and queries. These toolbars contain a set of buttons, and this set depends on the purpose of the particular toolbar. After starting Visual FoxPro, the standard toolbar is displayed on the screen. At the bottom of the main window there is a status bar, which displays information about current state active window, brief description of the selected toolbar button or menu item. The information displayed in the status bar depends on the type of active window. For example, in the form designer window, the status bar displays the name of the active form object, and when viewing the table in Browse mode, the name of the open table is displayed on the left side of the status bar, and the number of the current record and the operating mode indicator in the middle of the status bar. In Visual FoxPro 9.0, the main window displays the Task Pane Manager by default. It contains a list of recently opened projects and databases, help launch commands and wizards for creating a database and project, examples that you can use in development, and useful links to sites on the Internet. Getting Started with Visual FoxPro 17 As you work, the main Visual FoxPro window opens windows for designers of forms, reports, queries, projects, and other windows. All of them are children of the main window and are closed when it is closed. In addition, if you did not close the project window you were working with when exiting Visual FoxPro, it will open by default in the main window the next time you start the program. System menus and system buttons The title of the main window contains a small copy of the program icon, the text "Microsoft Visual FoxPro" and buttons to control the size of the main window. When you click on the icon of the icon, a system menu opens, containing commands for moving and resizing the main window. Table 2.1 shows the commands available from the system menu. Table 2.1. Íàçíà ÷ åíèå êîìàíä ñèñòåìíîãî ìåíþ Êîìàíäà Íàçíà ÷ åíèå Âîññòàíîâèòü Âîññòàíàâëèâàåò ïðåäûäóùèé ðàçìåð îêíà ïîñëå ìèíèìèçàöèè èëè ìàêñèìèçàöèè Ïåðåìåñòèòü Àêòèâèçèðóåò ãëàâíîå îêíî Visual FoxPro è ïîçâîëÿåò ïåðåìåùàòü åãî ñ ïîìîùüþ êëàâèø ïåðåìåùåíèÿ êóðñîðà Ðàçìåð Àêòèâèçèðóåò ãëàâíîå îêíî Visual FoxPro è ïîçâîëÿåò èçìåíÿòü åãî ðàçìåðû ñ ïîìîùüþ êëàâèø ïåðåìåùåíèÿ êóðñîðà Ñâåðíóòü Ñâåðòûâàåò ãëàâíîå îêíî FoxPro äî ðàçìåðà êíîïêè è ïîìåùàåò åå íà ïàíåëü çàäà ÷ windows Ðàçâåðíóòü Ðàçâåðòûâàåò ãëàâíîå îêíî Visual FoxPro âî âåñü ýêðàí Çàêðûòü Çàêðûâàåò ãëàâíîå îêíî ïðîãðàììû Visual FoxPro TIP to quickly close the Visual FoxPro program, double-click on a small copy of the application icon in the header of the main window ... To quickly restore / maximize the main window, double-click on the title bar. The Microsoft Visual FoxPro text of the main window title can be easily changed, if necessary, by assigning any other name to the main Visual FoxPro window, or by removing the name altogether. To do this, enter the following command in the command window: MODIFY WINDOW SCREEN TITLE "(! LANG: New title of the main window" или _SCREEN.caption = "Новый заголовок главного окна" В !} right side the header contains the window control buttons. Their purpose is described in table. 2.2. 18 Chapter 2 Table 2.2. Íàçíà ÷ åíèå êíîïîê óïðàâëåíèÿ îêíîì Êíîïêà Íàçâàíèå Íàçíà ÷ åíèå Ñâåðíóòü Ñâîðà ​​÷ èâàåò ãëàâíîå îêíî FoxPro äî ðàçìåðà êíîïêè è ïîìåùàåò åå íà ïàíåëü çàäà ÷ Windows Âîññòàíîâèòü îáðàòíî Óìåíüøàåò ðàçìåð ðàçâåðíóòîãî îêíà, ïîçâîëÿÿ â äàëüíåéøåì èçìåíÿòü åãî Ðàçâåðíóòü Ðàçâåðòûâàåò ãëàâíîå îêíî Visual FoxPro âî âåñü ýêðàí Close Opens the main window of Visual FoxPro, provides a large number of Visual FoxPro reporting toolbars, provides a large number of Visual FoxPro reporting tools. They will be discussed in detail in the respective chapters. First, let's examine the standard toolbar (Fig. 2.2), which is used in all modes of operation. Fig. 2.2. Standard Toolbar Visual FoxPro The functions of the standard toolbar buttons are described in table. 2.3. Table 2.3. Íàçíà ÷ åíèå êíîïîê ñòàíäàðòíîé ïàíåëè èíñòðóìåíòîâ Êíîïêà Íàçâàíèå Íàçíà ÷ åíèå New (Íîâûé) Ïîçâîëÿåò ñîçäàòü íîâûé ôàéë (ïðîåêò, áàçó äàííûõ, òàáëèöó, çàïðîñ, ôîðìó, îò ÷ åò, êëàññ) Open (Îòêðûòü) Îòêðûâàåò ñóùåñòâóþùèé ôàéë Save (Ñîõðàíèòü) Ñîõðàíÿåò îòêðûòûé ôàéë Print One Copy (ïå ÷ àòàòü îäíó êîïèþ) ïå ÷ àòàåò ñîäåðæèìîå àêòèâíîãî îêíà Print Preview (Ïðîñìîòð ïå ÷ àòè) Îòêðûâàåò îêíî ïðåäâàðèòåëüíîãî ïðîñìîòðà ïå ÷ àòàåìîãî äîêóìåíòà Cut (Âûðåçàòü) Óäàëÿåò âûäåëåííûé òåêñò èëè âûäåëåííûå îáúåêòû è ïîìåùàåò èõ â áóôåð Copy (Copy) Copies in the buffer of the selected text or the attached objects, do not delete them. Paste. Äåéñòâèå ýòîé êíîïêè çàâèñèò îò òîãî, â êàêîì èç ðåæèìîâ âû ðàáîòàåòå Íà ÷ àëî ðàáîòû ñ Visual FoxPro 19 Òàáëèöà 2.3 (îêîí ÷ àíèå) Êíîïêà Íàçâàíèå Íàçíà ÷ åíèå Undo (Îòìåíèòü) Îòìåíÿåò âûïîëíåííûå äåéñòâèÿ Redo (Âîññòàíîâèòü) Âîññòàíàâëèâàåò îòìåíåííûå äåéñòâèÿ Run (Âûïîëíèòü ) Çàïóñêàåò íà âûïîëíåíèå Modify Form (ìîäèôèöèðîâàòü ôîðìó) Ïîçâîëÿåò ìîäèôèöèðîâàòü SÑX-ôàéë, ñâÿçàííûé ñ äàííîé ôîðìîé Databases (Áàçû äàííûõ) Ñîäåðæèò ñïèñîê îòêðûòûõ áàç äàííûõ Command Window (êîìàíäíîå îêíî) Îòêðûâàåò êîìàíäíîå îêíî Data Session Window (îêíî ñåàíñà äàííûõ) Îòêðûâàåò îêíî Data Session Properties Window (Îêíî ñâîéñòâ) Îòêðûâàåò îêíî Properties (Ñâîéñòâà), èñïîëüçóåìîå äëÿ íàñòðîéêè ñâîéñòâ Document View Window (Îêíî ïðîñìîòðà äîêóìåíòà) Îòêðûâàåò îêíî Document View (Ïðîñìîòð äîêóìåíòà), â êîòîðîì îòîáðàæàåòñÿ ñïèñîê ïðîöåäóð, ôóíêöèé îòêðûòîé â îêíå ðåäàêòîðà ïðîãðàììû Class Browser ( Classes View) Opens the Class Browser window, preset for the Object Browser (View îð îáúåêòîâ) Îòêðûâàåò îêíî Object Browser (Îáçîð îáúåêòîâ), ïîçâîëÿþùåå ïðîñìàòðèâàòü êëàññû, ñâîéñòâà, ìåòîäû, ñîáûòèÿ è êîíñòàíòû âûáðàííûõ áèáëèîòåê Task Pane (Ïàíåëü çàäà ÷) Îòêðûâàåò îêíî Task Pane Manager (Ìåíåäæåð ïàíåëè çàäà ÷) Toolbox (Èíñòðóìåíòàðèé) Îòêðûâàåò îêíî Toolbox (Instrument), which contains the items that were used by the operator when creating the display. appearance button, you cannot define its purpose, position the mouse pointer over the button. In this case, a tooltip with its name will appear under the cursor, and a short description of the specified button will be displayed on the left side of the status bar. By default, the standard toolbar is always present in the main Visual FoxPro window. If it does not appear on the screen, do the following: 1. Select Toolbars from the View menu. The Toolbars dialog box (Fig. 2.3) will open, which contains a list of all toolbars of the Visual FoxPro program. 20 Chapter 2 2. Check the boxes to the left of the names of those panels that you want to place in the main window. 3. Click OK. Using the check boxes at the bottom of the Toolbars dialog box, you can change the appearance of the toolbar buttons. The purpose of these flags is described in table. 2.4. Table 2.4. Íàçíà ÷ åíèå ôëàæêîâ äèàëîãîâîãî îêíà Toolbars Óñòàíîâêà ôëàæêà Íàçíà ÷ åíèå Color buttons (Öâåòíûå êíîïêè) Êíîïêè íà ïàíåëè èíñòðóìåíòîâ ñòàíîâÿòñÿ öâåòíûìè Large buttons (Áîëüøèå êíîïêè) Óâåëè ÷ èâàåòñÿ ðàçìåð êíîïîê ToolTips (Ïîäñêàçêà) Âûâîäèòñÿ êðàòêîå îïèñàíèå êíîïêè ïðè óñòàíîâêå êóðñîðà íà íåå Ðèñ. 2.3. The Toolbars Dialog Box After Visual FoxPro is installed, the standard toolbar is located at the top of the main window, but like all other toolbars, it can be moved anywhere on the screen. To do this, set the mouse cursor to any place free from buttons on the toolbar, press the mouse button and, without releasing it, move the panel to a new location. If you place the toolbar off the edge of the main Visual FoxPro window, you can resize it (Figure 2.4). Getting Started with Visual FoxPro 21 Fig. 2.4. Toolbar can be easily placed in any place of the main window. When you select a specific command, its submenu opens. If there are no others in the main Visual FoxPro window open windows, the menu bar contains File, Edit, View, Tools, Program, Window, and Help. When windows are opened, commands are added to the menu that apply only to the objects in the window. For example, when working with tables, the Table menu item is added to the main menu; when a form is opened on the screen, the Form item appears in the menu. NOTE When you select a command, a short description appears on the status bar. 22 Chapter 2 Executing Menu Commands Executing menu commands in Visual FoxPro is performed using standard Windows actions. Let's list the possible ways. When using a mouse, it is enough to place the cursor on the menu item containing the selected command and press the mouse button. If the command contains a submenu, select the required command from it. When using the keyboard, you must first activate the menu bar by pressing the key or ... Then set the pointer to the required command using the keys<←>, <→> , <> , <↓>and press ... Key<←>used to move to the command to the left of the current one. Pressing this key when the current command is the leftmost one will take you to the system menu. Further key press<←>will set the pointer to the rightmost command on the menu bar. The rest of the keys are used in the same way. For the most frequently executed commands, you can remember the associated "hot" keys, which consist of a combination of the character and an underlined character in the command name. No key press required when using hotkeys ... Disabling the menu command If the menu bar is activated, but you want to refuse to execute the menu command, you should use one of the following methods: press the key ; click anywhere in the main Visual FoxPro window. To return from the submenu to the menu of the previous level, press the key ... File Menu Commands The File menu contains commands related to accessing files. These commands allow you to create new files different types, open existing files, close, save and print them. The Save As HTML command opens a corresponding dialog box that allows you to save the current form, menu, report, or table in HTML (HyperText Markup Language) format. The Revert command is very convenient, it allows you to undo all changes to the file made in the current editing session. At the bottom of the menu are the names of the last four opened projects, which provide an opportunity quick opening any of them. The last command on this menu is the Exit command. It is similar to the QUIT command in the command window and is used to exit Visual FoxPro. Edit Menu Commands The Edit menu is available in many Windows applications. In Visual FoxPro, commands on this menu are used when creating forms and reports and when editing programs. Getting Started with Visual FoxPro 23 The Paste Special, Insert Object, Object, and Links commands apply only to General fields and OLE objects. The rest of the commands are used when editing both programs and table fields. You may not be familiar with other Windows applications from the Go to Line command, which is a Visual FoxPro programmed program. Using this command, you can go to the line with the specified number in the program text. When you enter the name of an object, property, command, or function after entering an activation character (usually a period, space, or open parenthesis), the List Members command of Visual FoxPro invokes a list of valid values ​​(properties, methods, events, and objects) for the specified in object editor. Quick Info Command ( Quick information) displays a valid option for writing a given command, function, variable. The last in the menu is the Properties command, when selected, the Edit Properties dialog box opens, allowing you to set the parameters for saving program files, view their properties, the date of the last editing and the occupied space on disk. View Menu Commands This menu item contains commands for viewing the currently open file. If not open files , then the menu contains only one command Toolbars (Toolbars). This command opens a dialog box that lists the toolbars used when working in Visual FoxPro. When working in designers, the View menu contains commands that control the display of the toolbars used in this mode of operation. So, for example, when working in the form designer, commands appear on the menu for selecting the following panels: Color Palette, Layout, and Form Controls. When you view tables or edit forms, menus, or reports, additional commands appear on the menu. For example, when working with tables, several new commands appear on the menu. The Edit and Browse commands switch the table to view and edit the records it contains. The difference between these two commands is in the style of displaying the contents of the table. Menu Command Format This menu item is available when working in the designer of forms, reports, programs, text files and labels. The Format menu contains commands that control font characteristics, the alignment of text and objects, and the spacing between objects. However, when working with various constructors, additional commands become available. Tools Menu This menu contains wizards and tools for debugging programs. The first command on the Tools menu is the Wizards command, which opens a list of Visual FoxPro wizards. The wizard is a program that helps the user in solving such problems as creating forms, reports, tables. The creation process in this case consists in answering the wizard's questions regarding the object being created. Next on the menu is the Macros command for creating macros. The Debugger command is for debugging programs. It opens the Visual FoxPro Debugger dialog box, where you can view the values ​​of variables, array elements, fields, values ​​returned by Visual FoxPro functions, etc. The Component Gallery command opens the Catalogs - Component Gallery window to work in the Visual FoxPro Component Gallery. The Coverage Profiler command allows you to view information about the executed program. The Object Browser command opens a window of the same name that allows you to view the classes, properties, methods, events and constants of the selected libraries. The IntelliSense Manager command opens a window for configuring options that control how syntax is parsed in the Programming Editor window. The Task List command allows you to memorize a location to which you can return later by pressing a shortcut key. In addition, this command allows you to enter a list of required tasks similar to Microsoft Outlook. The Document View command opens a dialog box that displays a list of procedures, functions, and operators for the program open in the editor window. When a list item is selected, the transition to this item is carried out in the editor window. The Task Pane and Toolbox commands open the Task Pane Manager and ToolBox dialog boxes, respectively. The ToolBox displays the items that were used to create the applications. The last command on the Tools menu is Options. It allows you to customize the configuration of Visual FoxPro. Program Menu Commands The Program menu contains commands related to executing and compiling programs. Window Menu Commands The Window menu contains commands that control the windows that are open on the screen. You can use these commands to reorder, hide, clear windows, and move from one window to another. In addition, the commands of this menu allow you to activate any open window. The Command Window command on the Window menu activates the Command Window, which allows you to use commands when working with Visual FoxPro. Getting Started with Visual FoxPro 25 The Properties Window command opens the Properties dialog box, which allows you to view and change the properties of objects in the form of cursors and relationships. The Data Session command is used to open the Data Session window, which contains a list of all tables open in this session and the relationships between them (Figure 2.5). Fig. 2.5. The Data Session window shows the working area with the tables open and the relative indexes in the center of the Data Session window. The Properties button opens a window that allows you to view and change the current table properties. The Open button is used to open the table in a new work area. The Browse button (Tabular Mode) opens the table to view the records it contains. The Close button of the Data Session window closes the table in the current work area, and the Relations button allows you to define relationships between open tables. Menu Commands Help Help is the last command in the main window menu. Tab. 2.5 contains a list of commands available in this menu. Table 2.5. Íàçíà ÷ åíèå êîìàíä ìåíþ Help Êîìàíäà ìåíþ Íàçíà ÷ åíèå Microsoft Visual FoxPro Help Îòêðûâàåò îêíî ñïðàâî ÷ íîé ñèñòåìû Visual FoxPro 9.0 (Ñïðàâî ÷ íàÿ ñèñòåìà Visual FoxPro) MSDN Search (Ïîèñê â MSDN) 1 Ïîèñê ñïðàâî ÷ íîé èíôîðìàöèè â MSDN1 Microsoft Developer Network , a collection of Microsoft documents containing information about all of its developments. - Ed. 26 Ãëàâà 2 Òàáëèöà 2.5 (îêîí ÷ àíèå) Êîìàíäà ìåíþ Íàçíà ÷ åíèå Technical Support (Òåõíè ÷ åñêàÿ ïîääåðæêà) Îòîáðàæàåò èíôîðìàöèþ î òåõíè ÷ åñêîé ïîääåðæêå, îêàçûâàåìîé Microsoft Visual FoxPro on the Web (Visual FoxPro íà Web-ñòðàíèöàõ) Îòêðûâàåò Web-ñòðàíèöó Microsoft Visual FoxPro. Äëÿ èñïîëüçîâàíèÿ ýòîé êîìàíäû íåîáõîäèì äîñòóï â Èíòåðíåò About Microsoft Visual FoxPro (Î ïðîãðàììå Microsoft Visual FoxPro) Îòêðûâàåò äèàëîãîâîå îêíî About Microsoft Visual FoxPro, â êîòîðîì ñîäåðæèòñÿ èíôîðìàöèÿ îá àâòîðñêèõ ïðàâàõ íà ïðîãðàììó, íîìåð âåðñèè ïðîãðàììû è åå èäåíòèôèêàòîð, èìÿ ôàéëà ðåñóðñîâ è èñïîëüçóåìûé ïî Refine the catalog. In this window, view the various information about the computer, in order to quit FoxPro, exiting Visual To do this, you can use one of the following methods: select the Exit command from the File menu; select the Close command in the system menu of the main Visual FoxPro window; double-click the Visual FoxPro icon in the title bar of the main window; enter the QUIT command in the command window. If the form, report, query, or any other application object is not saved, Visual FoxPro prompts you to save it. To do this, a dialog box appears on the screen similar to that shown in Fig. 2.6. Fig. 2.6. Dialogue window, accessed while streaming output from Visual FoxPro without saving information. To continue the operation, press one of the buttons (Table 2.6.). Table 2.6. Íàçíà ÷ åíèå êíîïîê äèàëîãîâîãî îêíà, ïîÿâëÿþùåãîñÿ ïðè ïîïûòêå âûõîäà èç Visual FoxPro áåç ñîõðàíåíèÿ èíôîðìàöèè Êíîïêà Íàçíà ÷ åíèå Yes (Äà) Ñîõðàíåíèå ôàéëà è âûõîä èç Visual FoxPro; åñëè ôàéëó åùå íå ïðèñâîåíî èìÿ, Visual FoxPro îòêðûâàåò äèàëîãîâîå îêíî Save As (Ñîõðàíèòü Êàê) No (Íåò) Âûõîä èç Visual FoxPro áåç ñîõðàíåíèÿ ôàéëà Cancel (Îòìåíà) Çàêðûòèå òåêóùåãî äèàëîãîâîãî îêíà è âîçâðàùåíèå â Visual FoxPro Íà ÷ àëî ðàáîòû ñ Visual FoxPro 27 Task Panel Windows In Visual FoxPro 9. 0 has a task manager to help you develop your application. The links in its window allow you to launch the New Application and Database Wizard, open the Help system, open the application or database from the list of recently opened applications or databases, and much more. To open the Task Pane Manager window (Fig. 2.7), you can use one of the following methods: select the Task Pane command from the Tools menu; click the Task Pane button on the standard toolbar. In addition, the Task Manager window opens in the main Visual FoxPro window each time it starts if Open the Task Pane Manager when Visual FoxPro starts is selected in the Task Pane Options dialog box. ... Fig. 2.7. Main page of the Task Pane Manager window Toolbar (Table 2.7). Manager contains buttons for the next assignment 28 Chapter 2 Table 2.7. Íàçíà ÷ åíèå êíîïîê ïàíåëè èíñòðóìåíòîâ Task Pane Manager Êíîïêà Íàçíà ÷ åíèå Îòêðûâàåò îñíîâíóþ ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, ñîäåðæàùóþ ñïèñîê íåäàâíî èñïîëüçóåìûõ ïðîåêòîâ è áàç äàííûõ, êíîïêè äëÿ ñîçäàíèÿ íîâûõ, à òàêæå ññûëêè, ñîäåðæàùèå èíôîðìàöèþ î Microsoft Visual FoxPro Îòîáðàæàåò â îêíå ìåíåäæåðà ïàíåëè çàäà ÷ ññûëêè íà îñíîâíûå ñàéòû ñ èíôîðìàöèåé è ïîñëåäíèìè íîâîñòÿìè î Visual FoxPro Ïîçâîëÿåò îïðåäåëèòü íàñòðîéêè ñðåäû Visual FoxPro è ñâÿçàòü ñîáñòâåííûé ïðîåêò ñ íèìè Ñîäåðæèò ñïèñîê ïðèìåðîâ èñïîëüçîâàíèÿ ýëåìåíòîâ Visual FoxPro Îòêðûâàåò ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, êîòîðàÿ ïîìîãàåò â èñïîëüçîâàíèè ñóùåñòâóþùèõ XML Web-ñåðâèñîâ è Creation of new data is used to search for files on the computer, not from Microsoft Visual FoxPro source. Ïîçâîëÿåò ïðîñìàòðèâàòü ïåðå ÷ åíü óñòàíîâëåííûõ ñîåäèíåíèé ê áàçàì äàííûõ, äîáàâëÿòü íîâûå ñîåäèíåíèÿ Çàïóñêàåò èãðó Minesweeper (Ñàïåð) Îáíîâëÿåò ñîäåðæèìîå äèàëîãîâîãî îêíà Task Pane Manager (Ìåíåäæåð ïàíåëè çàäà ÷) Îòêðûâàåò äèàëîãîâîå îêíî Task Pane Options (Ïàðàìåòðû ïàíåëè çàäà ÷), ïîçâîëÿþùåå íàñòðîèòü ïàðàìåòðû êàê Standard, Start, and Independently Created Task Pane The main page of the Task Pane Manager (see Fig. 2.7), opened when you click the Start button on the toolbar, contains links (Table 2.8). Table 2.8. What’s new in Visual FoxPro? Opens the Help window on the page, list (What's new in Visual FoxPro? ) Âàþùåé íîâûå âîçìîæíîñòè Visual FoxPro 9.0 Customize my development Îòêðûâàåò ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, ñîäåðæàùóþ environment (Íàñòðîèòü ñðåäó íàñòðîéêè ñðåäû Visual FoxPro ðàçðàáîòêè) Create a new application (Ñîç- Çàïóñêàåò ìàñòåðà ñîçäàíèÿ ïðîåêòà äàòü íîâûé ïðîåêò) Create a new database (Ñîç- Launches the database (new database) Go to the Visual FoxPro web Opens the Microsoft Visual FoxPro website. Äàííàÿ site (Ïåðåéòè íà ñàéò Visual âîçìîæíîñòü äîñòóïíà ïðè ïîäêëþ ÷ åíèè êîìïüþòåðà ê Èíòåðíåòó FoxPro) Íà ÷ àëî ðàáîòû ñ Visual FoxPro 29 Òàáëèöà 2.8 (îêîí ÷ àíèå) Ññûëêà Íàçíà ÷ åíèå Manage (Óïðàâëÿòü) Îòêðûâàåò äèàëîãîâîå îêíî My Tools (Ìîè èíñòðóìåíòû) Open Project (Îòêðûòü ïðîåêò) Îòêðûâàåò äèàëîãîâîå îêíî Open (Îòêðûòü) äëÿ âûáîðà íåîáõîäèìîãî ïðîåêòà New Project (Íîâûé ïðîåêò) Îòêðûâàåò äèàëîãîâîå îêíî Create (Ñîçäàòü) äëÿ ñîçäàíèÿ íîâîãî ïðîåêòà Open Database (Îòêðûòü áàçó Îòêðûâàåò äèàëîãîâîå îêíî Open (Îòêðûòü) äëÿ âûáîðà íåäàííûõ) (see the Options window in the Options pane, the Options pane is used to create the task parameters dialog box. Toolbar Options) Figure 2.8 Task Pane Options Dialog Box The left side of the Task Pane Options window contains folders for The page settings of the Task Pane Manager dialog box. General settings are configured using the Task Pane Manager folder, which contains three sections General, Proxy Server, and Customize. When you select General 30 Chapter 2 (see Figure 2.8), the Pane list appears on the right side of the window, from which you select the page displayed when the taskbar manager is opened, and options that specify the frequency of updating information from the Internet ( Table 2.9). The Open the Task Pane Manager when Visual FoxPro starts check box below specifies whether to start the Task Pane Manager when Visual FoxPro starts. Table 2.9. Îïöèè íàñòðîéêè ÷ àñòîòû îáíîâëåíèÿ èíôîðìàöèè èç Èíòåðíåòà Ññûëêà Íàçíà ÷ åíèå Every time you start the Task Pane Îáíîâëÿåò ñîäåðæèìîå ìåíåäæåðà ïàíåëè çàäà ÷ Manager (Êàæäûé ðàç ïðè çàïóñêå êàæäûé ðàç ïðè åãî çàïóñêå ìåíåäæåðà ïàíåëè çàäà ÷) Every time the pane is loaded (Êàæäûé Îáíîâëÿåò ñòðàíèöó, ñîäåðæàùóþ èíôîðìàöèþ èç ðàç ïðè çàãðóçêå ïàíåëè) Èíòåðíåòà, ïðè êàæäîì åå îòêðûòèè Every x days (êàæäûå x äíåé) Îñóùåñòâëÿåò îáíîâëåíèå èíôîðìàöèè êàæäûå x äíåé, çàäàííûõ ñ ïîìîùüþ ñ ÷ åò ÷ èêà Never (Íå îáíîâëÿòü) Íå îáíîâëÿåò ñîäåðæèìîå äèàëîãîâîãî îêíà Task Pane Manager NOTE Refresh the contents of the Task Pane Manager dialog box by clicking the Refresh button on the toolbar. You can create your own taskbar, modify an existing one, or install the taskbar from disk. To do this, follow these steps: 1. In the Task Pane Manager window, click the Options button on the toolbar. 2. On the left side of the Task Pane Options window that opens, select the Task Pane Manager folder and then Customize. 3. On the page that opens, click one of the following buttons: Install Pane - installs a new panel; Customize Pane - Modifies an existing or creates a new panel. Visual FoxPro Help System When developing applications in Visual FoxPro, as in any other system, it is often necessary to review the capabilities of programming tools, individual commands and functions. In Visual FoxPro, in addition to the traditional help system, you can find information of interest in the built-in documentation, numerous examples, and also on the Web pages. All of these tools are selected from the Help menu. Getting Started with Visual FoxPro 31 Like most of the most popular programs, Visual FoxPro has a context sensitive help system, that is, you can get help on using the tool you are using. currently... To do this, you can use one of the following methods: select the Microsoft Visual FoxPro Help command from the Help menu; in the Task Pane Manager dialog box, select the What’s new in Visual FoxPro? link. (What's new in Visual FoxPro?); to push at any time during a Visual FoxPro session. The help system will select the section of the directory that deals with information about the current operation; some of the dialog boxes contain a Help button on the toolbar or directly in the window. If the Help button was pressed while working in one of them, Visual FoxPro will tell you how to use this dialog box (Figure 2.9). Fig. 2.9. The Visual FoxPro Help System will show you how to work with the current dialog box. Figure 2.10 shows the Visual FoxPro help window that opens when you select the Microsoft Visual FoxPro Help command from the Help menu. 32 Chapter 2 Fig. 2.10. Microsoft Visual FoxPro 9.0 Help System Window This window is divided into two areas. There are four tabs in the left pane of the Help window where you search for the information you want. The right pane of the window contains information for the selected section. You can use the cursor to control the width of the areas of the Help window. To do this, you need to do the following: 1. Place the cursor on the dividing line between the areas. 2. When the cursor changes to a double-headed arrow, press left button mouse and, holding it down, move it to one side or the other, depending on which area you want to expand. 3. After setting the desired size of the area, release the mouse button. The help window has a toolbar. The left pane of the Help window contains four tabs designed to make it easier to find the information you need (Table 2.10). Table 2.10. Íàçíà ÷ åíèå âêëàäîê, ïðåäíàçíà ÷ åííûõ äëÿ óïðîùåíèÿ ïîèñêà èíôîðìàöèè Âêëàäêà Íàçíà ÷ åíèå Ñîäåðæàíèå Ïîèñê èíôîðìàöèè ïî îãëàâëåíèþ ñïðàâî ÷ íîé ñèñòåìû Óêàçàòåëü Ïîèñê òåì ïî íà ÷ àëüíûì áóêâàì íàçâàíèÿ òåìû Ïîèñê Ïîèñê êëþ ÷ åâûõ ñëîâ è ôðàç â òåìàõ Èçáðàííîå Ñîäåðæèò èçáðàííûå òåìû ñïðàâî Hinting system Let's consider in more detail how to work with tabs in the help system. Getting Started with Visual FoxPro 33 Using the Contents Tab The first tab in the Help window is the Contents tab (see Figure 2.10). This tab takes the most traditional approach to getting help information. The Contents tab contains a list of topics in the Help system. The icon is displayed in front of the name of each section. At the initial moment, all sections are closed, which corresponds to the closed book icon. To open any of the sections, place the cursor on the section to be opened and press the mouse button. As a result, the icon will look like an open book. Pressing the mouse button again on the open book icon closes the section. An open section can contain subsections and topics (Fig. 2.11). An icon with a question mark corresponds to a topic. To display the content of a specific topic in the right pane of the help window, place the cursor on its name or the corresponding icon and press the mouse button. Fig. 2.11. See the help text for which there are links to the Help section, because you can find help for several topics in the Help section, because you can find help for several topics in the Help section. 34 Chapter 2 Searching for Help by Subject Index To search for Help by Subject Index, use the Index tab (Fig. 2.12) of the Help window. At the top of the tab there is a field for entering a keyword by which the search will be carried out. Below it is a list of keywords, sorted alphabetically. As you enter letters in the input field, sections appear in the list of keywords with the first letters of their names matching the letters already entered. Fig. 2.12. The Index tab to search for a section by initial name You can simply scroll through the list of keywords with the scroll bar, highlight the section you want, and then click Show. Help text appears in the right pane of the window. To search for information using the Index tab, you must enter the initial letters of the topic you want to find. As an example, properties were introduced (Fig. 2.12). If the help system finds topic names starting with the specified letter in the list, they will be highlighted in color or brightness. If several topics satisfy the search condition, the Found Sections window (Fig. 2.13) will appear with a list of sections. The required topic is selected from this list and the Show button is pressed. Information about the specified topic will be displayed in the right pane of the Help window. Getting Started with Visual FoxPro 35 Fig. 2.13. Dialog window Subdivisions Using the Search tab To search for keywords and phrases, use the Search tab. In the Search for next words input field, you enter the word or phrase you want to search for. If you want to find a phrase, you need to enclose it in single or double quotes. You can also use the "?" (to denote one arbitrary character) and "*" (to denote any number of characters). In addition, for searching, you can use logical expressions composed of words, using the logical operators presented in table. 2.11. Table 2.11. Ëîãè ÷ åñêèå îïåðàòîðû, èñïîëüçóåìûå ïðè ïîñòðîåíèè âûðàæåíèé äëÿ ïîèñêà Îïåðàòîð Ïðèìåð âûðàæåíèÿ äëÿ ïîèñêà Ðåçóëüòàò AND properties AND form Îòîáðàæàþòñÿ òîëüêî òå òåìû ñïðàâêè, êîòîðûå ñîäåðæàò îáà ñëîâà èëè properties & form OR properties OR form èëè Îòîáðàæàþòñÿ òåìû ñïðàâêè, â êîòîðûõ ñîäåðæèòñÿ ëþáîå èç äâóõ words properties | form NEAR properties NEAR form Îòîáðàæàþòñÿ òåìû ñïðàâêè, â êîòîðûõ ïåðâîå ñëîâî íàõîäèòñÿ ðÿäîì ñî âòîðûì ñëîâîì â ïðåäåëàõ âîñüìè ñîñåäíèõ ñëîâ NOT properties NOT form Âûáèðàþòñÿ òîëüêî òå òåìû ñïðàâêè, â êîòîðûõ ñîäåðæèòñÿ ïåðâîå ñëîâî è íå ñîäåðæèòñÿ ñëîâî, ðàñïîëîæåííîå ïîñëå îïåðàòîðà NOT èëè properties! form Having built the search expression, press the Sections button. This will search for sections containing the specified expression, and a list of sections will be displayed on the Search tab in the Section table. 36 Chapter 2 Fig. 2.14. Search by Key Words Table A section has three columns. The Title column contains the titles of the Help topics found, the Location column contains information about the location of the Help topic, and the Rank column contains the frequency of the search term. The final list of topics will display the first 500 help topics that match the specified search condition. You can use the table column headings to organize the topics in the Section table. To do this, click on the heading of the column by which the ordering should be performed. The desired one is selected from the list of found topics and the Show button is pressed. Information on this topic will be displayed in the right pane of the help window (Fig. 2.14). In the text of the help topic, you can highlight the words that were specified for the search. To do this, on the toolbar, click the Options button and select the Highlight Results command from the list that appears. To define search parameters, checkboxes have been added to the tab, when set, the user is presented with additional features(Table 2.12). Table 2.12. Íàçíà ÷ åíèå ôëàæêîâ äëÿ îïðåäåëåíèÿ ïàðàìåòðîâ ïîèñêà Ôëàæîê Íàçíà ÷ åíèå Ïðåäûäóùèé ïîèñê Ïîèñê ñðåäè òåì ñïðàâî ÷ íîé ñèñòåìû, êîòîðûå áûëè îòîáðàíû â ïðåäûäóùåì ïîèñêå Ïîõîæèå ñëîâà Ïîèñê íå òîëüêî ñëîâ, çàäàííûõ â âûðàæåíèè ïîèñêà, íî è ïîõîæèõ íà íèõ Òîëüêî â çàãîëîâêàõ Ïîèñê òîëüêî Getting Started with Visual FoxPro 37 Selected Tab The Favorites tab allows you to create a list of the most frequently used Help topics that should be easy to select. By default, this tab is empty. To add a help topic to the Favorites tab, do the following: 1. Using other tabs in the help system window, find the topic whose name you want to place on this tab. 2. Display the found information in the right pane of the help window. 3. Go to the Favorites tab. The name of the topic you are viewing appears in the Current Section field of this tab. 4. Click the Add button. The name of the current Help topic is added to the Favorite Topics list. Similarly, you can add all the necessary Help topics to this area. To remove sections from this tab, use the Delete button. Viewing Online Help The Visual FoxPro Help contains a wealth of information you need to develop applications. For the latest news on Visual FoxPro, see Fig. 2.15. Visual FoxPro News Page 38 Chapter 2, you can open the corresponding Web page directly from the main Visual FoxPro window. For this purpose it is intended Microsoft team on the Web (Visual FoxPro on the Web) Help menu. NOTE Web browsing is not possible if there is no Internet access. To gain access, you must install a modem on your computer and register with your local ISP. In fig. 2.15 is a Visual FoxPro news page maintained by Microsoft. The left pane contains the sections on Visual FoxPro. After clicking on the name of the section of interest, a Web page containing information on this section will start loading. Chapter 3 A Project as a Means for Using Application Elements When you create an application, you use a project that combines the elements of a Visual FoxPro application and groups them by type. Information about the project is stored in a special table, which, unlike ordinary Visual FoxPro tables, has the pjx extension. Memo-fields of the table contain the name of the project element, its description and other text attributes. The file with Memo-fields of the table has the pjt extension. Using the project simplifies the development of the application, because in the project, databases, programs, forms, reports, queries and other elements of the application are located in the appropriate sections, and the location of each element included in the project is remembered. Once you have created a project and defined its elements, you can use it to build your application by building a file with the app extension, or to create an executable file with extension exe... When building an application from a project, the search and assembly of files referenced by the elements of the application is carried out, the versions of the files included in the project are tracked. Creating an Application Project When you start developing a new application, you first need to create an application project. In the future, various elements of the application are added to it. You can use the Application Wizard or the New command on the File menu to create a new project. When the New command is executed, a corresponding dialog box opens on the screen listing all types of application elements that are possible in Visual FoxPro (Fig. 3.1). The default option is Project. To create a new project, follow these steps: 1. Click the New file button. 1. In the Enter project file input field of the Create dialog box, specify the name of the project to be created, making sure that the Save file type is set to Project as the Save type field, and the correct folder is selected in the Folder field. the project will be located (Fig. 3.2). 2. To save the created project, click the Save button. Visual FoxPro creates the project files and writes them to the specified location. This will open the Project Manager window (Figure 3.3). 40 Chapter 3 Fig. 3.1. Dialog box New, in which you can easily indicate the type of the created file Fig. 3.2. The Create dialog window for setting the name of the created project as a means of integrating the output 41 3.3. The Project Manager Window At the top of the project window there are tabs that control the display of certain types of project files, greatly facilitating the development of the application (Table 3.1). Table 3.1. Âêëàäêè îêíà Project Manager Âêëàäêà Îòîáðàæàåìûå ôàéëû All (Âñå) Âñå ôàéëû Data (Äàííûå) Áàçû äàííûõ, òàáëèöû, çàïðîñû, ïðåäñòàâëåíèÿ äàííûõ, õðàíèìûå ïðîöåäóðû Documents (Äîêóìåíòû) Ôîðìû, îò ÷ åòû è ýòèêåòêè Classes (Êëàññû) Êëàññû Code (Êîäû) Ïðîãðàììû and Other (Default) Menus, Text and Graphics Files, Key Macros Visual FoxPro uses a hierarchical display of project items. In fact upper level There are categories of project items: Data, 42 Chapter 3 Documents, Class Libraries, Code, and Other. NOTE There is a separate tab for each category of elements in the project window. The next level contains the file types of this category. For example, for the Documents category, there are the following file types: Forms - forms; Reports - reports; Labels - labels. Some types of files may have subsequent levels of the hierarchy. For example, a database can contain tables, data views, and each table contains fields. Each hierarchical list can be collapsed or expanded. If an element of the hierarchical list contains elements of the next level, then a plus sign is displayed on the left side of the element name in the collapsed state. In fig. 3.3 it can be seen that all items in the list except for Class Libraries contain nested item levels. To expand the list of elements of the next level, click on the plus sign. Expanding the list changes the plus sign to a minus sign. In fig. 3.4 is an example of a hierarchical Data list that is four levels deep. To collapse the nested list of items, click on the minus sign. In the project window there is one very interesting and useful button ... It is located in the upper right corner of the project window and contains an upward-pointing arrow. When you click on this button, the project window is minimized, only the names of the tabs remain visible, and the button icon changes to an arrow pointing down. This frees up space on the screen for other windows (Fig. 3.5). In this case, the project tabs remain active, and when you click on them, a part of the project window opens, containing the information of the selected tab (Fig. 3.6). To return the project window to the expanded view, click the button containing the arrow pointing down. Visual FoxPro provides the ability to move an open tab around the screen. To do this, click on the shortcut and, without releasing the mouse button, move the tab anywhere in the main Visual FoxPro window (Fig. 3.7). In addition, you can resize the tab. To do this, follow these steps: 1. Place the cursor in the lower right corner. 2. When the cursor turns into a double-headed arrow, press and hold the left mouse button and move it to one side or the other. 3. After setting the desired size of the area, release the mouse button. Project as a means of adding elements of the application Fig. 3.4. List of project items Fig. 3.5. Top window of project 43 44 Chapter 3 Fig. 3.6. One page layout Fig. 3.7. Ïåðåìåùåíèå îòêðûòûõ âêëàäîê ïî ýêðàíó Ïðîåêò êàê ñðåäñòâî îáúåäèíåíèÿ ýëåìåíòîâ ïðèëîæåíèÿ 45 Óïðàâëåíèå ïðîåêòîì ñ ïîìîùüþ ìåíþ When you open the project window in the main Visual FoxPro menu, add a new menu item Project (the Project), which contains commands that let you work with files that are included in the project. The purpose of these commands is described in table. 3.2. Table 3.2. Íàçíà ÷ åíèå êîìàíä ìåíþ Project Êîìàíäà Íàçíà ÷ åíèå New File (Íîâûé ôàéë) Ñîçäàåò íîâûé ôàéë, êîòîðûé àâòîìàòè ÷ åñêè äîáàâëÿåòñÿ â ïðîåêò Add File (Äîáàâèòü ôàéë) Äîáàâëÿåò ñîçäàííûå ðàíåå ôàéëû â ïðîåêò Modify File (Èçìåíèòü ôàéë) Îòêðûâàåò âûáðàííûé ôàéë ïðîåêòà äëÿ ðåäàêòèðîâàíèÿ Browse File (Ïðîñìîòð ôàéëà â òàáëè ÷ íîì âèäå) Îòêðûâàåò òàáëèöó â ðåæèìå ïðîñìîòðà Preview File (Ïðîñìîòð ôàéëà) Îòêðûâàåò ôàéë (íàïðèìåð, îò ÷ åò) â îêíå ïðåäâàðèòåëüíîãî ïðîñìîòðà Run File (Âûïîëíèòü ôàéë) Çàïóñêàåò ôàéë íà âûïîëíåíèå Remove File (Óäàëèòü ôàéë) Óäàëÿåò ôàéë èç ïðîåêòà Rename File (Ïåðåèìåíîâàòü ôàéë) Ïåðåèìåíîâûâàåò ôàéë, âõîäÿùèé â ïðîåêò Exclude (Èñêëþ ÷ èòü) Èñêëþ ÷ àåò ôàéë èç ïðîåêòà Include (Âêëþ ÷ èòü) Âêëþ ÷ àåò ôàéë â ïðîåêò Set Main (Îñíîâíàÿ ïðîãðàììà) Óñòàíàâëèâàåò ôàéë â êà ÷ åñòâå îñíîâíîé ïðîãðàììû ïðîåêòà Edit Description (Ïðàâêà îïèñàíèÿ) Îòêðûâàåò îêíî ðåäàêòèðîâàíèÿ îïèñàíèÿ ôàéëà Project Info (Èíôîðìàöèÿ ïðîåêòà) Îòîáðàæàåò èíôîðìàöèþ î ïðîåêòå è âõîäÿùèõ â íåãî ôàéëàõ Errors (Îøèáêè ) Îòîáðàæàåò îøèáêè, Îáíîâëÿåò èíôîðìàöèþ â îêíå ïðîåêòà Clean Up Project (Î ÷ èñòèòü) Î ÷ èùàåò ïðîåêò, óáèðàÿ èç íåãî óäàëåííûå ôàéëû âîçíèêøèå ïðè ïîñòðîåíèè ïðîåêòà Build (Ïîñòðîèòü) Ñòðîèò ïðèëîæåíèå èëè ïåðåñòðàèâàåò ïðîåêò Refresh (Îáíîâèòü) To work with project files can be use the context menu that opens when you right-click on it (Fig. 3.8) and contains some commands of the Project menu, as well as the Expand All command, which expands all levels of data nesting in the Project Manager window. 46 Chapter 3 Fig. 3.8. Context menus for the selected project file Managing project elements To control the elements of the project, use the buttons located on the right side of the project window. Some of the buttons can be used when working with files of all types, and some - only with certain ones. Table 3.3. is a list of buttons that can be used for all types of project files. Table 3.3. Íàçíà ÷ åíèå êíîïîê îêíà ïðîåêòà Êíîïêà Íàçíà ÷ åíèå New (Íîâûé) Ñîçäàåò íîâûé ôàéë, êîòîðûé àâòîìàòè ÷ åñêè äîáàâëÿåòñÿ â ïðîåêò Add (Äîáàâèòü) Äîáàâëÿåò ñîçäàííûé ðàíåå ôàéë â ïðîåêò Modify (Èçìåíèòü) Èçìåíÿåò âûáðàííûé ôàéë ïðîåêòà Remove (Óäàëèòü) Óäàëÿåò ôàéë èç Project For executable files (forms, requests, programs, and menus), the Run button can be used to launch the selected project file. For reports and labels, you can use the Preview button as a tool for sharing the items in Application 47 which opens the file in a preview window. The Browse button is used to browse the data contained in the table. The Build button of the project window opens the Build Options dialog box, allowing you to build a project, an executable application, a DLL, or update an existing project. Using the Wizard to Create a Project In Visual FoxPro 9.0, when you create a project using the wizard, you can include tables, forms, reports, and add items that you created earlier to the project. To create a new project using the wizard, follow these steps: 1. From the File menu, select New, or click the New button on the toolbar. 2. The New dialog box will open, select the Project option and click the Wizard button. TIP In Microsoft Visual FoxPro 9.0, the New Project wizard can also be launched from the Task Pane Manager window. To do this, use the Create a new application link in the Task Manager window. The dialog box shown in Fig. 3.9. Fig. 3.9. Setting the name of the project and its location 3. The dialog box shown in fig. 3.9. In the Project name input field of this window, you must specify the name of the project to be created, and in the Project file input field, specify its location. To place the project in the required folder, use the Browse button, which opens a dialog box allowing you to find the required folder on your computer. 4. After specifying the file name and location, click OK to create a new project. The wizard proceeds to create a new project, and the Application Builder dialog box appears on the screen (Figure 3.10). 48 Chapter 3 Fig. 3.10. Application viewer dialog The lower part of the dialog box contains the following buttons: Help - opens the help file; Cancel - cancels the work of the wizard; OK - creates a new project. In addition, the dialog box contains six tabs on which the following information is defined (Table 3.4). Table 3.4. Âêëàäêè äèàëîãîâîãî îêíà Application Builder Âêëàäêà Èíôîðìàöèÿ General (Îáùèå) Îñíîâíûå ïàðàìåòðû ñîçäàâàåìîãî ïðîåêòà Credits (Îá àâòîðå) Èíôîðìàöèÿ îá àâòîðàõ ïðîåêòà Data (Äàííûå) Ïàðàìåòðû ñîçäàíèÿ áàç äàííûõ è òàáëèö Forms (Ôîðìû) Èíôîðìàöèÿ î ôîðìàõ, âõîäÿùèõ â ïðîåêò Reports (Îò ÷ åòû ) Èíôîðìàöèÿ îá îò ÷ åòàõ, âõîäÿùèõ â ïðîåêò Advanced (Äîïîëíèòåëüíûå) Ïàðàìåòðû ñîçäàíèÿ ñïðàâî ÷ íîé ñèñòåìû, ìåíþ ïðîåêòà Çàäàíèå îáùèõ ïàðàìåòðîâ ïðîåêòà tab of General (General) (see. Fig. 3.10) is used to set these parameters of the project, as its name, image placed in the project, type of application being created, common dialog boxes, project icon. The Name input field allows you to set the name of the application, which is displayed in its title, the About dialog box, and also within the application. Project as a tool for adding application elements 49 In the Image input field, you can specify the name of the image file that will appear in the window when the application is launched and in the About dialog box. The Application Type area allows you to set the type of application to create (Table 3.5). Table 3.5. Îïöèè îáëàñòè Application Type Îïöèÿ Òèï ïðèëîæåíèÿ Normal (Îáû ÷ íîå) Ñîçäàííîå ïðèëîæåíèå áóäåò çàïóñêàòüñÿ â ãëàâíîì îêíå Visual FoxPro, çàìåíÿÿ âñå îêðóæåíèå è ñèñòåìíîå ìåíþ Visual FoxPro Module (Àâòîíîìíîå) Ïðèëîæåíèå äîáàâëÿåòñÿ â ñóùåñòâóþùèé ïðîåêò èëè áóäåò âûçûâàòüñÿ èç äðóãîãî ïðèëîæåíèÿ. Ìåíþ ïðèëîæåíèÿ äîáàâëÿåòñÿ â ñèñòåìíîå ìåíþ, è åãî ôóíêöèè èñïîëüçóþòñÿ êàê êîìïîíåíòû äðóãîãî ïðèëîæåíèÿ Top-Level (Âåðõíèé óðîâåíü) Ïðèëîæåíèå áóäåò çàïóñêàòüñÿ êàê îòäåëüíîå ïðèëîæåíèå Microsoft Windows installing flags group Common Dialogs (General dialog), you can use in the application of common dialog boxes, containing information about developers, program, access rights to application files (tab. 3.6). Table 3.6. Íàçíà ÷ åíèå ôëàæêîâ ãðóïïû Common Dialogs Ôëàæîê Íàçíà ÷ åíèå Splash screen (Âñïëûâàþùèé ýêðàí) Ïðè çàïóñêå ïðèëîæåíèÿ ïîÿâëÿåòñÿ îêíî, ñîäåðæàùåå ëîãîòèï ïðèëîæåíèÿ è ñâåäåíèÿ îá àâòîðå About dialog (Î ïðîãðàììå) Ïðèëîæåíèå ñîäåðæèò äèàëîãîâîå îêíî Î ïðîãðàììå, â êîòîðîì áóäåò îòðàæàòüñÿ ëîãîòèï ïðèëîæåíèÿ è ñâåäåíèÿ î ðàçðàáîò ÷ èêàõ Quick start (Áûñòðûé ñòàðò) Ïðîåêò ñîäåðæèò äèàëîãîâîå îêíî Quick start, â êîòîðîì îïðåäåëÿþòñÿ ïðàâà äîñòóïà ê äîêóìåíòàì ïðèëîæåíèÿ è îñòàëüíûì ôàéëàì User logins (Îêíî ââîäà ïàðîëÿ) Ïðè óñòàíîâëåííîì ôëàæêå â ïðîåêò äîáàâëÿåòñÿ ôîðìà, ïðåäíàçíà ÷ åííàÿ äëÿ ââîäà ïàðîëÿ when starting the application The Icon area allows you to define the application icon. Assigning Information about Project Developers The Credits tab (Figure 3.11) of the Application Builder dialog box contains the following information: list of authors, company name, version number, rights, and trademark of the application. 50 Chapter 3 Fig. 3.11. Credits tab of the Application Builder dialog box. To enter this data, use the fields (Table 3.7). Table 3.7. Íàçíà ÷ åíèå ïîëåé âêëàäêè Credits äèàëîãîâîãî îêíà Application Builder Ïîëå ââîäà Íàçíà ÷ åíèå Author (Àâòîð) Ñïèñîê ðàçðàáîò ÷ èêîâ ïðèëîæåíèÿ Company (Ïðåäïðèÿòèå) Íàèìåíîâàíèÿ ïðåäïðèÿòèÿ Version (Âåðñèÿ) Âåðñèÿ ïðèëîæåíèÿ Copyright (Ïðàâà) Ïðàâà ïî èñïîëüçîâàíèþ ïðèëîæåíèÿ Trademark (Òîðãîâàÿ ìàðêà) Òîðãîâàÿ Application Brand Formation of the List of Databases and Tables Used in the Application The Application tab of the Application, the Data Builder (Fig. You can add both new and existing databases and tables to the list presented on the tab in tabular form (Table 3.8). Table 3.8. Íàçíà ÷ åíèå ñòîëáöîâ âêëàäêè Data äèàëîãîâîãî îêíà Application Builder Ñòîëáåö Íàçíà ÷ åíèå Datasource (Èñòî ÷ íèê äàííûõ) Èìÿ òàáëèöû Form (Ôîðìà) Ñîäåðæèò ôëàæîê, óñòàíîâêà êîòîðîãî óêàçûâàåò íà íåîáõîäèìîñòü àâòîìàòè ÷ åñêîãî ñîçäàíèÿ ôîðìû äëÿ äàííîé òàáëèöû Report (Îò ÷ åò) Ñîäåðæèò ôëàæîê, óñòàíîâêà êîòîðîãî óêàçûâàåò íà íåîáõîäèìîñòü àâòîìàòè ÷ åñêîãî ñîçäàíèÿ îò ÷ åòà äëÿ äàííîé òàáëèöû Ïðîåêò êàê ñðåäñòâî îáúåäèíåíèÿ ýëåìåíòîâ ïðèëîæåíèÿ 51 Ðèñ. 3.12. Data tab of the Application Builder dialog box To add tables to the project, delete them and other actions above them, the tab contains the following buttons (Table 3.9). Table 3. 9. Íàçíà ÷ åíèå êíîïîê âêëàäêè Data äèàëîãîâîãî îêíà Application Builder Êíîïêà Íàçíà ÷ åíèå Çàïóñêàåò ìàñòåð áàç äàííûõ, êîòîðûé ñîçäàåò äëÿ ïðîåêòà íîâóþ áàçó äàííûõ Çàïóñêàåò ìàñòåð òàáëèö äëÿ ñîçäàíèÿ íîâîé òàáëèöû Select (Âûáðàòü) Îòêðûâàåò äèàëîãîâîå îêíî äëÿ âûáîðà óæå ñóùåñòâóþùåé áàçû äàííûõ èëè òàáëèöû Clear (Î ÷ èñòèòü) Î ÷ èùàåò äèàëîãîâîå îêíî îò òàáëèö, êîòîðûå áûëè äîáàâëåíû â ïðîåêò Generate (Ïîñòðîèòü) Ïðè íàæàòèè êíîïêè ïðîèñõîäèò äîáàâëåíèå â ïðîåêò âñåõ ðàçìåùåííûõ íà âêëàäêå òàáëèö, îñóùåñòâëÿåòñÿ ñîçäàíèå ôîðì è îò ÷ åòîâ äëÿ òåõ òàáëèö, â êîòîðûõ óñòàíîâëåíû Matching flasks. After all the work done in the table list, you can set the style for the forms created by the project wizard using the Form Style drop-down list located directly below the table. In fig. Figure 3.13 shows a shape created using the Embossed style. When creating a report, as when creating a form, you can apply different styles. Use the Report Style drop-down list to set the style of the report. 52 Chapter 3 Fig. 3.13. Forms created with the use of the Embossed style. Formatting the list of project shapes The Forms tab (Fig. 3.14) is intended for creating a list of project forms. Fig. 3.14. Forms tab of the Application Builder dialog box If the corresponding checkboxes were selected for the tables included in the project in the Form column of the Data tab and the Generate button was clicked. will appear in the list of forms on the Forms tab. You can add previously created forms to this list using the Open dialog box that appears when you click the Add button. In the right part of the tab there is a Name input field, which contains the name of the form, and checkboxes that determine the main properties of the forms (Table 3.10). Table 3.10. Íàçíà ÷ åíèå ôëàæêîâ âêëàäêè Forms äèàëîãîâîãî îêíà Application Builder Ôëàæîê Íàçíà ÷ åíèå Single instance (Îäèí ýêçåìïëÿð) Ïîëüçîâàòåëü ñìîæåò îòêðûòü ôîðìó â ïðèëîæåíèè íå áîëüøå îäíîãî ðàçà Use Navigation toolbar (Èñïîëüçîâàòü ïàíåëü íàâèãàöèè) Ïðè îòêðûòèè ôîðìû íà ýêðàíå ïîÿâëÿåòñÿ ïàíåëü èíñòðóìåíòîâ, ïîçâîëÿþùàÿ ïåðåìåùàòüñÿ ïî Record Use Navigation menu

    Lyudmila Omelchenko Daria Shevyakova SELF-TEACHER St. Petersburg "BHV-Petersburg" 2005 UDC 681.3.068 + 800.92 Visual FoxPro 9 LBC 32.973.26-018.1 O-57 Omelchenko L. N., Shevyakova D. A. O-57 Self-instruction manual Visual FoxPro 9.0 ... - SPb .: BHV-Petersburg, 2005 .-- 608 p .: ill. ISBN 5-94157-632-3 Considered Visual FoxPro 9.0 - a powerful software package designed to build professional database applications. An integrated application development environment and the creation of basic objects such as classes, tables, queries, forms, reports with its help are described. Export and import of data, as well as publication of data on a Web server are considered. Shows how to design, build, and test client-server applications. Attention is paid to the features of the next version of the popular package, as well as additional capabilities for working with XML Web services and interaction with other applications (Microsoft Visual Studio .NET and Microsoft SQL Server 2000). Numerous examples and illustrations will help you quickly master and successfully apply the presented material in practice. For programmers and database developers UDC 681.3.068 + 800.92 Visual FoxPro 9 LBC 32.973.26-018.1 Group of preparation of the publication: Editor-in-chief Deputy. ch. editor Head. editorial office Editor DTP Proofreader Cover design Head. production Ekaterina Kondukova Igor Shishigin Grigory Dobin Natalia Dovgulevich Natalia Karavaeva Victoria Piotrovskaya Igor Tsyrulnikova Nikolay Tverskikh License ID No. 02429 dated 24.07.00. Signed for printing on 18.03.05. Format 70 1001/16. Offset printing. CONV. print l. 49. Circulation 5000 copies. Order No. "BHV-Petersburg", 194354, St. Petersburg, st. Yesenin, 5B. Sanitary and Epidemiological Conclusion for Products No. 77.99.02.953.D.006421.11.04 dated 11.11.2004 issued by the Federal Service for Supervision of Consumer Rights Protection and Human Welfare. Printed from finished transparencies in the State Unitary Enterprise "Printing House" Nauka "199034, St. Petersburg, 9 line, 12 ISBN 5-94157-632-3 © Omelchenko L. N., Shevyakova D. A., 2005 © Design, publishing house" BHV- Petersburg ", 2005 CONTENTS INTRODUCTION ............................................ .................................................. ............. 1 How to use this book ................................. .................................................. ................. 2 How the book is structured ............................. .................................................. ............................ 2 Special elements of the book. .................................................. ......................................... 3 CHAPTER 1. GETTING STARTED WITH VISUAL FOXPRO. .................................................. ... 5 Modern relational DBMS ........................................... .......................................... 7 Visual FoxPro Objects ... .................................................. ................................................. 10 What's New in Visual FoxPro 9.0 ........................................... ............................ 12 CHAPTER 2. GETTING STARTED WITH VISUAL FOXPRO ............. .................................. 15 Starting Visual FoxPro ............ .................................................. ............................................ 15 The main window of Visual FoxPro. .................................................. ........................................... 15 Task Tray Manager ... .................................................. ................................. .............. 27 Visual FoxPro Help System ............................... .................................................. .. 30 CHAPTER 3. THE PROJECT AS A MEANS OF COMBINING THE ELEMENTS OF THE APP ...................................... ..................... 39 Creating an application project ......................... .................................................. .............. 39 Menu-driven project management .............................. ........................................... 45 Project element management ... .................................................. ................................. 46 Using the wizard to create a project ........... .................................................. . 47 CHAPTER 4. CREATING THE PROJECT DATABASE ......................................... .... 57 Creating a Database in the Project Window ....................................... ..................................... 57 Creating a database outside the project ....... ........................................ .................................. 61 Tables - the basis of the database .......... .................................................. .......................... 62 Table designer window .................... .................................................. .......................... 68 Indices ...................... .................................................. .................................................. .... 78 Relationships between tables ............................. .................................................. ............ 82 Data Integrity ................................... .................................................. ..................... 85 IV Contents CHAPTER 5. FORM AS A MEANS OF ENTRYING AND EDITING DATA ................ ........................................ 89 Creating a form using the wizard .... .................................................. ....................... 90 Starting the form ........................ .................................................. ........................................... 97 Shape Objects ... .................................................. .................................................. .......... 97 Actions performed with form objects ................................. .............................. 101 Changing the sequence of entering information in the form fields ............ .............. 105 CHAPTER 6. FORM DESIGNER .............................. ....................................... 109 Window form constructor ................................................ ................................................ 109 Creation forms ................................................. .................................................. ........... 113 Configuring Shape Parameters ................................... .................................................. ... 114 Form Environment ........................................... .................................................. .... 116 Procedure for setting shape parameters ............................. 122 Placing objects in the shape ... .................................................. ................................ 123 CHAPTER 7. CREATING AND PRINTING REPORTS .......... ........................................... 157 What is a report ... .................................................. .................................................. .......... 157 Recommendations for creating a report ................................... ......... .................................... 157 Reporting tools .......... .................................................. .................................. 158 Using the Wizard to Create a Single Table Report ......... .......................... 158 Viewing the prepared report .................... .................................................. ........... 168 Print report .................................... ............................................ .................................... 169 CHAPTER 8. CREATING A REPORT USING THE REPORT DESIGNER .... .................................................. ......... 173 Report Designer Window ..................................... .................................................. ..... 173 Using the Quick Report Command to Place Fields .................................... 175 Setting the environment for the report .............................................. ................................. 179 Properties of report objects ............. .................................................. ................................. 182 Placing objects in the report ............ .................................................. ......................... 188 Adding Title and Totals Areas to the Report ................. ........................................ 200 Creating a simple report ...... .................................................. ....................................... 201 Create a report in a free th form ................................................ ............................. 203 Creating a tabular report ................. .................................................. ........................ 205 Grouping data in the report ..................... .................................................. .................. 207 Using variables in the report ........................... .................................................. 211 Report Page Layout .............................................. ................................................. 213 Multi-column report ................................................ ................................................. 215 CHAPTER 9. DATABASE INQUIRIES ........................................... .................. 217 Query Builder ............................. .................................................. ...................... 218 Formation of the list of fields of the resulting query table ..................... ........ .. 221 Order By Tab of the Query Builder .......................................... ............................ 225 Setting conditions for selecting records ................ .................................................. .......... 227 Multi-table queries ..................................... .................................................. ........ 233 Grouping of request fields ...................................... .................................................. ... ... 237 Changing the names of fields in the request ......................................... ......................... 241 Table of Contents V CHAPTER 10. CROSS TABLES AND DIAGRAMS ............... ............... 243 Cross tables ................................ .................................................. .................. 243 Data export ............................. .................................................. ................................ 254 Building diagrams ............... .................................................. ..................................... 254 CHAPTER 11. APPLICATIONS MENU ....... .................................................. ......... 261 Preparing to create a menu .................................... .................................................. .. 261 Actions required to create a menu ......................................... ....................... 262 Launching the menu builder ....................... ............................................ .......................... 262 Menu creation ..................... .................................................. .......................................... 264 Saving, generating and launching menus. .................................................. ...................... 278 Creating a pop-up menu ........................ .................................................. ............ 279 CHAPTER 12. CREATING THE APP HELP SYSTEM ............... 281 Status bar ............ .................................................. ............................................... 281 Using the Dialogue windows ................................................. .................................. 282 Creating an HTML Help System ......... ............................................... 285 Using the reference systems in applications ............................................... ... 293 CHAPTER 13. PROJECT MANAGEMENT AND CREATING AN APPLICATION ......... 297 Defining window properties project ................................................. .............................. 297 Setting project parameters ................ .................................................. ......................... 299 Installing the main program of the project .................... .................................................. 302 Using the Exclude Option .............................................. .......................................... 303 Clearing a project from deleted files. .................................................. ...................... 303 Building the project ......................... .................................................. .............................. 303 Visual FoxPro Component Gallery ............... .................................................. .............. 306 CHAPTER 14. VERIFICITY CONDITIONS, STORED PROCEDURES, TRIGGERS, REPRESENTATION OF DATA ...................... ................ 315 Conditions for the validity of data entry at the record level .......................... ................. 315 Conditions for the validity of data entry at the table field level ........................ ........ 323 Using Data Views ...................................... ................................... 325 CHAPTER 15. ADVANCED DATA ENTRY FACILITIES ....... ....................... 337 Displaying data in a tabular form ................... ...................................... 337 Creating a Tabbed Form ....... ............................... .................................................. 356 Form Set ............................................... .................................................. ..................... 360 Timer ........................... .................................................. .................................................. 361 Adding data to the list ............................................. ............................................ 364 CHAPTER 16. CLASS LIBRARIES AND ACTIVEX COMPONENTS ................. 367 Using Class Libraries ......................... .................................................. ..... 367 Using ActiveX-components in the form ...................................... ....................... 374 Using the Object Browser ....................... .................................................. ........ 390 CHAPTER 17. ADVANCED REPORTING TOOLS ..................... 395 Using Data Views in Reports ....... ..................... ............................. 395 Labels ................... .................................................. .................................................. .... 396 Using a one-to-many relationship in reports .................................. .......... 404 VI Table of Contents CHAPTER 18. ADVANCED FACTORS OF DATA ... 409 Output of query results ... .................................................. ..................................... .... 409 Saving query results in HTML format ....................................... .............. 412 Using the Select command in programs .............................. ................................. 414 CHAPTER 19. VISUAL OBJECT-ORIENTED PROGRAMMING ........ .................................................. ........ 419 Using classes ....................................... .................................................. .......... 419 Using nested objects .................................... ......................................... 434 Custom Classes ...... .................................................. ........................................ 437 Viewing information about a class and defining an icon for it designations .......... 447 Formation of the list of libraries used in constructors of forms and classes ............................ .................................................. ...... 450 Create User-Based Forms classes ................................................ .. 450 Using a Form to Create a Class .......................................... ....................... 454 Class Browser ....................... .................................................. ............................ 455 Creating a toolbar .................. .................................................. ................. 458 CHAPTER 20. MULTIPLAYER WORK IN THE LOCAL NETWORK ........................ ............................................... 463 Locking types .................................................. .................................................. ......... 463 Automatic blocking ...................................... .................................................. .... 463 Full table lock and change lock ... ....... 465 Locking a table ........................................ ...................................... .......................... 466 Locking records ..................... .................................................. .................................. 466 Unlocking tables and records .......... .................................................. ............... 468 Data sessions .............................. .................................................. .............. 469 Using buffers ................................. ...................... ........................................... 470 Using transactions ... .................................................. ....................................... 474 CHAPTER 21. LINKING AND IMPLEMENTATION OF OBJECTS, EXPORT AND IMPORT OF DATA ................................................ ..................... 475 Visual FoxPro and OLE Objects ...................... .................................................. ................. 475 Linking an OLE Object ............................ .................................................. .................. 481 Editing an OLE Object ........................... .................................................. ............ 484 Deleting an OLE Object ................................. .................................................. ................. 484 Using Object-Oriented Programming ........................... ... 484 Transferring Data from Visual FoxPro to Other Applications ...................................... ..... 486 Import Data oops ................................................. .................................................. ............. 488 Using data from Visual FoxPro in Microsoft Word ............................ ............. 491 CHAPTER 22. REMOTE DATA REPRESENTATIONS .............................. ..... 497 Defining an ODBC Data Source ........................................ ................................ 497 Named Connection ............... .................................................. .............................. 500 Connection constructor ................. .................................................. ............................. 500 Configuring Remote Views and Connections in the Options Dialog Box .......... .................................................. ................................... 503 Creating a Remote Data View .......... .................................................. ... 505 Table of Contents VII Shared Connections ... .................................................. .................... 513 Combination in the presentation of local and remote data ...................... ... 514 Customizing a View Using a Database Dictionary ... 516 CHAPTER 23. DATA TRANSFER FROM VISUAL FOXPRO TO CLIENT-SERVER PLATFORM ..................................... .......... 519 Using the Growth Wizard to Migrate Data to a SQL Server Database ............. .................................................. ................................. 519 CHAPTER 24. PUBLICATION OF DATA ON THE WEB-SERVER ....... .......................... 531 Web Publishing Wizard .................... .................................................. ................................ 531 Configuring Web Page Settings Using the Wizard ......... ............................... 535 Creating a Web page .............. .................................................. ................................. 539 Editing the created Web page ........... .................................................. ...... 543 CHAPTER 25. CONFIGURING VISUAL FOXPRO PARAMETERS ................................ 545 Window Tab Parameters Options ................................................. ................................... 546 APPENDIX. INSTALLING VISUAL FOXPRO .............................................. 573 System requirements ............................................... .................................................. ..... 573 Installing Visual FoxPro ......................................... .................................................. ....... 573 Customizing Visual FoxPro ....................................... .................................................. ........ 575 GLOSSARY ........................................ .................................................. ........... 579 INDEX .................................... ........................................ 589 VIII CONTENTS INTRODUCTION In recent years, rumors have sprung up from time to time that Microsoft will no longer support the Visual FoxPro software product. But again they turn out to be the intrigues of ill-wishers. And the next new version of Visual FoxPro 9.0 is a direct confirmation of this. Despite the emergence of new database management systems, Visual FoxPro continues to be one of the most popular programs in this area. This is primarily due to the fact that when creating new versions, Microsoft maintains compatibility with previous versions. Therefore, the applications you create can be used in the future. Visual FoxPro implements all the attributes of relational database management systems. The database maintains data integrity using primary keys and relationships between tables. You can use triggers and stored procedures to handle events for adding, deleting, or modifying table records using the database itself. Visual FoxPro is an object-oriented, visual-programmable, event-driven language that fully meets the new requirements for modern software design and implementation tools. Visual FoxPro can be used by users of different skill levels. If you are just starting to master Visual FoxPro and you need to develop a simple application as soon as possible, the wizards for creating databases, tables, applications, forms, reports, etc. will help you. For the development of large and complex projects, appropriate designers and an object-oriented language are used , which allows you not only to use base Visual FoxPro classes and external libraries, but also to create custom classes. This book is of interest both for beginners familiar with Visual FoxPro 9.0, and for those with experience with this system of developers. The book sequentially describes the entire process of creating complete applications: creating a database and its tables, designing forms for entering and viewing data, creating queries and reports, as well as other means of displaying and processing database information. The book contains a large number of illustrations that will help you get acquainted with the material presented in it. 2 INTRODUCTION HOW TO USE A BOOK If you are just starting to learn Visual FoxPro, the chapter order suggested will allow you to go from easy to difficult to learn this software. If you are familiar with Visual FoxPro, you do not need to read the book from start to finish. In the table of contents of the book, you can see which chapters are of most interest to you, and study only them. You can learn a lot by just skimming through the book. It has specially highlighted moments that will catch your eye when you scroll through it. How to build a book The book assumes a sequential study of material from simple to complex. Chapters 1 and 2 of the book are introductory. You will learn how to start Visual FoxPro, how to get help in it, get acquainted with the elements of the main program window and what is new in Visual FoxPro 9.0 compared to previous versions. In Chapter 3, you will learn about the project, which is a means of combining elements of an application. After completing Chapter 4, you will learn how to create a database, its tables, indexes, relationships between tables, and determine data integrity conditions. Chapters 5 and 6 explore how to create forms for entering and editing data using a wizard and form designer. Chapters 7 and 8 focus on designing simple reports. After reading Chapter 9, you can create a query of any complexity. Chapter 10 introduces you to creating crosstabs and charts. The application uses a menu to launch forms, reports and programs. Chapter 11 talks about creating such an application menu. After reviewing the first eleven chapters and analyzing the examples presented to your attention, you can create applications yourself. The following chapters build on the knowledge gained in the first chapters and are devoted to advanced tools for creating forms, queries, reports. Chapter 12 discusses how to develop an effective HTML help system for your application. Chapter 13 discusses some additional project management issues, including creating an executable (exe) file. Chapters 14 through 18 discuss advanced database management, multi-tabular forms and reports, and the use of ActiveX components in forms. Chapter 19 introduces you to the object-oriented approach to building database applications. You will learn how to create classes and objects based on them. Chapter 20 is devoted to the work of Visual FoxPro on a local network. INTRODUCTION 3 Visual FoxPro is not an isolated system and can effectively interact with other Windows applications. After reading Chapter 21, you will learn how to work with compound objects (OLE), export and import data. You will learn how to install the ODBC driver, how to create a remote data view and configure its parameters in Chapter 22. Chapter 23 introduces you to porting data from Visual FoxPro to a client / server platform using the Growth Wizard. Visual FoxPro has the ability to generate a Web page using the information contained in the database. This is discussed in Chapter 24. To work effectively with Visual FoxPro, you use the parameters that are discussed in the last chapter of the book. The appendix walks you through installing Visual FoxPro 9.0. The book also contains a glossary describing Visual FoxPro terms. Special Elements of the Book There are many special inserts in the book that are highlighted in a special way. They contain additional information to make it easier to read and find information: NOTE Notes refer to the consequences of certain actions. NOTE Tips provide some tips you need to know to get the most out of Visual FoxPro. NOTICE Warnings should help you avoid problems. They tell you what to fear and what to do to avoid mistakes. The book uses different types of fonts: new terms are in italics; the text that you must enter from the keyboard is in bold italic; menu commands, names of buttons, tabs, options, check boxes, dialog boxes, areas, etc. are in bold; names of functions, properties, methods, databases, tables, table fields are in monospaced font. The two keys connected by a plus sign is a key combination. Press the first key and, without releasing it, press the second. Then release both. The authors express their gratitude to the publishing house "BHV-Petersburg" for long-term fruitful cooperation and assistance in the preparation and writing of the book. 4 Introduction Chapter 1 About Visual FoxPro The changes taking place in our country in recent years could not but affect the fields of informatics and computer technology. Until ten years ago, working with databases was the lot of professional programmers. The systems themselves were not designed for the common user. The main consumer of such systems was the military-industrial complex. With the emergence of banks, joint-stock companies, private companies, databases have found wider application. People understand that information is money. Losing it or getting it late can be costly. This can explain the rapid growth of information technology and the rapid development of database management systems (DBMS). Relational Databases The first database management systems emerged in the mid-1960s and supported a hierarchical data model in which parent / child relationships existed between records. Within a short time, network databases were developed based on a much more complex network model. Each of these models had advantages and disadvantages that played a key role in the development of the relational model. In 1970, an article by IBM researcher Dr. E. F. Codd on the relational data model revolutionized the way we store and process information. The first relational databases were developed on the basis of this model in the seventies of the last century, and now they are considered as the standard for modern commercial DBMS. In relational databases, all information is summarized in tables, the rows and columns of which are called records and fields, respectively. These tables were called relations1, so the model was called relational. Entries in tables are not repeated. Their uniqueness is provided by a primary key containing 1 Relationship - a mathematical term from set theory, which formed the basis of the relational data model. In English, the word "relation" corresponds to the word "relation", hence the name "relation". - Ed. Chapter 1 6 is a set of fields that uniquely identify a record. To quickly search for information in the database, indexes are created on one or more fields of the table. Index values ​​are stored in an ordered manner and contain references to table records. Primary and foreign keys are used to automatically maintain the integrity of related data in different tables. To fetch data from multiple related tables, the values ​​of one or more of the matching fields are used. For example, the registration table is long-distance calls can contain the following information: Íîìåð çàêàçà Êîä óñëóãè Íîìåð òåëåôîíà Äàòà ðàçãîâîðà Êîä ãîðîäà Ïðîäîëæèòåëüíîñòü ðàçãîâîðà Ñòîèìîñòü Ïðèìå ÷ àíèå Records of long-distance calls are recorded in the registration book, as a table in chronological order (Figure 1.1.). Each line has the same structure and consists of eight fields. In this example, these are the following fields: Order number, Service code, Phone number, Call date, City code, Call duration, Cost. Fig. 1.1. LOGGING INTERMEDIATE SPOTS BY ARRAY In relational databases, fields can have different data types (numeric, string, date type, etc.), but for each record, the data type of the field remains the same. One of the important advantages of the database is the fast retrieval of the information stored in it. Using the telephone address book, in which the data is sorted by last name, you can find a phone number by the last name of its owner. However, if the long distance book entries are ordered chronologically, you will have to spend a significant amount of time getting Visual FoxPro 7 a list of customers who have ordered a call to a specific city, or figuring out which area the most profitable subscribers live in. telephone company with long conversations. Computer databases come to the rescue. They, despite the huge amount of information stored in them, provide a high speed of searching for the necessary information. In such databases, the user can search for any parameter of interest. Moreover, computer databases are very compact. A database containing several thousand records can fit on one floppy disk. Database management systems are used to create a database, change its structure, edit and retrieve data. Modern relational database management systems contain: a set of tools for creating tables and relationships between related tables; database administration tools; developed user interface that allows you to access information stored in the database; development tools for applications using databases. In fig. 1.2 shows an example of long distance telephone call accounting using two relational database tables in Visual FoxPro. Fig. 1.2. Reads Intermediate Phone Speakers Using the Television Tables Chapter 1 8 Fig. 1.3. Reading in the standard video, containing information about the customers of the telephone company Fig. 1.4. Information Writing, Reference Information With Visual FoxPro 9 Fig. 1.5. Graphical presentation of information about the number of hardware. For example, you can get information about all long-distance calls of a certain customer for any period of time; print the entire table or just selected records and fields in various formats. For example, in Fig. 1.3 shows a tabular report containing the addresses of the telephone company customers. In fig. 1.4 shows one of the variants of a newsletter containing the names and surnames of clients from the same table; display database information graphically. For example, in Fig. 1.5 data on the number of long-distance calls for clients are displayed in the form of a diagram; carry out the necessary calculations when generating reports and selecting data from tables. Currently, there are more than ten popular DBMS for personal computers. Traditionally, one of the most widespread in Russia and the CIS countries is the Visual FoxPro DBMS, the new version of which, Visual FoxPro 9.0, contains additions and improvements that expand the capabilities of the system. 10 Chapter 1 Visual FoxPro Objects Visual FoxPro consists of individual components that are used to store, display, and edit information. In Visual FoxPro, all information is stored in a database, which consists of tables, relationships between tables, indexes, triggers, and stored procedures. Each table has a unique name and is stored in a separate file, the name of which is the same as the name of the table. The created file has the dbf extension. Each table you create can have indexes associated with it, which are used to organize data and quickly find the records you need, and one table can have multiple indexes. Separate files are used to store the values ​​of the Memo and General fields. Memo fields of tables contain textual information, and fields of type General are used, as a rule, to store binary information and data of other applications running in the Windows environment. Visual FoxPro implements triggers that allow you to centrally process events that occur when any changes to the database are made. You can also create stored procedures that are part of the database and can be used to describe tables, validate input data, define default values, and so on. Data views are an extremely convenient and useful means of accessing a database. Data views allow you to combine table data and display it in a more convenient way. You can select only the table fields you are interested in, combine multiple fields into one field, calculate totals, and specify new table field names. Typically, the number of views in a database far outnumbers the number of tables. As the database is used, their number is constantly growing. In many information systems, access to data, including viewing, adding and editing, is carried out only through the use of data views. This approach allows for flexible control over access to information. When using views to select data in forms, reports, when creating queries, and in programs, the same rules apply as for tables. Editing the data included in the presentation is possible only under certain conditions. For example, if it is created based on only one table. Forms, reports, queries and programs are used to display and edit data. Designers are used to create forms, reports, and queries. Therefore, these components are often referred to as design objects. Forms and reports are composite objects because they are composed of smaller objects (such as fields, buttons, charts, frames, OLE components, etc.) which are called interface objects. Forms are used to view or enter data into tables. Data can be entered directly into tables, but using a form is a faster and more efficient way to enter. The form contains some or all of the table fields in which you enter information. You can use the Form Builder or the Form Designer to create forms. The Form Wizard contains a number of templates that define the relationship between the faces that are placed on the form in the Visual FoxPro 11 tabs, the way the data is displayed, and the order in which the fields are placed. A form designer is used to create complex shapes. Reports are used to print the information contained in the database. Examples of reports are price list of goods, list of buyers, turnover list. As a rule, reports are created in the event that information needs to be transmitted to someone in hard copy. To create reports in Visual FoxPro, just like for forms, you use a wizard and a report designer. Using the Report Wizard, you can quickly create your own report based on the templates available. Using the Report Designer allows you to create reports of arbitrary complexity, including multi-level data grouping and the placement of calculated fields. Queries are a means of fetching data from one or more tables. In Visual FoxPro, you can use either the Query Designer or the specialized Structured Query Language (SQL) to create a query. Query results can be displayed in a form, displayed as reports and charts, or saved in a table you specify. Programs written in the Visual FoxPro language are object-oriented. With the help of them, you process events in the form, create objects, perform various calculations, manage the database. For convenience, you can combine programs into libraries. To create forms in Visual FoxPro, you can use not only base classes, but also create your own. For example, you can define a form class that has a specific background color and a standard set of buttons for manipulating data. To standardize development, it is helpful to have one or more custom classes for each base class. Classes created in Visual FoxPro are stored in class libraries. To combine the components of the created application, a project is used, which includes all the components listed above. Using a project simplifies application development and maintenance. Each component is stored in a separate file, and the names of the files containing the main components you specify yourself, and the names of the files containing the objects associated with the table coincide with the name of the table. Based on the type of object it contains, Visual FoxPro automatically assigns an extension to each file to help identify the object. The list of file extensions is given in table. 1.1. Table 1.1. Ðàñøèðåíèÿ èìåí ôàéëîâ îáúåêòîâ Visual FoxPro Íàèìåíîâàíèå îáúåêòà Ðàñøèðåíèÿ Ïðîåêò prj, fpc, cat, pjx, pjt Áàçà äàííûõ dbc Òàáëèöà Visual FoxPro dbf Ñîñòàâíîé èíäåêñíûé ôàéë cdx Memo-ïîëå è ïîëå òèïà General frt Ãëàâà January 12 Òàáëèöà 1.1 (îêîí ÷ àíèå) Íàèìåíîâàíèå îáúåêòà Ðàñøèðåíèÿ Ôîðìà scx Çàïðîñ qpr Îò ÷ åò frx, frm Ïî ÷ òîâàÿ íàêëåéêà lbx, lbl ìåíþ mnx áèáëèîòåêà êëàññà vcx Ïðîãðàììà, áèáëèîòåêà ïðîãðàìì, òåêñò ìåíþ, prg, fxp, mpr, qpr òåêñò çàïðîñà Ðèñóíîê bmp, jpg, gif, ico, dib , cur, ani Recording wav This New Arrival in Visual FoxPro 9.0 Visual FoxPro is an ever-evolving system. Compared to the previous version, Visual FoxPro 9.0 takes one more step in expanding the system's functionality, improving the existing tools related to the development environment interface and error handling, adding new commands, base classes and functions, and expanding the existing ones. The new version has all the capabilities for working with XML Web services, as well as improved compatibility with Microsoft Visual Studio .NET and Microsoft SQL Server 2000. Visual FoxPro has extended table designer tools. New data types can be used for table fields: Binary Blob and Text Varbinary. The Blob data type is used for structures containing information about a data block. It is used to store binary information of any type, for example, ASCII characters, executable files, byte streams. The Varbinary data type contains hexadecimal values. It is similar to the Character type, but for data of this type, empty spaces are not filled with insignificant information. A new type of index, Binary, has been introduced, which is based on Boolean expressions and is used for both free tables and database tables. This index takes up significantly less space and therefore improves the speed of index use. Objects placed on the form have new properties. Let's consider the most interesting ones. The Anchor property sets the absolute and relative positions and sizes of the object relative to all four sides of the container object, solving the problem of automatically positioning and resizing objects on the form when it is resized when the Resize event occurs. About Visual FoxPro 13 The Rotation property of Label, Line, and Shape objects allows you to display labels for large objects of the EditBox class as text flowing from bottom to top. The AutoComplection property of the TextBox object allows you to remember the values ​​entered in the field and, when you enter a new value, to show this list for easier input. This property is useful when entering data in a field that has a small set of options. The AutoHideScrollBar property of the ListBox allows you to hide the scroll bar when all rows are visible and show it back when not all rows fit in the ListBox. The PictureMargin and PictureSpacing properties of the CommandButton, OptionButton, and CheckBox objects control the position of the image relative to the edge and text of the object. The MousePointer property for the columns (Column object) and headers (Header object) of the Grid object at the stage of class or form editing sets the required form of the mouse pointer when it enters the field of this object. The SET PATH TO command now has an ADDITIVE property that allows you to add new paths to existing ones, and the length of all paths has increased from 1024 to 4096. In the Project Manager, you can now execute the Modify command when you select a class library, and not a separate class of this library. Visual FoxPro 9.0 launches the Class Browser with the selected class library. Developers will be pleased with the changes in the report designer. Configuring all objects (location of an object in the report strip, style of design, printing conditions, protection against alteration) placed in the report is carried out using the properties dialog box. All parameters of the report itself (page layout, adding header and total areas to the report, grouping data, setting report variables, saving the report as a class) are also set using the Report Properties dialog box. The changes have been made to custom properties and methods. When you create new properties and methods, you can assign default / initial values ​​to them. Enhanced options for customizing Visual FoxPro, carried out from the Options dialog box, which is opened by the Options command from the Tools menu. Enlarged the list of file groups defined by the File Locations tab. The View tab now has a List display count that lets you set the maximum number of list items to display when using IntelliSense. The set of parameters set on the Reports tab has been significantly expanded. 14 Chapter 1 Chapter 2 Getting Started with Visual FoxPro You are getting started with Visual FoxPro 9.0. Many of the things you will have to work with (menus, toolbars, dialog boxes) will seem familiar because they are specific to the Windows environment. Starting Visual FoxPro To start the program from the Windows main menu, follow these steps: 1. Click the Start button located at the bottom of the screen. 2. In the opened Windows main menu, select the Programs command. The menu for this command appears. 3. Select the Microsoft Visual FoxPro 9.0 command from the menu. The main window of Visual FoxPro 9.0 will open on the screen (Fig. 2.1). TIP To launch Visual FoxPro 9.0 faster, you can create a shortcut on your desktop and assign keyboard shortcuts to it. Then it will be enough to press the specified key combination in any Windows window, and the program will start. In addition, for the convenience of launching the application, you can use the Windows Quick Launch bar by placing the Visual FoxPro program icon on it. Visual FoxPro Main Window 2.1 shows the main window of Visual FoxPro as it looks after starting the program. It has seven main objects: the window title, menu bar, toolbar, status bar, work area, Command window, and the Task Pane Manager dialog box. The title bar is at the top of the main window and contains three objects: a copy of the Visual FoxPro program icon, the title of the main window, and icons to control that window. The menu bar contains a hierarchical Visual FoxPro menu. The list of menu items depends on the type of active window. 16 Chapter 2 Fig. 2.1. Visual FoxPro 9.0 Main Window Visual FoxPro provides the user with a wide variety of toolbars for working with databases, forms, reports, and queries. These toolbars contain a set of buttons, and this set depends on the purpose of the particular toolbar. After starting Visual FoxPro, the standard toolbar is displayed on the screen. At the bottom of the main window there is a status bar, which displays information about the current state of the active window, a short description of the selected button on the toolbar or menu item. The information displayed in the status bar depends on the type of active window. For example, in the form designer window, the status bar displays the name of the active form object, and when viewing the table in Browse mode, the name of the open table is displayed on the left side of the status bar, and the number of the current record and the operating mode indicator in the middle of the status bar. In Visual FoxPro 9.0, the main window displays the Task Pane Manager by default. It contains a list of recently opened projects and databases, help launch commands and wizards for creating a database and project, examples that you can use in development, and useful links to sites on the Internet. Getting Started with Visual FoxPro 17 As you work, the main Visual FoxPro window opens windows for designers of forms, reports, queries, projects, and other windows. All of them are children of the main window and are closed when it is closed. In addition, if you did not close the project window you were working with when exiting Visual FoxPro, it will open by default in the main window the next time you start the program. System menus and system buttons The title of the main window contains a small copy of the program icon, the text "Microsoft Visual FoxPro" and buttons to control the size of the main window. When you click on the icon of the icon, a system menu opens, containing commands for moving and resizing the main window. Table 2.1 shows the commands available from the system menu. Table 2.1. Íàçíà ÷ åíèå êîìàíä ñèñòåìíîãî ìåíþ Êîìàíäà Íàçíà ÷ åíèå Âîññòàíîâèòü Âîññòàíàâëèâàåò ïðåäûäóùèé ðàçìåð îêíà ïîñëå ìèíèìèçàöèè èëè ìàêñèìèçàöèè Ïåðåìåñòèòü Àêòèâèçèðóåò ãëàâíîå îêíî Visual FoxPro è ïîçâîëÿåò ïåðåìåùàòü åãî ñ ïîìîùüþ êëàâèø ïåðåìåùåíèÿ êóðñîðà Ðàçìåð Àêòèâèçèðóåò ãëàâíîå îêíî Visual FoxPro è ïîçâîëÿåò èçìåíÿòü åãî ðàçìåðû ñ ïîìîùüþ êëàâèø ïåðåìåùåíèÿ êóðñîðà Ñâåðíóòü Ñâåðòûâàåò ãëàâíîå îêíî FoxPro äî ðàçìåðà êíîïêè è ïîìåùàåò åå íà ïàíåëü çàäà ÷ windows Ðàçâåðíóòü Ðàçâåðòûâàåò ãëàâíîå îêíî Visual FoxPro âî âåñü ýêðàí Çàêðûòü Çàêðûâàåò ãëàâíîå îêíî ïðîãðàììû Visual FoxPro TIP to quickly close the Visual FoxPro program, double-click on a small copy of the application icon in the header of the main window ... To quickly restore / maximize the main window, double-click on the title bar. The Microsoft Visual FoxPro text of the main window title can be easily changed, if necessary, by assigning any other name to the main Visual FoxPro window, or by removing the name altogether. To do this, enter the following command in the command window: MODIFY WINDOW SCREEN TITLE "(! LANG: New title of the main window" или _SCREEN.caption = "Новый заголовок главного окна" В правой стороне заголовка расположены кнопки управления окном. Их назначение описано в табл. 2.2. 18 Ãëàâà 2 Òàáëèöà 2.2. Íàçíà÷åíèå êíîïîê óïðàâëåíèÿ îêíîì Êíîïêà Íàçâàíèå Íàçíà÷åíèå Ñâåðíóòü Ñâîðà÷èâàåò ãëàâíîå îêíî FoxPro äî ðàçìåðà êíîïêè è ïîìåùàåò åå íà ïàíåëü çàäà÷ Windows Âîññòàíîâèòü îáðàòíî Óìåíüøàåò ðàçìåð ðàçâåðíóòîãî îêíà, ïîçâîëÿÿ â äàëüíåéøåì èçìåíÿòü åãî Ðàçâåðíóòü Ðàçâåðòûâàåò ãëàâíîå îêíî Visual FoxPro âî âåñü ýêðàí Çàêðûòü Çàêðûâàåò ãëàâíîå îêíî Visual FoxPro, òåì ñàìûì ïðåêðàùàÿ ðàáîòó ïðîãðàììû Çíàêîìñòâî ñî ñòàíäàðòíîé ïàíåëüþ èíñòðóìåíòîâ Visual FoxPro В Visual FoxPro имеется большое количество панелей инструментов, используемых при создании форм, отчетов и запросов. Подробно они будут рассмотрены в соответствующих главах. Сначала изучим стандартную панель инструментов (рис. 2.2), которая используется во всех режимах работы. Ðèñ. 2.2. Ñòàíäàðòíàÿ ïàíåëü èíñòðóìåíòîâ Visual FoxPro Назначение кнопок стандартной панели инструментов описано в табл. 2.3. Òàáëèöà 2.3. Íàçíà÷åíèå êíîïîê ñòàíäàðòíîé ïàíåëè èíñòðóìåíòîâ Êíîïêà Íàçâàíèå Íàçíà÷åíèå New (Íîâûé) Ïîçâîëÿåò ñîçäàòü íîâûé ôàéë (ïðîåêò, áàçó äàííûõ, òàáëèöó, çàïðîñ, ôîðìó, îò÷åò, êëàññ) Open (Îòêðûòü) Îòêðûâàåò ñóùåñòâóþùèé ôàéë Save (Ñîõðàíèòü) Ñîõðàíÿåò îòêðûòûé ôàéë Print One Copy (Ïå÷àòàòü îäíó êîïèþ) Ïå÷àòàåò ñîäåðæèìîå àêòèâíîãî îêíà Print Preview (Ïðîñìîòð ïå÷àòè) Îòêðûâàåò îêíî ïðåäâàðèòåëüíîãî ïðîñìîòðà ïå÷àòàåìîãî äîêóìåíòà Cut (Âûðåçàòü) Óäàëÿåò âûäåëåííûé òåêñò èëè âûäåëåííûå îáúåêòû è ïîìåùàåò èõ â áóôåð Copy (Êîïèðîâàòü) Êîïèðóåò â áóôåð âûäåëåííûé òåêñò èëè âûäåëåííûå îáúåêòû, íå óäàëÿÿ èõ Paste (Âñòàâèòü) Âñòàâëÿåò ñîäåðæèìîå áóôåðà. Äåéñòâèå ýòîé êíîïêè çàâèñèò îò òîãî, â êàêîì èç ðåæèìîâ âû ðàáîòàåòå Íà÷àëî ðàáîòû ñ Visual FoxPro 19 Òàáëèöà 2.3 (îêîí÷àíèå) Êíîïêà Íàçâàíèå Íàçíà÷åíèå Undo (Îòìåíèòü) Îòìåíÿåò âûïîëíåííûå äåéñòâèÿ Redo (Âîññòàíîâèòü) Âîññòàíàâëèâàåò îòìåíåííûå äåéñòâèÿ Run (Âûïîëíèòü) Çàïóñêàåò íà âûïîëíåíèå Modify Form (Ìîäèôèöèðîâàòü ôîðìó) Ïîçâîëÿåò ìîäèôèöèðîâàòü SÑX-ôàéë, ñâÿçàííûé ñ äàííîé ôîðìîé Databases (Áàçû äàííûõ) Ñîäåðæèò ñïèñîê îòêðûòûõ áàç äàííûõ Command Window (Êîìàíäíîå îêíî) Îòêðûâàåò êîìàíäíîå îêíî Data Session Window (Îêíî ñåàíñà äàííûõ) Îòêðûâàåò îêíî Data Session Properties Window (Îêíî ñâîéñòâ) Îòêðûâàåò îêíî Properties (Ñâîéñòâà), èñïîëüçóåìîå äëÿ íàñòðîéêè ñâîéñòâ Document View Window (Îêíî ïðîñìîòðà äîêóìåíòà) Îòêðûâàåò îêíî Document View (Ïðîñìîòð äîêóìåíòà), â êîòîðîì îòîáðàæàåòñÿ ñïèñîê ïðîöåäóð, ôóíêöèé îòêðûòîé â îêíå ðåäàêòîðà ïðîãðàììû Class Browser (Îáçîð êëàññîâ) Îòêðûâàåò îêíî Class Browser (Îáçîð êëàññîâ), ïðåäíàçíà÷åííîå äëÿ ðàáîòû ñ êëàññàìè Object Browser (Îáçîð îáúåêòîâ) Îòêðûâàåò îêíî Object Browser (Îáçîð îáúåêòîâ), ïîçâîëÿþùåå ïðîñìàòðèâàòü êëàññû, ñâîéñòâà, ìåòîäû, ñîáûòèÿ è êîíñòàíòû âûáðàííûõ áèáëèîòåê Task Pane (Ïàíåëü çàäà÷) Îòêðûâàåò îêíî Task Pane Manager (Ìåíåäæåð ïàíåëè çàäà÷) Toolbox (Èíñòðóìåíòàðèé) Îòêðûâàåò îêíî Toolbox (Èíñòðóìåíòàðèé), ñîäåðæàùåå ýëåìåíòû, êîòîðûå èñïîëüçîâàëèñü ðàçðàáîò÷èêîì ïðè ñîçäàíèè ïðèëîæåíèÿ ЗАМЕЧАНИЕ Если по внешнему виду кнопки вы не можете определить ее назначение, установите указатель мыши на кнопку. При этом под курсором появится всплывающая подсказка с ее наименованием, а в левой части строки состояния будет выведено краткое описание указанной кнопки. По умолчанию в главном окне программы Visual FoxPro всегда присутствует стандартная панель инструментов. Если она не отображается на экране, выполните следующие действия: 1. Выберите в меню View (Вид) команду Toolbars (Панели инструментов). Откроется диалоговое окно Toolbars (рис. 2.3), в котором расположен список всех панелей инструментов программы Visual FoxPro. 20 Ãëàâà 2 2. Установите флажки слева от наименований тех панелей, которые необходимо разместить в главном окне. 3. Нажмите кнопку OK. Используя флажки, расположенные в нижней части диалогового окна Toolbars (Панели инструментов), можно изменить вид кнопок панелей инструментов. Назначение этих флажков описано в табл. 2.4. Òàáëèöà 2.4. Íàçíà÷åíèå ôëàæêîâ äèàëîãîâîãî îêíà Toolbars Óñòàíîâêà ôëàæêà Íàçíà÷åíèå Color buttons (Öâåòíûå êíîïêè) Êíîïêè íà ïàíåëè èíñòðóìåíòîâ ñòàíîâÿòñÿ öâåòíûìè Large buttons (Áîëüøèå êíîïêè) Óâåëè÷èâàåòñÿ ðàçìåð êíîïîê ToolTips (Ïîäñêàçêà) Âûâîäèòñÿ êðàòêîå îïèñàíèå êíîïêè ïðè óñòàíîâêå êóðñîðà íà íåå Ðèñ. 2.3. Äèàëîãîâîå îêíî Toolbars После установки Visual FoxPro стандартная панель инструментов размещается в верхней части главного окна, но она, как и все остальные панели инструментов, может перемещаться в любое место экрана. Для этого нужно установить курсор мыши в любое свободное от кнопок место на панели инструментов, нажать кнопку мыши и, не отпуская ее, переместить панель на новое место. Если поместить панель инструментов не по краю главного окна Visual FoxPro, то можно изменять ее размер (рис. 2.4). Íà÷àëî ðàáîòû ñ Visual FoxPro 21 Ðèñ. 2.4. Ïàíåëü èíñòðóìåíòîâ ìîæíî ðàñïîëîæèòü â ëþáîì ìåñòå ãëàâíîãî îêíà Êðàòêèé îáçîð ìåíþ Visual FoxPro При работе с Visual FoxPro можно использовать как кнопки панели инструментов, так и строку меню, все команды которого являются иерархическими. При выборе определенной команды открывается ее подменю. При отсутствии в главном окне Visual FoxPro других открытых окон, строка меню содержит пункты File (Файл), Edit (Правка), View (Вид), Tools (Инструменты), Program (Программа), Window (Окно) и Help (Справка). При открытии окон в меню добавляются команды, применимые только к объектам данного окна. Например, при работе с таблицами в главное меню добавляется пункт меню Table (Таблица), при открытии на экране формы в меню появляется пункт Form (Форма). ЗАМЕЧАНИЕ При выборе команды в строке состояния появляется ее краткое описание. 22 Ãëàâà 2 Âûïîëíåíèå êîìàíä ìåíþ Выполнение команд меню в Visual FoxPro осуществляется стандартными для Windows действиями. Перечислим возможные способы. При использовании мыши достаточно установить курсор на пункт меню, содержащий выбираемую команду, и нажать кнопку мыши. Если команда содержит подменю, следует выбрать в нем требуемую команду. При использовании клавиатуры сначала нужно активизировать строку меню нажатием клавиши !} or ... Then set the pointer to the required command using the keys<←>, <→> , <> , <↓>and press ... Key<←>used to move to the command to the left of the current one. Pressing this key when the current command is the leftmost one will take you to the system menu. Further key press<←>will set the pointer to the rightmost command on the menu bar. The rest of the keys are used in the same way. For the most frequently executed commands, you can remember the associated "hot" keys, which consist of a combination of the character and an underlined character in the command name. No key press required when using hotkeys ... Disabling the menu command If the menu bar is activated, but you want to refuse to execute the menu command, you should use one of the following methods: press the key ; click anywhere in the main Visual FoxPro window. To return from the submenu to the menu of the previous level, press the key ... File Menu Commands The File menu contains commands related to accessing files. These commands allow you to create new files of different types, open existing files, close, save and print them. The Save As HTML command opens a corresponding dialog box that allows you to save the current form, menu, report, or table in HTML (HyperText Markup Language) format. The Revert command is very convenient, it allows you to undo all changes to the file made in the current editing session. At the bottom of the menu are the names of the last four opened projects, which provide the ability to quickly open any of them. The last command on this menu is the Exit command. It is similar to the QUIT command in the command window and is used to exit Visual FoxPro. Edit Menu Commands The Edit menu is available in many Windows applications. In Visual FoxPro, commands on this menu are used when creating forms and reports and when editing programs. Getting Started with Visual FoxPro 23 The Paste Special, Insert Object, Object, and Links commands apply only to General fields and OLE objects. The rest of the commands are used when editing both programs and table fields. You may not be familiar with other Windows applications from the Go to Line command, which is a Visual FoxPro programmed program. Using this command, you can go to the line with the specified number in the program text. When you enter the name of an object, property, command, or function after entering an activation character (usually a period, space, or open parenthesis), the List Members command of Visual FoxPro invokes a list of valid values ​​(properties, methods, events, and objects) for the specified in object editor. The Quick Info command displays the valid record of the given command, function, variable. The last in the menu is the Properties command, when selected, the Edit Properties dialog box opens, allowing you to set the parameters for saving program files, view their properties, the date of the last editing and the occupied space on disk. View Menu Commands This menu item contains commands for viewing the currently open file. If there are no open files, the menu contains just one Toolbars command. This command opens a dialog box that lists the toolbars used when working in Visual FoxPro. When working in designers, the View menu contains commands that control the display of the toolbars used in this mode of operation. So, for example, when working in the form designer, commands appear on the menu for selecting the following panels: Color Palette, Layout, and Form Controls. When you view tables or edit forms, menus, or reports, additional commands appear on the menu. For example, when working with tables, several new commands appear on the menu. The Edit and Browse commands switch the table to view and edit the records it contains. The difference between these two commands is in the style of displaying the contents of the table. Menu Command Format This menu item is available when working in the designer of forms, reports, programs, text files and labels. The Format menu contains commands that control font characteristics, the alignment of text and objects, and the spacing between objects. However, when working with various constructors, additional commands become available. Tools Menu This menu contains wizards and tools for debugging programs. The first command on the Tools menu is the Wizards command, which opens a list of Visual FoxPro wizards. The wizard is a program that helps the user in solving such problems as creating forms, reports, tables. The creation process in this case consists in answering the wizard's questions regarding the object being created. Next on the menu is the Macros command for creating macros. The Debugger command is for debugging programs. It opens the Visual FoxPro Debugger dialog box, where you can view the values ​​of variables, array elements, fields, values ​​returned by Visual FoxPro functions, etc. The Component Gallery command opens the Catalogs - Component Gallery window to work in the Visual FoxPro Component Gallery. The Coverage Profiler command allows you to view information about the executed program. The Object Browser command opens a window of the same name that allows you to view the classes, properties, methods, events and constants of the selected libraries. The IntelliSense Manager command opens a window for configuring options that control how syntax is parsed in the Programming Editor window. The Task List command allows you to memorize a location to which you can return later by pressing a shortcut key. In addition, this command allows you to enter a list of required tasks similar to Microsoft Outlook. The Document View command opens a dialog box that displays a list of procedures, functions, and operators for the program open in the editor window. When a list item is selected, the transition to this item is carried out in the editor window. The Task Pane and Toolbox commands open the Task Pane Manager and ToolBox dialog boxes, respectively. The ToolBox displays the items that were used to create the applications. The last command on the Tools menu is Options. It allows you to customize the configuration of Visual FoxPro. Program Menu Commands The Program menu contains commands related to executing and compiling programs. Window Menu Commands The Window menu contains commands that control the windows that are open on the screen. You can use these commands to reorder, hide, clear windows, and move from one window to another. In addition, the commands of this menu allow you to activate any open window. The Command Window command on the Window menu activates the Command Window, which allows you to use commands when working with Visual FoxPro. Getting Started with Visual FoxPro 25 The Properties Window command opens the Properties dialog box, which allows you to view and change the properties of objects in the form of cursors and relationships. The Data Session command is used to open the Data Session window, which contains a list of all tables open in this session and the relationships between them (Figure 2.5). Fig. 2.5. The Data Session window shows the working area with the tables open and the relative indexes in the center of the Data Session window. The Properties button opens a window that allows you to view and change the current table properties. The Open button is used to open the table in a new work area. The Browse button (Tabular Mode) opens the table to view the records it contains. The Close button of the Data Session window closes the table in the current work area, and the Relations button allows you to define relationships between open tables. Menu Commands Help Help is the last command in the main window menu. Tab. 2.5 contains a list of commands available in this menu. Table 2.5. Íàçíà ÷ åíèå êîìàíä ìåíþ Help Êîìàíäà ìåíþ Íàçíà ÷ åíèå Microsoft Visual FoxPro Help Îòêðûâàåò îêíî ñïðàâî ÷ íîé ñèñòåìû Visual FoxPro 9.0 (Ñïðàâî ÷ íàÿ ñèñòåìà Visual FoxPro) MSDN Search (Ïîèñê â MSDN) 1 Ïîèñê ñïðàâî ÷ íîé èíôîðìàöèè â MSDN1 Microsoft Developer Network , a collection of Microsoft documents containing information about all of its developments. - Ed. 26 Ãëàâà 2 Òàáëèöà 2.5 (îêîí ÷ àíèå) Êîìàíäà ìåíþ Íàçíà ÷ åíèå Technical Support (Òåõíè ÷ åñêàÿ ïîääåðæêà) Îòîáðàæàåò èíôîðìàöèþ î òåõíè ÷ åñêîé ïîääåðæêå, îêàçûâàåìîé Microsoft Visual FoxPro on the Web (Visual FoxPro íà Web-ñòðàíèöàõ) Îòêðûâàåò Web-ñòðàíèöó Microsoft Visual FoxPro. Äëÿ èñïîëüçîâàíèÿ ýòîé êîìàíäû íåîáõîäèì äîñòóï â Èíòåðíåò About Microsoft Visual FoxPro (Î ïðîãðàììå Microsoft Visual FoxPro) Îòêðûâàåò äèàëîãîâîå îêíî About Microsoft Visual FoxPro, â êîòîðîì ñîäåðæèòñÿ èíôîðìàöèÿ îá àâòîðñêèõ ïðàâàõ íà ïðîãðàììó, íîìåð âåðñèè ïðîãðàììû è åå èäåíòèôèêàòîð, èìÿ ôàéëà ðåñóðñîâ è èñïîëüçóåìûé ïî Refine the catalog. In this window, view the various information about the computer, in order to quit FoxPro, exiting Visual To do this, you can use one of the following methods: select the Exit command from the File menu; select the Close command in the system menu of the main Visual FoxPro window; double-click the Visual FoxPro icon in the title bar of the main window; enter the QUIT command in the command window. If the form, report, query, or any other application object is not saved, Visual FoxPro prompts you to save it. To do this, a dialog box appears on the screen similar to that shown in Fig. 2.6. Fig. 2.6. Dialogue window, accessed while streaming output from Visual FoxPro without saving information. To continue the operation, press one of the buttons (Table 2.6.). Table 2.6. Íàçíà ÷ åíèå êíîïîê äèàëîãîâîãî îêíà, ïîÿâëÿþùåãîñÿ ïðè ïîïûòêå âûõîäà èç Visual FoxPro áåç ñîõðàíåíèÿ èíôîðìàöèè Êíîïêà Íàçíà ÷ åíèå Yes (Äà) Ñîõðàíåíèå ôàéëà è âûõîä èç Visual FoxPro; åñëè ôàéëó åùå íå ïðèñâîåíî èìÿ, Visual FoxPro îòêðûâàåò äèàëîãîâîå îêíî Save As (Ñîõðàíèòü Êàê) No (Íåò) Âûõîä èç Visual FoxPro áåç ñîõðàíåíèÿ ôàéëà Cancel (Îòìåíà) Çàêðûòèå òåêóùåãî äèàëîãîâîãî îêíà è âîçâðàùåíèå â Visual FoxPro Íà ÷ àëî ðàáîòû ñ Visual FoxPro 27 Task Panel Windows In Visual FoxPro 9. 0 has a task manager to help you develop your application. The links in its window allow you to launch the New Application and Database Wizard, open the Help system, open the application or database from the list of recently opened applications or databases, and much more. To open the Task Pane Manager window (Fig. 2.7), you can use one of the following methods: select the Task Pane command from the Tools menu; click the Task Pane button on the standard toolbar. In addition, the Task Manager window opens in the main Visual FoxPro window each time it starts if Open the Task Pane Manager when Visual FoxPro starts is selected in the Task Pane Options dialog box. ... Fig. 2.7. Main page of the Task Pane Manager window Toolbar (Table 2.7). Manager contains buttons for the next assignment 28 Chapter 2 Table 2.7. Íàçíà ÷ åíèå êíîïîê ïàíåëè èíñòðóìåíòîâ Task Pane Manager Êíîïêà Íàçíà ÷ åíèå Îòêðûâàåò îñíîâíóþ ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, ñîäåðæàùóþ ñïèñîê íåäàâíî èñïîëüçóåìûõ ïðîåêòîâ è áàç äàííûõ, êíîïêè äëÿ ñîçäàíèÿ íîâûõ, à òàêæå ññûëêè, ñîäåðæàùèå èíôîðìàöèþ î Microsoft Visual FoxPro Îòîáðàæàåò â îêíå ìåíåäæåðà ïàíåëè çàäà ÷ ññûëêè íà îñíîâíûå ñàéòû ñ èíôîðìàöèåé è ïîñëåäíèìè íîâîñòÿìè î Visual FoxPro Ïîçâîëÿåò îïðåäåëèòü íàñòðîéêè ñðåäû Visual FoxPro è ñâÿçàòü ñîáñòâåííûé ïðîåêò ñ íèìè Ñîäåðæèò ñïèñîê ïðèìåðîâ èñïîëüçîâàíèÿ ýëåìåíòîâ Visual FoxPro Îòêðûâàåò ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, êîòîðàÿ ïîìîãàåò â èñïîëüçîâàíèè ñóùåñòâóþùèõ XML Web-ñåðâèñîâ è Creation of new data is used to search for files on the computer, not from Microsoft Visual FoxPro source. Ïîçâîëÿåò ïðîñìàòðèâàòü ïåðå ÷ åíü óñòàíîâëåííûõ ñîåäèíåíèé ê áàçàì äàííûõ, äîáàâëÿòü íîâûå ñîåäèíåíèÿ Çàïóñêàåò èãðó Minesweeper (Ñàïåð) Îáíîâëÿåò ñîäåðæèìîå äèàëîãîâîãî îêíà Task Pane Manager (Ìåíåäæåð ïàíåëè çàäà ÷) Îòêðûâàåò äèàëîãîâîå îêíî Task Pane Options (Ïàðàìåòðû ïàíåëè çàäà ÷), ïîçâîëÿþùåå íàñòðîèòü ïàðàìåòðû êàê Standard, Start, and Independently Created Task Pane The main page of the Task Pane Manager (see Fig. 2.7), opened when you click the Start button on the toolbar, contains links (Table 2.8). Table 2.8. What’s new in Visual FoxPro? Opens the Help window on the page, list (What's new in Visual FoxPro? ) Âàþùåé íîâûå âîçìîæíîñòè Visual FoxPro 9.0 Customize my development Îòêðûâàåò ñòðàíèöó ìåíåäæåðà ïàíåëè çàäà ÷, ñîäåðæàùóþ environment (Íàñòðîèòü ñðåäó íàñòðîéêè ñðåäû Visual FoxPro ðàçðàáîòêè) Create a new application (Ñîç- Çàïóñêàåò ìàñòåðà ñîçäàíèÿ ïðîåêòà äàòü íîâûé ïðîåêò) Create a new database (Ñîç- Launches the database (new database) Go to the Visual FoxPro web Opens the Microsoft Visual FoxPro website. Äàííàÿ site (Ïåðåéòè íà ñàéò Visual âîçìîæíîñòü äîñòóïíà ïðè ïîäêëþ ÷ åíèè êîìïüþòåðà ê Èíòåðíåòó FoxPro) Íà ÷ àëî ðàáîòû ñ Visual FoxPro 29 Òàáëèöà 2.8 (îêîí ÷ àíèå) Ññûëêà Íàçíà ÷ åíèå Manage (Óïðàâëÿòü) Îòêðûâàåò äèàëîãîâîå îêíî My Tools (Ìîè èíñòðóìåíòû) Open Project (Îòêðûòü ïðîåêò) Îòêðûâàåò äèàëîãîâîå îêíî Open (Îòêðûòü) äëÿ âûáîðà íåîáõîäèìîãî ïðîåêòà New Project (Íîâûé ïðîåêò) Îòêðûâàåò äèàëîãîâîå îêíî Create (Ñîçäàòü) äëÿ ñîçäàíèÿ íîâîãî ïðîåêòà Open Database (Îòêðûòü áàçó Îòêðûâàåò äèàëîãîâîå îêíî Open (Îòêðûòü) äëÿ âûáîðà íåäàííûõ) (see the Options window in the Options pane, the Options pane is used to create the task parameters dialog box. Toolbar Options) Figure 2.8 Task Pane Options Dialog Box The left side of the Task Pane Options window contains folders for The page settings of the Task Pane Manager dialog box. General settings are configured using the Task Pane Manager folder, which contains three sections General, Proxy Server, and Customize. When you select General 30 Chapter 2 (see Figure 2.8), the Pane list appears on the right side of the window, from which you select the page displayed when the taskbar manager is opened, and options that specify the frequency of updating information from the Internet ( Table 2.9). The Open the Task Pane Manager when Visual FoxPro starts check box below specifies whether to start the Task Pane Manager when Visual FoxPro starts. Table 2.9. Îïöèè íàñòðîéêè ÷ àñòîòû îáíîâëåíèÿ èíôîðìàöèè èç Èíòåðíåòà Ññûëêà Íàçíà ÷ åíèå Every time you start the Task Pane Îáíîâëÿåò ñîäåðæèìîå ìåíåäæåðà ïàíåëè çàäà ÷ Manager (Êàæäûé ðàç ïðè çàïóñêå êàæäûé ðàç ïðè åãî çàïóñêå ìåíåäæåðà ïàíåëè çàäà ÷) Every time the pane is loaded (Êàæäûé Îáíîâëÿåò ñòðàíèöó, ñîäåðæàùóþ èíôîðìàöèþ èç ðàç ïðè çàãðóçêå ïàíåëè) Èíòåðíåòà, ïðè êàæäîì åå îòêðûòèè Every x days (êàæäûå x äíåé) Îñóùåñòâëÿåò îáíîâëåíèå èíôîðìàöèè êàæäûå x äíåé, çàäàííûõ ñ ïîìîùüþ ñ ÷ åò ÷ èêà Never (Íå îáíîâëÿòü) Íå îáíîâëÿåò ñîäåðæèìîå äèàëîãîâîãî îêíà Task Pane Manager NOTE Refresh the contents of the Task Pane Manager dialog box by clicking the Refresh button on the toolbar. You can create your own taskbar, modify an existing one, or install the taskbar from disk. To do this, follow these steps: 1. In the Task Pane Manager window, click the Options button on the toolbar. 2. On the left side of the Task Pane Options window that opens, select the Task Pane Manager folder and then Customize. 3. On the page that opens, click one of the following buttons: Install Pane - installs a new panel; Customize Pane - Modifies an existing or creates a new panel. Visual FoxPro Help System When developing applications in Visual FoxPro, as in any other system, it is often necessary to review the capabilities of programming tools, individual commands and functions. In Visual FoxPro, in addition to the traditional help system, you can find information of interest in the built-in documentation, numerous examples, and also on the Web pages. All of these tools are selected from the Help menu. Getting Started with Visual FoxPro 31 Like most of the most popular programs, Visual FoxPro has context sensitive help — that is, you can get help on using the tool you are currently working with. To do this, you can use one of the following methods: select the Microsoft Visual FoxPro Help command from the Help menu; in the Task Pane Manager dialog box, select the What’s new in Visual FoxPro? link. (What's new in Visual FoxPro?); to push at any time during a Visual FoxPro session. The help system will select the section of the directory that deals with information about the current operation; some of the dialog boxes contain a Help button on the toolbar or directly in the window. If the Help button was pressed while working in one of them, Visual FoxPro will tell you how to use this dialog box (Figure 2.9). Fig. 2.9. The Visual FoxPro Help System will show you how to work with the current dialog box. Figure 2.10 shows the Visual FoxPro help window that opens when you select the Microsoft Visual FoxPro Help command from the Help menu. 32 Chapter 2 Fig. 2.10. Microsoft Visual FoxPro 9.0 Help System Window This window is divided into two areas. There are four tabs in the left pane of the Help window where you search for the information you want. The right pane of the window contains information for the selected section. You can use the cursor to control the width of the areas of the Help window. To do this, you need to do the following: 1. Place the cursor on the dividing line between the areas. 2. When the cursor turns into a double-headed arrow, press the left mouse button and, while holding it down, move it to one side or the other, depending on which area you want to expand. 3. After setting the desired size of the area, release the mouse button. The help window has a toolbar. The left pane of the Help window contains four tabs designed to make it easier to find the information you need (Table 2.10). Table 2.10. Íàçíà ÷ åíèå âêëàäîê, ïðåäíàçíà ÷ åííûõ äëÿ óïðîùåíèÿ ïîèñêà èíôîðìàöèè Âêëàäêà Íàçíà ÷ åíèå Ñîäåðæàíèå Ïîèñê èíôîðìàöèè ïî îãëàâëåíèþ ñïðàâî ÷ íîé ñèñòåìû Óêàçàòåëü Ïîèñê òåì ïî íà ÷ àëüíûì áóêâàì íàçâàíèÿ òåìû Ïîèñê Ïîèñê êëþ ÷ åâûõ ñëîâ è ôðàç â òåìàõ Èçáðàííîå Ñîäåðæèò èçáðàííûå òåìû ñïðàâî Hinting system Let's consider in more detail how to work with tabs in the help system. Getting Started with Visual FoxPro 33 Using the Contents Tab The first tab in the Help window is the Contents tab (see Figure 2.10). This tab takes the most traditional approach to getting help information. The Contents tab contains a list of topics in the Help system. The icon is displayed in front of the name of each section. At the initial moment, all sections are closed, which corresponds to the closed book icon. To open any of the sections, place the cursor on the section to be opened and press the mouse button. As a result, the icon will look like an open book. Pressing the mouse button again on the open book icon closes the section. An open section can contain subsections and topics (Fig. 2.11). An icon with a question mark corresponds to a topic. To display the content of a specific topic in the right pane of the help window, place the cursor on its name or the corresponding icon and press the mouse button. Fig. 2.11. See the help text for which there are links to the Help section, because you can find help for several topics in the Help section, because you can find help for several topics in the Help section. 34 Chapter 2 Searching for Help by Subject Index To search for Help by Subject Index, use the Index tab (Fig. 2.12) of the Help window. At the top of the tab there is a field for entering a keyword by which the search will be carried out. Below it is a list of keywords, sorted alphabetically. As you enter letters in the input field, sections appear in the list of keywords with the first letters of their names matching the letters already entered. Fig. 2.12. The Index tab to search for a section by initial name You can simply scroll through the list of keywords with the scroll bar, highlight the section you want, and then click Show. Help text appears in the right pane of the window. To search for information using the Index tab, you must enter the initial letters of the topic you want to find. As an example, properties were introduced (Fig. 2.12). If the help system finds topic names starting with the specified letter in the list, they will be highlighted in color or brightness. If several topics satisfy the search condition, the Found Sections window (Fig. 2.13) will appear with a list of sections. The required topic is selected from this list and the Show button is pressed. Information about the specified topic will be displayed in the right pane of the Help window. Getting Started with Visual FoxPro 35 Fig. 2.13. Dialog window Subdivisions Using the Search tab To search for keywords and phrases, use the Search tab. In the Search for next words input field, you enter the word or phrase you want to search for. If you want to find a phrase, you need to enclose it in single or double quotes. You can also use the "?" (to denote one arbitrary character) and "*" (to denote any number of characters). In addition, for searching, you can use logical expressions composed of words, using the logical operators presented in table. 2.11. Table 2.11. Ëîãè ÷ åñêèå îïåðàòîðû, èñïîëüçóåìûå ïðè ïîñòðîåíèè âûðàæåíèé äëÿ ïîèñêà Îïåðàòîð Ïðèìåð âûðàæåíèÿ äëÿ ïîèñêà Ðåçóëüòàò AND properties AND form Îòîáðàæàþòñÿ òîëüêî òå òåìû ñïðàâêè, êîòîðûå ñîäåðæàò îáà ñëîâà èëè properties & form OR properties OR form èëè Îòîáðàæàþòñÿ òåìû ñïðàâêè, â êîòîðûõ ñîäåðæèòñÿ ëþáîå èç äâóõ words properties | form NEAR properties NEAR form Îòîáðàæàþòñÿ òåìû ñïðàâêè, â êîòîðûõ ïåðâîå ñëîâî íàõîäèòñÿ ðÿäîì ñî âòîðûì ñëîâîì â ïðåäåëàõ âîñüìè ñîñåäíèõ ñëîâ NOT properties NOT form Âûáèðàþòñÿ òîëüêî òå òåìû ñïðàâêè, â êîòîðûõ ñîäåðæèòñÿ ïåðâîå ñëîâî è íå ñîäåðæèòñÿ ñëîâî, ðàñïîëîæåííîå ïîñëå îïåðàòîðà NOT èëè properties! form Having built the search expression, press the Sections button. This will search for sections containing the specified expression, and a list of sections will be displayed on the Search tab in the Section table. 36 Chapter 2 Fig. 2.14. Search by Key Words Table A section has three columns. The Title column contains the titles of the Help topics found, the Location column contains information about the location of the Help topic, and the Rank column contains the frequency of the search term. The final list of topics will display the first 500 help topics that match the specified search condition. You can use the table column headings to organize the topics in the Section table. To do this, click on the heading of the column by which the ordering should be performed. The desired one is selected from the list of found topics and the Show button is pressed. Information on this topic will be displayed in the right pane of the help window (Fig. 2.14). In the text of the help topic, you can highlight the words that were specified for the search. To do this, on the toolbar, click the Options button and select the Highlight Results command from the list that appears. To determine the search parameters, checkboxes have been added to the tab, when installed, the user is provided with additional options (Table 2.12). Table 2.12. Íàçíà ÷ åíèå ôëàæêîâ äëÿ îïðåäåëåíèÿ ïàðàìåòðîâ ïîèñêà Ôëàæîê Íàçíà ÷ åíèå Ïðåäûäóùèé ïîèñê Ïîèñê ñðåäè òåì ñïðàâî ÷ íîé ñèñòåìû, êîòîðûå áûëè îòîáðàíû â ïðåäûäóùåì ïîèñêå Ïîõîæèå ñëîâà Ïîèñê íå òîëüêî ñëîâ, çàäàííûõ â âûðàæåíèè ïîèñêà, íî è ïîõîæèõ íà íèõ Òîëüêî â çàãîëîâêàõ Ïîèñê òîëüêî Getting Started with Visual FoxPro 37 Selected Tab The Favorites tab allows you to create a list of the most frequently used Help topics that should be easy to select. By default, this tab is empty. To add a help topic to the Favorites tab, do the following: 1. Using other tabs in the help system window, find the topic whose name you want to place on this tab. 2. Display the found information in the right pane of the help window. 3. Go to the Favorites tab. The name of the topic you are viewing appears in the Current Section field of this tab. 4. Click the Add button. The name of the current Help topic is added to the Favorite Topics list. Similarly, you can add all the necessary Help topics to this area. To remove sections from this tab, use the Delete button. Viewing Online Help The Visual FoxPro Help contains a wealth of information you need to develop applications. For the latest news on Visual FoxPro, see Fig. 2.15. Visual FoxPro News Page 38 Chapter 2, you can open the corresponding Web page directly from the main Visual FoxPro window. To do this, use the Microsoft on the Web (Visual FoxPro on Web pages) command of the Help menu. NOTE Web browsing is not possible if there is no Internet access. To gain access, you must install a modem on your computer and register with your local ISP. In fig. 2.15 is a Visual FoxPro news page maintained by Microsoft. The left pane contains the sections on Visual FoxPro. After clicking on the name of the section of interest, a Web page containing information on this section will start loading. Chapter 3 A Project as a Means for Using Application Elements When you create an application, you use a project that combines the elements of a Visual FoxPro application and groups them by type. Information about the project is stored in a special table, which, unlike ordinary Visual FoxPro tables, has the pjx extension. Memo-fields of the table contain the name of the project element, its description and other text attributes. The file with Memo-fields of the table has the pjt extension. Using the project simplifies the development of the application, because in the project, databases, programs, forms, reports, queries and other elements of the application are located in the appropriate sections, and the location of each element included in the project is remembered. Once you have created a project and defined its elements, you can use it to build your application by building an app file, or to create an executable file with an exe extension. When building an application from a project, the search and assembly of files referenced by the elements of the application is carried out, the versions of the files included in the project are tracked. Creating an Application Project When you start developing a new application, you first need to create an application project. In the future, various elements of the application are added to it. You can use the Application Wizard or the New command on the File menu to create a new project. When the New command is executed, a corresponding dialog box opens on the screen listing all types of application elements that are possible in Visual FoxPro (Fig. 3.1). The default option is Project. To create a new project, follow these steps: 1. Click the New file button. 1. In the Enter project file input field of the Create dialog box, specify the name of the project to be created, making sure that the Save file type is set to Project as the Save type field, and the correct folder is selected in the Folder field. the project will be located (Fig. 3.2). 2. To save the created project, click the Save button. Visual FoxPro creates the project files and writes them to the specified location. This will open the Project Manager window (Figure 3.3). 40 Chapter 3 Fig. 3.1. Dialog box New, in which you can easily indicate the type of the created file Fig. 3.2. The Create dialog window for setting the name of the created project as a means of integrating the output 41 3.3. The Project Manager Window At the top of the project window there are tabs that control the display of certain types of project files, greatly facilitating the development of the application (Table 3.1). Table 3.1. Âêëàäêè îêíà Project Manager Âêëàäêà Îòîáðàæàåìûå ôàéëû All (Âñå) Âñå ôàéëû Data (Äàííûå) Áàçû äàííûõ, òàáëèöû, çàïðîñû, ïðåäñòàâëåíèÿ äàííûõ, õðàíèìûå ïðîöåäóðû Documents (Äîêóìåíòû) Ôîðìû, îò ÷ åòû è ýòèêåòêè Classes (Êëàññû) Êëàññû Code (Êîäû) Ïðîãðàììû and Other (Default) Menus, Text and Graphics Files, Key Macros Visual FoxPro uses a hierarchical display of project items. At the topmost level are the categories of project items: Data, 42 Chapter 3 Documents, Class Libraries, Code, and Other. NOTE There is a separate tab for each category of elements in the project window. The next level contains the file types of this category. For example, for the Documents category, there are the following file types: Forms - forms; Reports - reports; Labels - labels. Some types of files may have subsequent levels of the hierarchy. For example, a database can contain tables, data views, and each table contains fields. Each hierarchical list can be collapsed or expanded. If an element of the hierarchical list contains elements of the next level, then a plus sign is displayed on the left side of the element name in the collapsed state. In fig. 3.3 it can be seen that all items in the list except for Class Libraries contain nested item levels. To expand the list of elements of the next level, click on the plus sign. Expanding the list changes the plus sign to a minus sign. In fig. 3.4 is an example of a hierarchical Data list that is four levels deep. To collapse the nested list of items, click on the minus sign. There is one very interesting and useful button in the project window. It is located in the upper right corner of the project window and contains an upward-pointing arrow. When you click on this button, the project window is minimized, only the names of the tabs remain visible, and the button icon changes to an arrow pointing down. This frees up space on the screen for other windows (Fig. 3.5). In this case, the project tabs remain active, and when you click on them, a part of the project window opens, containing the information of the selected tab (Fig. 3.6). To return the project window to the expanded view, click the button containing the arrow pointing down. Visual FoxPro provides the ability to move an open tab around the screen. To do this, click on the shortcut and, without releasing the mouse button, move the tab anywhere in the main Visual FoxPro window (Fig. 3.7). In addition, you can resize the tab. To do this, follow these steps: 1. Place the cursor in the lower right corner. 2. When the cursor turns into a double-headed arrow, press and hold the left mouse button and move it to one side or the other. 3. After setting the desired size of the area, release the mouse button. Project as a means of adding elements of the application Fig. 3.4. List of project items Fig. 3.5. Top window of project 43 44 Chapter 3 Fig. 3.6. One page layout Fig. 3.7. Ïåðåìåùåíèå îòêðûòûõ âêëàäîê ïî ýêðàíó Ïðîåêò êàê ñðåäñòâî îáúåäèíåíèÿ ýëåìåíòîâ ïðèëîæåíèÿ 45 Óïðàâëåíèå ïðîåêòîì ñ ïîìîùüþ ìåíþ When you open the project window in the main Visual FoxPro menu, add a new menu item Project (the Project), which contains commands that let you work with files that are included in the project. The purpose of these commands is described in table. 3.2. Table 3.2. Íàçíà ÷ åíèå êîìàíä ìåíþ Project Êîìàíäà Íàçíà ÷ åíèå New File (Íîâûé ôàéë) Ñîçäàåò íîâûé ôàéë, êîòîðûé àâòîìàòè ÷ åñêè äîáàâëÿåòñÿ â ïðîåêò Add File (Äîáàâèòü ôàéë) Äîáàâëÿåò ñîçäàííûå ðàíåå ôàéëû â ïðîåêò Modify File (Èçìåíèòü ôàéë) Îòêðûâàåò âûáðàííûé ôàéë ïðîåêòà äëÿ ðåäàêòèðîâàíèÿ Browse File (Ïðîñìîòð ôàéëà â òàáëè ÷ íîì âèäå) Îòêðûâàåò òàáëèöó â ðåæèìå ïðîñìîòðà Preview File (Ïðîñìîòð ôàéëà) Îòêðûâàåò ôàéë (íàïðèìåð, îò ÷ åò) â îêíå ïðåäâàðèòåëüíîãî ïðîñìîòðà Run File (Âûïîëíèòü ôàéë) Çàïóñêàåò ôàéë íà âûïîëíåíèå Remove File (Óäàëèòü ôàéë) Óäàëÿåò ôàéë èç ïðîåêòà Rename File (Ïåðåèìåíîâàòü ôàéë) Ïåðåèìåíîâûâàåò ôàéë, âõîäÿùèé â ïðîåêò Exclude (Èñêëþ ÷ èòü) Èñêëþ ÷ àåò ôàéë èç ïðîåêòà Include (Âêëþ ÷ èòü) Âêëþ ÷ àåò ôàéë â ïðîåêò Set Main (Îñíîâíàÿ ïðîãðàììà) Óñòàíàâëèâàåò ôàéë â êà ÷ åñòâå îñíîâíîé ïðîãðàììû ïðîåêòà Edit Description (Ïðàâêà îïèñàíèÿ) Îòêðûâàåò îêíî ðåäàêòèðîâàíèÿ îïèñàíèÿ ôàéëà Project Info (Èíôîðìàöèÿ ïðîåêòà) Îòîáðàæàåò èíôîðìàöèþ î ïðîåêòå è âõîäÿùèõ â íåãî ôàéëàõ Errors (Îøèáêè ) Îòîáðàæàåò îøèáêè, Îáíîâëÿåò èíôîðìàöèþ â îêíå ïðîåêòà Clean Up Project (Î ÷ èñòèòü) Î ÷ èùàåò ïðîåêò, óáèðàÿ èç íåãî óäàëåííûå ôàéëû âîçíèêøèå ïðè ïîñòðîåíèè ïðîåêòà Build (Ïîñòðîèòü) Ñòðîèò ïðèëîæåíèå èëè ïåðåñòðàèâàåò ïðîåêò Refresh (Îáíîâèòü) To work with project files can be use the context menu that opens when you right-click on it (Fig. 3.8) and contains some commands of the Project menu, as well as the Expand All command, which expands all levels of data nesting in the Project Manager window. 46 Chapter 3 Fig. 3.8. Context menus for the selected project file Managing project elements To control the elements of the project, use the buttons located on the right side of the project window. Some of the buttons can be used when working with files of all types, and some - only with certain ones. Table 3.3. is a list of buttons that can be used for all types of project files. Table 3.3. Íàçíà ÷ åíèå êíîïîê îêíà ïðîåêòà Êíîïêà Íàçíà ÷ åíèå New (Íîâûé) Ñîçäàåò íîâûé ôàéë, êîòîðûé àâòîìàòè ÷ åñêè äîáàâëÿåòñÿ â ïðîåêò Add (Äîáàâèòü) Äîáàâëÿåò ñîçäàííûé ðàíåå ôàéë â ïðîåêò Modify (Èçìåíèòü) Èçìåíÿåò âûáðàííûé ôàéë ïðîåêòà Remove (Óäàëèòü) Óäàëÿåò ôàéë èç Project For executable files (forms, requests, programs, and menus), the Run button can be used to launch the selected project file. For reports and labels, you can use the Preview button as a tool for sharing the items in Application 47 which opens the file in a preview window. The Browse button is used to browse the data contained in the table. The Build button of the project window opens the Build Options dialog box, allowing you to build a project, an executable application, a DLL, or update an existing project. Using the Wizard to Create a Project In Visual FoxPro 9.0, when you create a project using the wizard, you can include tables, forms, reports, and add items that you created earlier to the project. To create a new project using the wizard, follow these steps: 1. From the File menu, select New, or click the New button on the toolbar. 2. The New dialog box will open, select the Project option and click the Wizard button. TIP In Microsoft Visual FoxPro 9.0, the New Project wizard can also be launched from the Task Pane Manager window. To do this, use the Create a new application link in the Task Manager window. The dialog box shown in Fig. 3.9. Fig. 3.9. Setting the name of the project and its location 3. The dialog box shown in fig. 3.9. In the Project name input field of this window, you must specify the name of the project to be created, and in the Project file input field, specify its location. To place the project in the required folder, use the Browse button, which opens a dialog box allowing you to find the required folder on your computer. 4. After specifying the file name and location, click OK to create a new project. The wizard proceeds to create a new project, and the Application Builder dialog box appears on the screen (Figure 3.10). 48 Chapter 3 Fig. 3.10. Application viewer dialog The lower part of the dialog box contains the following buttons: Help - opens the help file; Cancel - cancels the work of the wizard; OK - creates a new project. In addition, the dialog box contains six tabs on which the following information is defined (Table 3.4). Table 3.4. Âêëàäêè äèàëîãîâîãî îêíà Application Builder Âêëàäêà Èíôîðìàöèÿ General (Îáùèå) Îñíîâíûå ïàðàìåòðû ñîçäàâàåìîãî ïðîåêòà Credits (Îá àâòîðå) Èíôîðìàöèÿ îá àâòîðàõ ïðîåêòà Data (Äàííûå) Ïàðàìåòðû ñîçäàíèÿ áàç äàííûõ è òàáëèö Forms (Ôîðìû) Èíôîðìàöèÿ î ôîðìàõ, âõîäÿùèõ â ïðîåêò Reports (Îò ÷ åòû ) Èíôîðìàöèÿ îá îò ÷ åòàõ, âõîäÿùèõ â ïðîåêò Advanced (Äîïîëíèòåëüíûå) Ïàðàìåòðû ñîçäàíèÿ ñïðàâî ÷ íîé ñèñòåìû, ìåíþ ïðîåêòà Çàäàíèå îáùèõ ïàðàìåòðîâ ïðîåêòà of General tab (General) (see. rice. 3.10) is designed to set such project parameters as its name, a picture placed in the project, the type of application being created, common dialog boxes, and the project icon. The Name input field allows you to set the name of the application, which is displayed in its title, the About dialog box, and also within the application. Project as a tool for adding application elements 49 In the Image input field, you can specify the name of the image file that will appear in the window when the application is launched and in the About dialog box. The Application Type area allows you to set the type of application to create (Table 3.5). Table 3.5. Îïöèè îáëàñòè Application Type Îïöèÿ Òèï ïðèëîæåíèÿ Normal (Îáû ÷ íîå) Ñîçäàííîå ïðèëîæåíèå áóäåò çàïóñêàòüñÿ â ãëàâíîì îêíå Visual FoxPro, çàìåíÿÿ âñå îêðóæåíèå è ñèñòåìíîå ìåíþ Visual FoxPro Module (Àâòîíîìíîå) Ïðèëîæåíèå äîáàâëÿåòñÿ â ñóùåñòâóþùèé ïðîåêò èëè áóäåò âûçûâàòüñÿ èç äðóãîãî ïðèëîæåíèÿ. Ìåíþ ïðèëîæåíèÿ äîáàâëÿåòñÿ â ñèñòåìíîå ìåíþ, è åãî ôóíêöèè èñïîëüçóþòñÿ êàê êîìïîíåíòû äðóãîãî ïðèëîæåíèÿ Top-Level (Âåðõíèé óðîâåíü) Ïðèëîæåíèå áóäåò çàïóñêàòüñÿ êàê îòäåëüíîå ïðèëîæåíèå Microsoft Windows installing flags group Common Dialogs (General dialog), you can use in the application of common dialog boxes, containing information about developers, program, access rights to application files (Table 3.6). Table 3.6. Íàçíà ÷ åíèå ôëàæêîâ ãðóïïû Common Dialogs Ôëàæîê Íàçíà ÷ åíèå Splash screen (Âñïëûâàþùèé ýêðàí) Ïðè çàïóñêå ïðèëîæåíèÿ ïîÿâëÿåòñÿ îêíî, ñîäåðæàùåå ëîãîòèï ïðèëîæåíèÿ è ñâåäåíèÿ îá àâòîðå About dialog (Î ïðîãðàììå) Ïðèëîæåíèå ñîäåðæèò äèàëîãîâîå îêíî Î ïðîãðàììå, â êîòîðîì áóäåò îòðàæàòüñÿ ëîãîòèï ïðèëîæåíèÿ è ñâåäåíèÿ î ðàçðàáîò ÷ èêàõ Quick start (Áûñòðûé ñòàðò) Ïðîåêò ñîäåðæèò äèàëîãîâîå îêíî Quick start, â êîòîðîì îïðåäåëÿþòñÿ ïðàâà äîñòóïà ê äîêóìåíòàì ïðèëîæåíèÿ è îñòàëüíûì ôàéëàì User logins (Îêíî ââîäà ïàðîëÿ) Ïðè óñòàíîâëåííîì ôëàæêå â ïðîåêò äîáàâëÿåòñÿ ôîðìà, ïðåäíàçíà ÷ åííàÿ äëÿ ââîäà ïàðîëÿ when starting the application The Icon area allows you to define the application icon. Assigning Information about Project Developers The Credits tab (Figure 3.11) of the Application Builder dialog box contains the following information: list of authors, company name, version number, rights, and trademark of the application. 50 Chapter 3 Fig. 3.11. Credits tab of the Application Builder dialog box. To enter this data, use the fields (Table 3.7). Table 3. 7. Íàçíà ÷ åíèå ïîëåé âêëàäêè Credits äèàëîãîâîãî îêíà Application Builder Ïîëå ââîäà Íàçíà ÷ åíèå Author (Àâòîð) Ñïèñîê ðàçðàáîò ÷ èêîâ ïðèëîæåíèÿ Company (Ïðåäïðèÿòèå) Íàèìåíîâàíèÿ ïðåäïðèÿòèÿ Version (Âåðñèÿ) Âåðñèÿ ïðèëîæåíèÿ Copyright (Ïðàâà) Ïðàâà ïî èñïîëüçîâàíèþ ïðèëîæåíèÿ Trademark (Òîðãîâàÿ ìàðêà ) Custom mark of the application window. You can add both new and existing databases and tables to the list presented on the tab in tabular form (Table 3.8). Table 3.8. Íàçíà ÷ åíèå ñòîëáöîâ âêëàäêè Data äèàëîãîâîãî îêíà Application Builder Ñòîëáåö Íàçíà ÷ åíèå Datasource (Èñòî ÷ íèê äàííûõ) Èìÿ òàáëèöû Form (Ôîðìà) Ñîäåðæèò ôëàæîê, óñòàíîâêà êîòîðîãî óêàçûâàåò íà íåîáõîäèìîñòü àâòîìàòè ÷ åñêîãî ñîçäàíèÿ ôîðìû äëÿ äàííîé òàáëèöû Report (Îò ÷ åò) Ñîäåðæèò ôëàæîê, óñòàíîâêà êîòîðîãî óêàçûâàåò íà íåîáõîäèìîñòü àâòîìàòè ÷ åñêîãî ñîçäàíèÿ îò ÷ åòà äëÿ äàííîé òàáëèöû Ïðîåêò êàê ñðåäñòâî îáúåäèíåíèÿ ýëåìåíòîâ ïðèëîæåíèÿ 51 Ðèñ. 3.12. Data tab of the Application Builder dialog box To add tables to the project, delete them and other actions above them, the tab contains the following buttons (Table 3.9). Table 3.9. Íàçíà ÷ åíèå êíîïîê âêëàäêè Data äèàëîãîâîãî îêíà Application Builder Êíîïêà Íàçíà ÷ åíèå Çàïóñêàåò ìàñòåð áàç äàííûõ, êîòîðûé ñîçäàåò äëÿ ïðîåêòà íîâóþ áàçó äàííûõ Çàïóñêàåò ìàñòåð òàáëèö äëÿ ñîçäàíèÿ íîâîé òàáëèöû Select (Âûáðàòü) Îòêðûâàåò äèàëîãîâîå îêíî äëÿ âûáîðà óæå ñóùåñòâóþùåé áàçû äàííûõ èëè òàáëèöû Clear ( Î ÷ èñòèòü) Î ÷ èùàåò äèàëîãîâîå îêíî îò òàáëèö, êîòîðûå áûëè äîáàâëåíû â ïðîåêò Generate (Ïîñòðîèòü) Ïðè íàæàòèè êíîïêè ïðîèñõîäèò äîáàâëåíèå â ïðîåêò âñåõ ðàçìåùåííûõ íà âêëàäêå òàáëèö, îñóùåñòâëÿåòñÿ ñîçäàíèå ôîðì è îò ÷ åòîâ äëÿ òåõ òàáëèö, â êîòîðûõ óñòàíîâëåíû ñîîòâåòñòâóþùèå ôëàæêè ... After all the work done in the table list, you can set the style for the forms created by the project wizard using the Form Style drop-down list located directly below the table. In fig. Figure 3.13 shows a shape created using the Embossed style. When creating a report, as when creating a form, you can apply different styles. Use the Report Style drop-down list to set the style of the report. 52 Chapter 3 Fig. 3.13. Forms created with the use of the Embossed style. 3.14) is designed to create a list of project forms. Fig. 3.14. Forms tab of the Application Builder dialog box If the corresponding checkboxes were selected for the tables included in the project in the Form column of the Data tab and the Generate button was clicked. will appear in the list of forms on the Forms tab. You can add previously created forms to this list using the Open dialog box that appears when you click the Add button. In the right part of the tab there is a Name input field, which contains the name of the form, and checkboxes that determine the main properties of the forms (Table 3.10). Table 3.10. Íàçíà ÷ åíèå ôëàæêîâ âêëàäêè Forms äèàëîãîâîãî îêíà Application Builder Ôëàæîê Íàçíà ÷ åíèå Single instance (Îäèí ýêçåìïëÿð) Ïîëüçîâàòåëü ñìîæåò îòêðûòü ôîðìó â ïðèëîæåíèè íå áîëüøå îäíîãî ðàçà Use Navigation toolbar (Èñïîëüçîâàòü ïàíåëü íàâèãàöèè) Ïðè îòêðûòèè ôîðìû íà ýêðàíå ïîÿâëÿåòñÿ ïàíåëü èíñòðóìåíòîâ, ïîçâîëÿþùàÿ ïåðåìåùàòüñÿ ïî Record Use Navigation menu