Escolar Documentos
Profissional Documentos
Cultura Documentos
Create a folder, called Products, in the Temp folder of hard drive C; your directory C:\Temp\Products should look like the following: Windows 95/NT Tutorial
Structure for table: Number of data records: Date of last update: Memo file block size: Code Page: Field Field Name 1 PRODUCTID 2 SUPPLIERID 3 PRODNAME 4 ENGNAME 5 QTYSIZE 6 UNITPRICE 7 UNITCOST 8 QTYINSTOCK 9 MINQTYTOST 10 DISCONTINU 11 LASTORDER 12 INFO
C:\TEMP\PRODUCTS\PRODUCTS.DBF 77 02/27/98 64 1252 Type Width Dec Character 6 Character 6 Character 40 Character 50 Character 20 Numeric 8 2 Numeric 8 2 Numeric 12 3 Numeric 12 3 Logical 1 Date 8 Memo
Main Program
In order to avoid typing a lot of stuff in the command line each time we wish to start our application, let us design a good Main.PRG (Do It!) Modify Command Main Set Default To C:\Temp\Products <-- establish the default drive/folder Use Client <-- commented open database Client.DBF Set Deleted On <-- turn on the deleted filter Set Bell Off <-- turn off the bell Set Near On <-- allow searching to find a near match Set Procedure To Code <-- associate the button code file for the current screen application Clear <-- clear the console screen Do Form Products <-- run the Products screen form
Using the mouse, select the Set As Default button. (Do It!) Until this configuration is changed, all new screens will be designed for low resolution 640 x 480 monitors with snap to grid set to 6 pixels.
Using the mouse, hold down the form menu and select QuickForm as illustrated above. A form builder will now emerge. As is the case with the other FoxPro Menus, the Form Control menu may be in the menubar at the top, may be loose on the screen (as illustrated above) or may be closed. If closed, the toolbar may be opened by holding down the View Menu and selecting Forms Control Tool Bar.
Used to add the selected field from the Products database table to the Selected Fields list used to construct controls for the new form.
Used to add all fields from the Products database table to the Selected Fields list used to construct controls for the new form. Used to remove the selected field from the Selected Fields list. Used to remove all fields from the Selected Fields list. Let us select all fields. (See Below)
Select the Embossed Style and Select the OK button. (See Below)
FoxPro has now given its best shot at an automated form for the Products database table.
designed screen forms. When using the quick form, the field names have been selected as prompts; field names are often make very poor prompts; examples of poor prompts would be evident in the captions on the screen above : Productid, Unitprice, Lastorder, etc. The objective is to make each and every caption so explicit, that all can use the database screen without the need for clarification of data. Each caption/prompt is a text box control object whose properties may be altered. Let us change the caption of Productid to Product ID #. First use the mouse and select the text box control; when selected, a box will appear around the text box.
Second let us activate the Properties Box by holding down the right mouse button on the object and selecting Properties as demonstrated above. The Properties Box is illustrated below. This step may be omitted when the properties box is already on the desktop.
In order to change the text box control caption : select the text box control select Caption in the Properties Box
enter the desired caption in the edit box [shaded pink for identification and marked with red arrow]
It will be in the edit box of the Properties Box that many of the screen objects are changed. In the screen below, most of the captions have been changed. Original Value New Value Productid: Product ID # Supplierid: Supplier ID # Productname: Description Engname: Name Qtysize: Quantity Size Unitprice: Unit Price Unicost: Unit Cost Qtyinstock: In Stock Minqtytost: Minimum Discontinu: Discontinued Lastorder: Last Ordered Info: ----------- Prompt removed Some of the new caption information seems to be missing in the screen below; relax, since the text box control field retains its original size, some of the data is simply hidden at the moment. Shortly, I will show you how to resize the text box control field so that all of each caption might be displayed.
This button, from the form controls tool bar, can be used to add a new text box control to a screen.
at homas.
Custom colors may be configured as well. (See Below)
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections.
In order to make the text box control unbold select the text box control(s) select FontBold in the Properties Box select False from the edit box pull down menu or double click FontBold selection to change
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections.
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections.
In order to change the edit box control font size select the edit box control(s) select FontSize in the Properties Box enter the desired size in the edit box or select from the edit box pull down menu (See Below)
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections. This button, from the form controls tool bar, can be used to add a new edit box control to a screen.
In order to make the edit box control unbold select the edit box control(s) select FontBold in the Properties Box select False from the edit box pull down menu or double click FontBold selection to change
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections.
select the edit box control(s) select BackColor in the Properties Box enter the RGB [Red,Green,Blue] code in the edit window or press chart. for a color
You may use your mouse and select multiple text box controls to change at one time; hold down the shift key to continue selections.
Screen Layout
The mouse can be used to re-position objects on the screen in a drag and drop process. I. Put the most important information at the top of the screen. II. Most screens should contain 1 - 3 columns III. Avoid wild color combinations. IV. Avoid too many different size fonts. V. Try to avoid large gaps on the page.
VI. Align the prompt captions and the edit fields. The captions below need help. Select the left row of captions with the mouse on the screen below. Pull down the Format Menu and Select Align and select Align Right Sides.
The results of the right alignment may be seen below. This will also be done with the left column.
FoxPro also makes it very easy to achieve horizontal alignment in each row. Select the left row of captions with the mouse on the screen below.
Pull down the Format Menu and Select Align and select Align Right Sides.
With proper alignment, our screen now looks like the following:
modify command Code Procedure Next Skip 1 If EOF() Then Goto Top EndIf _screen.activeform.refresh Return EndProc <-- Beginning of the Procedure Next <-- Skip a record - Don't forget to indent! <-- Start of the If Then Else Decision Statement <-- When you hit the End Of File Then Goto the top of the file <-- Start of the If Then Else Decision Statement <-- Refresh the screen form <-- Return control to place that called Next <-- End of Procedure - Optional Statement
In order to change the Next push button control caption : select the push button control select Caption in the Properties Box enter the caption, Next, in the edit box (See Below)
Double click on My Computer. Double click on Temp. Double click on Products. Double click on Main.PRG <-- To start the Products screen from Windows.
Skip a couple of blank lines between your procedures to make them easier to find, edit, etc.
The code for all buttons shall be added to a file called Code.PRG. Do It! modify command Code Procedure Previous <-- Beginning of the Procedure Previous Skip -1 <-- Skip back one record - Don't forget to indent! If BOF() Then <-- Start of the If Then Else Decision Statement Goto Bottom <-- When you hit the Beginning Of File Then Goto the bottom of the file EndIf <-- Start of the If Then Else Decision Statement _screen.activeform.refresh <-- Refresh the screen form Return <-- Return control to place that called Previous EndProc <-- End of Procedure - Optional Statement
EndProc
The purpose of the Exit button is to exit the screen form. The Exit Button may be placed anywhere, that is organize effectively, the screen. The code for all buttons shall be added to a file called Code.PRG. Do It! Skip a couple of blank lines between your procedures to make them easier to find, edit, etc. modify command Code Procedure Exit <-- Beginning of the Procedure Exit _screen.activeform.release <-- Refresh the screen form Return <-- Return control to place that called Exit EndProc <-- End of Procedure - Optional Statement