VFP 愛用者社區 首頁 VFP 愛用者社區
本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 常見問題常見問題   搜尋搜尋   會員列表會員列表   會員群組會員群組   會員註冊會員註冊 
 個人資料個人資料   登入檢查您的私人訊息登入檢查您的私人訊息   登入登入

[翻譯] Chm For VFP9 Beta Release
前往頁面 上一頁  1, 2, 3 ... 8, 9, 10 ... 12, 13, 14  下一頁
 
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區
上一篇主題 :: 下一篇主題  
發表人 內容
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 121 樓

發表發表於: 星期三 十一月 03, 2004 3:40 am    文章主題: 引言回覆

如何:檢視程式碼定義


如果定義存在,當執行程式碼參照搜尋的時候,您可在目前的程式檔中找出您發現的程式碼元素的定義。相關詳細資訊請參考「如何:搜尋程式碼參照」。



如何檢視程式碼元素的定義

1.開啟程式檔到程式碼元素的位置。

2.按兩下程式碼元素的文字來選擇它。

3.按一下滑鼠右鍵顯示快顯功能表並選取 [檢視定義]。

也可以使用 DO (_FOXREF) WITH... 命令來呼叫 [檢視定義]。相關詳細資訊請參考「_FOXREF 系統變數」。

[檢視定義] 首先尋找是在來源檔案中參考的其他外部檔案,才接著搜尋在使用專案中的檔案。如果多個程式碼元素定義存在,[移至定義] 視窗出現可讓您選取一個定義。

如果定義不能夠在使用專案中的檔案被發現,[檢視定義] 搜尋其他的開啟的專案或資料夾。如果定義在這些位置的其中一個中被發現,[移至定義] 視窗開啟您所選取的正確位置。相關詳細資訊請參考「[移至定義] 視窗」。

如果程式碼元素是使用者定義的,而且定義被發現,Visual FoxPro 對定義的位置開啟一個編輯視窗。如果所選取的項目是 Visual FoxPro 本身的命令或函數時,Visual FoxPro 說明會開啟該項目的說明主題。如果所選取的項目是一個檔案名稱時,比如 #INCLUDE 陳述或 SET PROCEDURE 命令,Visual FoxPro 會開啟該檔案。



相關資訊

處理程式

處理專案




----------------------------------------------------------------------------------------------
原文:


How to: View Code Definitions


When performing a code reference search, you can locate the definition of a code element that you found in the current program file, if the definition exists. For more information, see How to: Search For Code References.



To view the definition of a code element

1.Open the program file to the location of the code element.

2.Double-click the text of the code element to select it.

3.Right-click to display the shortcut menu, and select View Definition.

You can also call View Definition using the DO (_FOXREF) WITH...command. For more information, see _FOXREF System Variable.

View Definition first searches for other external file references that are in the source file, followed by files in the active project. If multiple code element definitions exist, the Go To Definition window appears so you can select a defintion.

If the definition cannot be found in a file for the active project, View Definition searches other open projects or folders. If the definition is found in one of these locations, the Go To Definition window opens for you to select the correct location. For more information, see Go To Definition Window.

If the code element is user-defined, and the definition is found, Visual FoxPro opens an editing window to the location of the definition. If the item you select is a native Visual FoxPro command or function, the Visual FoxPro Help opens the Help topic for that item. If the item you select is a file name, such as for a #INCLUDE statement or SET PROCEDURE command, Visual FoxPro opens the file.



See Also

Working with Programs

Working with Projects

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 122 樓

發表發表於: 星期四 十一月 04, 2004 12:49 am    文章主題: 引言回覆

如何:從專案中移除檔案


您可以從您的專案中移除或刪除檔案。



如何從專案中移除檔案

1.開啟您應用程式的專案。

2.在 [專案管理員] 中,展開在專案階層結構中包含您想要移除的元件類型的節點。

3.按一下要移除的檔案。

4.在 [專案] 功能表上,按一下 [加入檔案]。

提示:
也可以在 [專案管理員] 中按一下 [移除]。

5.當 Visual FoxPro 提醒您確認移除該檔案時,可執行下列之一:

•若只是從您的專案中移除該檔案時,請按 [移除]。
•若要從磁碟中刪除該檔案,請按 [刪除]。


相關詳細資訊請參考「[專案管理員] 視窗」。



相關資訊

處理專案




----------------------------------------------------------------------------------------------
原文:


How to: Remove Files from Projects


You can remove files from your project or delete them.



To remove a file from a project

1.Open the project for your application.

2.In the Project Manager, expand the node in the project hierarchy containing the component type that you want to remove.

3.Click the file you want to remove.

4.On the Project menu, click Add File.

Tip:
You can also click Remove in the Project Manager.

5.When Visual FoxPro prompts you to confirm removing the file, perform one of the following:

•To remove the file only from your project, click Remove.
•To delete the file from disk, click Delete.


For more information, see Project Manager Window.



See Also

Working with Projects

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 123 樓

發表發表於: 星期四 十一月 04, 2004 11:13 pm    文章主題: 引言回覆

延伸 Visual FoxPro 的專案

你能以程式撰寫方式存取和處理專案比如使用專案管理員連鉤的物件。



在本章節中


專案管理員連鉤

介紹專案管理員連鉤和能以程式撰寫方式執行專案的作業。


專案物件的階層架構

描述專案物件的階層架構以及相關聯的專案連鉤物件。


專案物件的結構

描述語言元素,諸如子句和專案事件,那是專案物件的結構的一部分。



相關章節


處理專案

定義一個專案組態和一組產生一個程式的檔案或最後的二進位檔案或檔案。


開發生產力工具

在 Visual FoxPro 應用程式和語言中,為程式開發人員提供應用程式的開發工具之資訊。




----------------------------------------------------------------------------------------------
原文:


Extending Projects in Visual FoxPro


You can access and manipulate projects programmatically as objects using Project Manager hooks.



In This Section


Project Manager Hooks

Introduces Project Manager hooks and tasks you can perform with projects programmatically.


Project Object Hierarchy

Describes the hierarchy for a project object and its associated ProjectHook object.


Project Object Architecture

Describes language elements, such as clauses and project events, that are part of the project object architecture.



Related Sections


Working with Projects

Defines a project a configuration and a group of files that produce a program or final binary file or files.


Development Productivity Tools

Provides information on developer tools provided for application development within the Visual FoxPro application and the language.

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 124 樓

發表發表於: 星期五 十一月 05, 2004 11:30 pm    文章主題: 引言回覆

專案管理員連鉤


在 Visual FoxPro 中,可以以程式方式來存取專案,並且將專案當作物件來處理。當在設計期間在 [專案管理員] 中專案被開啟或在設計期間和執行期間 [專案管理員] 是非可視的情況,您可以處理專案。



提示:
若要以不顯示 [專案管理員] 而以程式撰寫方式來處理開啟或修改專案,請使用在 CREATE PROJECT 和 MODIFY PROJECT 命令中的 NOSHOW 子句。稍後您可以使用專案的 Visible 屬性來顯示 [專案管理員]。相關詳細資訊請參考「CREATE PROJECT 命令」和「MODIFY PROJECT 命令」。

下午各項清單描述一些您能以程式撰寫方式使用一個專案執行的動作:

•開啟和修改專案中的檔案。
•在專案中加入或刪除檔案。
•確定專案中檔案的數量和類型。
•更改專案的屬性。
•更改專案中檔案的屬性。
•更改自動化伺服應用程式的屬性 (.dll 動態連結程式庫或 .exe 執行檔),這些程式是由專案產生的。
•在專案中發生事件時,執行程式碼。
•重建專案或者從專案中建立 .app、.exe 或 .dll 檔案。
•將專案中的檔案加入到版本管理應用程式 (如 Microsoft Visual SourceSafe) 中,並從版本管理中簽入或簽出檔案。

注意:
如果把一個專案加入到 Visual SourceSafe,為了正確對應到專案,包含在專案中的所有檔案必須是在專案目錄或路徑中。


做為一個進階的程式開發人員,您也可以建立自訂的專案管理員。



相關資訊

專案物件的階層架構

專案物件的結構

延伸 Visual FoxPro 的專案




----------------------------------------------------------------------------------------------
原文:


Project Manager Hooks


In Visual FoxPro, you can access a project programmatically and manipulate a project as an object. You can manipulate a project while the project is open in the Project Manager at design time or while the Project Manager is not visible at design time and run time.



Tip:
To open or modify a project so you can manipulate it programmatically without displaying the Project Manager, use the NOSHOW clause in the CREATE PROJECT and MODIFY PROJECT commands. You can use the project's Visible property to display the Project Manager later. For more information, see CREATE PROJECT Command and MODIFY PROJECT Command.

The following lists describes some of the actions you can perform programmatically with a project:

•Open and modify files in the project.
•Add or delete files from a project.
•Determine the number of files in a project and their types.
•Change properties of the project.
•Change properties of files in the project.
•Change properties of Automation servers, which are dynamic-link library (.dll) files or executable (.exe) built from the project.
•Execute code when events occur in the project.
•Rebuild the project or build .app, .exe, or .dll files from the project.
•Add files in the project to source code control applications, such as Microsoft Visual SourceSafe, and check files in and out of source code control.

Note:
If you add a project to Visual SourceSafe, all files contained in the project must be in the project directory or path for proper mapping to the project.


As an advanced developer, you can also create customized project managers.



See Also

Project Object Hierarchy

Project Object Architecture

Extending Projects in Visual FoxPro

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 125 樓

發表發表於: 星期日 十一月 07, 2004 12:05 am    文章主題: 引言回覆

專案物件的階層架構


專案階層架構是由專案集合、在集合中的專案物件以及與每個專案物件相關聯的專案連鉤物件所組成的。而專案物件又包含了一個檔案集合,其中有專案檔案、伺服應用程式集合 (內含從專案中建立的自動化伺服應用程式)。

下圖顯示了 Visual FoxPro 物件模型中專案的階層架構:

當建立、開啟或重建專案,或者從專案中建立應用程式檔案 (.app)、動態連結函數庫檔案 (.dll)、執行檔 (.exe) 時,對專案物件進行起始化。當與一個專案連鉤類別相關聯的專案開啟時,專案連鉤物件依預設值進行起始化。

專案中發生事件時,專案物件會將該事件傳遞到專案連鉤物件,然後便會執行專案連鉤物件中事件的使用者程式碼,並將控制權傳回給專案物件。從專案連鉤物件傳回到專案物件的傳回值將會決定專案物件是否完成了操作。

提示:
將 NODEFAULT 放在事件代碼中可以防止執行預設的動作。例如,將 NODEFAULT 放在專案連鉤物件的 QueryAddFile 的事件代碼中,便可防止將檔案加入到專案中。


下列各項章節包含更多有關專案階層架構的資訊:

•專案階層架構中的專案集合
•專案階層架構中的專案物件
•專案階層架構中的專案連鉤物件



專案階層架構中的專案集合

專案集合提供對專案物件直接存取,可讓您處理專案、檔案和專案所包含的伺服應用程式。當建立或開啟專案,或者從專案中建立應用程式檔案 (.app)、動態連結函數庫檔案 (.dll)、執行檔 (.exe) 時,專案物件會加入到專案集合。

您可以取得有關在專案集合中的專案使用它的屬性與方法程序的資訊。例如,下列的程式碼行展示兩個方法來顯示專案集合中的專案名稱。第一個範例使用專案集合的 Count 屬性和 Item 方法程序。第二個範例使用 FOR EACH 命令。

nProjectCount = Application.Projects.Count
FOR nCount = 1 TO nProjectCount
? Application.Projects.Item(nCount).Name
NEXT
FOR EACH oProj IN Application.Projects
? oProj.Name
ENDFOR


相關詳細資訊請參考「專案集合」。



專案階層架構中的專案物件

當建立、開啟或重建專案,或者從專案中建立應用程式檔案 (.app)、動態連結函數庫檔案 (.dll)、執行檔 (.exe) 時,對專案物件進行起始化。而專案物件又包含了一個檔案集合,其中有專案檔案、伺服應用程式集合 (內含從專案中建立的自動化伺服應用程式)。

使用專案物件,可讓您以程式方式來處理專案,而且可以透過應用程式物件對其進行存取。應用程式物件有一個 ActiveProject 屬性,對於在目前使用的 [專案管理員] 中開啟的專案,提供一個物件參考。

您可以透過專案物件的屬性和方法程序來處理它。相關詳細資訊請參考「專案物件」和「應用程式物件」。


檔案集合

檔案集合提供對檔案物件直接存取,可讓您在專案開啟時處理專案中的檔案物件。您可以使用檔案物件的屬性和方法程序來處理它。相關詳細資訊請參考「檔案物件」。

您能以程式撰寫模式向專案中加入檔案。例如,下面這行程式碼使用應用程式物件的 ActiveProject 屬性,在目前使用的專案中加入一個程式 Main.prg︰

Application.ActiveProject.Files.Add('Main.prg')

下面這行程式碼在第一個加入到專案集合中的專案中加入 Main.prg 程式︰

Application.Projects[1].Files.Add('Main.prg')

您可以取得有關在檔案集合中的檔案使用它的屬性與方法程序的資訊。例如,下列的程式碼行展示兩個方法來顯示檔案集合中的檔案名稱。第一個範例使用檔案集合的 Count 屬性和 Item 方法程序。 第二個範例使用 FOR EACH 命令。

nFileCount = Application.ActiveProject.Files.Count
FOR nCount = 1 TO nFileCount
? Application.ActiveProject.Files.Item(nCount).Name
NEXT
FOR EACH oProj IN Application.ActiveProject.Files
? oProj.Name
ENDFOR

相關詳細資訊請參考「檔案集合」。


伺服應用程式集合

伺服應用程式集合提供對伺服應用程式物件直接存取,可讓您處理專案所包含的伺服應用程式物件。您可以透過伺服應用程式集合的屬性和方法程序來處理它。相關詳細資訊請參考「伺服應用程式集合」。

從專案中建立一個包含自動化伺服應用程式的動態連結函數庫檔案 (.dll) 或執行檔 (.exe) 時,便會在伺服應用程式集合中加入伺服應用程式物件。有關建立自動化伺服應用程式的詳細資訊請參閱在「共用資訊和新增 OLE」中的「如何:建立自動化伺服應用程式」。

注意:
只有在進行起始化包含在 DEFINE CLASS 命令中指定的 OLEPUBLIC 類別的專案之後,才能建立伺服應用程式物件。相關詳細資訊請參考「DEFINE CLASS 命令」。


透過伺服應用程式物件可以取得專案中包含的有關自動化伺服應用程式的資訊,例如,類型函數庫的資訊。在 [專案資訊] 對話方塊中的 [伺服應用程式] 標籤也可以得到這些資訊。相關詳細資訊請參考「[伺服應用程式] 標籤,[選項] 對話方塊」。

您可以使用伺服應用程式物件的屬性來處理在伺服應用程式集合中的伺服應用程式物件。相關詳細資訊請參考「伺服應用程式物件」。



專案階層架構中的專案連鉤物件

當與一個專案連鉤類別相關聯的專案開啟時,專案連鉤物件依預設值進行起始化。

提示:
如何在 CREATE PROJECT 和 MODIFY PROJECT 命令中含入 NOPROJECTHOOK 子句,以防止將該專案的專案連鉤物件進行起始化。更多的請參閱「CREATE PROJECT 命令」和「MODIFY PROJECT 命令」。

專案連鉤物件可讓您以程式化的方式來存取專案中發生的事件。例如,每當在專案中加入檔案時,便執行程式碼。專案連鉤物件不同於專案物件,它包含了所有在 [專案資訊] 對話方塊中可用的屬性和方法程序。相關詳細資訊請參考「[專案資訊] 對話方塊」。

預設的專案連鉤類別在 [選項] 對話方塊的 [專案] 標籤被新專案所指定。您還可以在 [專案資訊] 對話方塊中,為個別專案指定不同的專案的連鉤類別來覆蓋預設的專案連鉤類別。但是,如果沒有在 [專案] 標籤中為專案指定預設的專案連鉤類別,新專案將不會指定任何專案連鉤物件。相關詳細資訊請參考「[專案] 標籤,[選項] 對話方塊」。

在執行時期,則可使用 ProjectHook 屬性為專案指定專案的連鉤類別。如果更改了專案的專案連鉤類別,只有當關閉該專案並重新將其開啟時,新的專案連鉤類別才會產生作用。

您可以透過屬性、方法程序和事件來處理專案連鉤物件。相關詳細資訊請參考「專案連鉤物件」。



相關資訊

專案管理員連鉤

專案物件的結構

延伸 Visual FoxPro 的專案

處理專案




----------------------------------------------------------------------------------------------
原文:


Project Object Hierarchy


The project hierarchy consists of the Projects collection, Project objects in the collection, and a ProjectHook object associated with each project object. A Project object contains a Files collection consisting of project files and a Servers collection consisting of Automation servers created from the project.

The following diagram illustrates the project hierarchy within the Visual FoxPro object model.

A Project object is instantiated when a project is created, opened, or rebuilt, or when an application (.app) file, dynamic-link library (.dll) file, or executable (.exe) file is built from the project. When a project associated with a ProjectHook class opens, a ProjectHook object is instantiated by default.

When an event occurs in a project, the Project object passes the event to the ProjectHook object. User code in the event of the ProjectHook object executes and passes control back to the Project object. The value returned to the Project object from the ProjectHook object determines whether the Project object finishes the operation.

Tip:
Placing NODEFAULT in the event code prevents the default action from being performed. For example, placing NODEFAULT in the QueryAddFile event of a ProjectHook object prevents a file from being added to a project.

The following sections contain more information about the project hierarchy:

•Projects Collection in the Project Hierarchy
•Project Object in the Project Hierarchy
•ProjectHook Object in the Project Hierarchy



Projects Collection in the Project Hierarchy

The Projects collection provides direct access to Project objects, making it possible for you to manipulate a project and the files and servers that the project contains. When a project is created or opened or when an application (.app) file, dynamic-link library (.dll) file, or executable (.exe) file is built from the project, a project object is added to the projects collection.

You can obtain information about a project in the Projects collection using its properties and methods. For example, the following lines of code show two ways to display the names of all projects in a Projects collection. The first example uses the Count property and Item method of a Projects collection. The second example uses the FOR EACH command.

nProjectCount = Application.Projects.Count
FOR nCount = 1 TO nProjectCount
? Application.Projects.Item(nCount).Name
NEXT
FOR EACH oProj IN Application.Projects
? oProj.Name
ENDFOR


For more information, see Projects Collection.



Project Object in the Project Hierarchy

A Project object is instantiated when a project is created, opened, or rebuilt, or when an application (.app) file, dynamic-link library (.dll) file, or executable (.exe) file is built from the project. A Project object contains a Files collection consisting of project files and a Servers collection consisting of Automation servers created from the project.

The Project object makes it possible for you manipulate a project programmatically and to access it through an Application object. The Application object has an ActiveProject property that provides an object reference to an open project in the currently active Project Manager.

You can manipulate a Project object through its properties and methods. For more information, see Project Object and Application Object.


Files Collection

The Files collection provides direct access to a File object, which makes it possible for you to manipulate File objects in a project while the project is open. You can manipulate a File object using its properties and methods. For more information, see File Object.

You can add files to a project programmatically. For example, the following line of code uses the ActiveProject property of an Application object to add a program, Main.prg, to the currently active project:

Application.ActiveProject.Files.Add('Main.prg')

The following line of code adds Main.prg to the first project in the Projects collection:

Application.Projects[1].Files.Add('Main.prg')

You can obtain information about a file in a Files collection using its properties and methods. For example, the following lines of code show two ways to display the names of all files in a Files collection. The first example uses the Count property and Item method of a Files collection. The second example uses the FOR EACH command.

nFileCount = Application.ActiveProject.Files.Count
FOR nCount = 1 TO nFileCount
? Application.ActiveProject.Files.Item(nCount).Name
NEXT
FOR EACH oProj IN Application.ActiveProject.Files
? oProj.Name
ENDFOR

For more information, see Files Collection.


Servers Collection

The Servers collection provides direct access to a Server object, which makes it possible for you to manipulate Server objects that a project contains. You can manipulate a Servers collection through its properties and methods. For more information, see Servers Collection.

When you build a dynamic-link library (.dll) file or executable (.exe) file containing an Automation server from the project, a Server object is added to the Servers collection. For more information about creating Automation servers, see How to: Create Automation Servers in Sharing Information and Adding OLE.

Note:
A Server object is not instantiated until the project containing the OLEPUBLIC class, specified in the DEFINE CLASS command, is built. For more information, see DEFINE CLASS Command.

A Server object makes it possible for you to obtain information about Automation servers contained in a project, for example, type library information. This information is also available on the Servers tab in the Project Information dialog box. For more information, see Servers Tab, Options Dialog Box.

You can manipulate a Server object in a Servers collection using its properties. For more information, see Server Object.


ProjectHook Object in the Project Hierarchy

When a project associated with a ProjectHook class opens, a ProjectHook object is instantiated by default.

Tip:
To prevent a ProjectHook object from instantiating for the project, include the NOPROJECTHOOK clause in CREATE PROJECT and MODIFY PROJECT commands. For more, see CREATE PROJECT Command and MODIFY PROJECT Command.

The ProjectHook object and allows programmatic access to events that occur in a project. For example, you can execute code when adding a file to a project. The ProjectHook object differs from a Project object, which contains all the properties and methods available in the Project Information dialog box. For more information, see Project Information Dialog Box.

The default ProjectHook class is specified for new projects in the Projects tab of the Options dialog box. You can override the default ProjectHook class by specifying a different project hook class for an individual project in the Project Information dialog box. However, if no default ProjectHook class is specified in the Projects tab, new projects are not associated with a ProjectHook object. For more information, see Projects Tab, Options Dialog Box.

At run time, you can use the ProjectHook property to specify a project hook class for a project. If you change the ProjectHook class for a project, the new ProjectHook class does not take effect until the project closes and opens again.

You can manipulate a ProjectHook object through properties, methods, and events. For more information, see ProjectHook Object.



See Also

Project Manager Hooks

Project Object Architecture

Extending Projects in Visual FoxPro

Working with Projects

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 126 樓

發表發表於: 星期日 十一月 07, 2004 10:54 pm    文章主題: 引言回覆

專案物件的結構


Visual FoxPro 專案物件提供了一個 IDispatch 介面,使得自動化客戶端、ActiveX 控制項和其他 COM 物件可以透過標準的 OLE 介面存取專案物件。由於專案物件提供了 IDispatch 介面,因此在處理專案時可能發生的錯誤都是 OLE 錯誤。



專案事件

下面的內容描述建立、修改、關閉、產生專案等操作時所發生的事件,以及發生的順序。


建立新專案

當您執行 CREATE PROJECT 命令、從 [檔案] 功能表中建立新專案、或按一下在標準工具列上的 [開新檔案] 按鈕來建立新專案時,將會發生下列事件︰

1.建立專案物件。
2.起始化專案連鉤物件。
3.發生專案連鉤物件的 Init 事件。如果 Init 事件的傳回值為真 (.T.) (預設值),將會建立專案,並在 [專案管理員] 中顯示該專案。 如果 Init 事件傳回值為假 (.F.),將不會建立專案,並釋放專案連鉤物件,[專案管理員] 也不會顯示出來。


修改既存的專案

當您執行 MODIFY PROJECT 命令、從 [檔案] 功能表中修改既存的專案、或按一下在標準工具列上的 [開啟] 按鈕來開啟既存的專案或建立新專案時,將會發生下列事件︰

1.建立專案物件。專案物件會從專案的 .pjx 檔案得到其值。
2.起始化專案連鉤物件。
3.發生專案連鉤物件的 Init 事件。如果 Init 事件傳回值為真 (.T.) (預設值),將會開啟該專案,以便在 [專案管理員] 中進行修改。 如果 Init 事件傳回值為假 (.F.),則不會開啟該專案,並釋放專案和專案連鉤物件,[專案管理員] 也不會顯示出來。


關閉專案

關閉一個開啟的專案時,會發生下列事件︰

1.發生專案連鉤的 Destroy 事件,並釋放專案連鉤物件。
2.釋放專案物件。


發出 BUILD APP、BUILD DLL 或 BUILD EXE 命令

發出 BUILD APP、BUILD DLL 或 BUILD EXE 命令時,將發生下列事件︰

1.建立專案物件。專案物件會從專案的 .pjx 檔案得到其值。
2.起始化專案連鉤物件。
3.發生專案連鉤物件的 Init 事件。如果 Init 事件傳回值為真 (.T.) (預設值),將會發生專案連鉤的 BeforeBuild 事件。如果 BeforeBuild 事件中包含 NODEFAULT,則不會建立 .app、.dll 或 .exe。反之,則會繼續建立程序。 如果在建立程序中將檔案加入到專案中,則在加入檔案之前會發生專案連鉤的 QueryAddFile 事件。如果 QueryAddFile 事件中包含 NODEFAULT,則不會在專案中加入檔案。反之,則會將該檔案加入到專案中。當 .app、.dll 或 .exe 檔案成功地建立後,將發生專案連鉤的 AfterBuild 事件,然後接著發生專案連鉤的 Destroy 事件。 如果 Init 事件傳回值為假 (.F.),則不會建立 .app、.dll 或 .exe 檔案,並釋放專案和專案連鉤物件。


發出 BUILD PROJECT 命令

發出含有 FROM 子句的 BUILD PROJECT 命令時,將發生下列事件。如果省略 FROM 子句,則事件會按照上述 BUILD APP、BUILD DLL 或 BUILD EXE 命令的發出順序發生。

1.建立專案物件。專案物件會從專案的 .pjx 檔案得到其值。
2.起始化專案連鉤物件。
3.發生專案連鉤物件的 Init 事件。如果 Init 事件傳回值為真 (.T.) (預設值),由 FROM 子句指定的檔案將會分別加入到專案中。專案連鉤物件的 QueryAddFile 事件會在將檔案加入到專案之前發生。如果 QueryAddFile 事件中包含 NODEFAULT,則檔案將不會加入到專案中。反之,則會將該檔案加入到專案中。 接著將發生專案連鉤物件的 BeforeBuild 事件。如果 BeforeBuild 事件中包含 NODEFAULT,則不會建立專案。反之,將會建立該專案。
4.建立完成後,將發生專案連鉤的 AfterBuild 事件,然後再接著發生專案連鉤的 Destroy 事件。 如果專案連鉤的 Init 事件傳回值為假 (.F.),則不會建立該專案,並釋放專案和專案連鉤物件,而且不會建立新的 .pjx 檔案。


使用拖放操作

當您將一個檔案或一組檔案拖曳到 [專案管理員] 的大綱部分 (樹狀資料集) 時,將發生下列事件︰

1.當滑鼠指標停留在 [專案管理員] 的大綱部分時,將發生專案連鉤的 OLEDragOver 事件,nState 參數設定為 0 (Foxpro.h 中的 DRAG_ENTER)。然後會重複發生 OLEDragOver 事件,而 nState 參數則設定為 2 (Foxpro.h 中的 DRAG_OVER)。如果滑鼠指標移到 [專案管理員] 的大綱部分之外,則會發生 OLEDragOver 事件,nState 參數設定為 1 (Foxpro.h 中的 DRAG_LEAVE)。
2.如果當滑鼠指標停留在 [專案管理員] 的大綱部分時放開滑鼠按鈕,將發生專案連鉤的 OLEDragDrop 事件。按預設值,Visual FoxPro 會將置放在專案管理員中的每個檔案都加入到專案中。專案連鉤物件的 QueryAddFile 事件會在將檔案加入到專案之前發生。


使用 [加入] 按鈕加入檔案

當您按一下 [專案管理員] 中的 [加入] 按鈕,將檔案加入到專案中時,將會發生下列事件︰

1.顯示 [開啟] 對話方塊。
2.如果選取檔案,並且選擇 [確定],將為選取的檔案建立一個檔案物件。
3.發生專案連鉤的 QueryAddFile 事件,並將檔案物件的名稱傳遞到事件。如果 QueryAddFile 事件中包含 NODEFAULT,則檔案將不會加入到專案中。反之,則會將該檔案加入到專案中。


使用 [新建] 按鈕加入檔案

當您按一下 [專案管理員] 中的 [開新檔案] 按鈕,將新檔案加入到專案中時,將發生下列事件︰

1.顯示適合於該檔案的設計工具或編輯器。
2.儲存新檔案時,顯示 [另存新檔] 對話方塊。按一下 [儲存檔案],可為新檔案建立一個檔案物件。
3.發生專案連鉤的 QueryAddFile 事件,並將檔案物件的名稱傳遞到事件。如果 QueryAddFile 事件中包含 NODEFAULT,則檔案將不會加入到專案中。反之,則會將該檔案加入到專案中。


使用 [修改] 按鈕修改檔案

當您按一下 [專案管理員] 中的 [修改] 按鈕,修改專案中的一個檔案時,將發生下列事件︰

1.在顯示適合於檔案的設計工具或編輯器之前,發生專案連鉤的 QueryModifyFile 事件。
2.將需要修改之檔案的檔案物件當作參數傳遞到 QueryModifyFile 事件。如果 QueryModifyFile 事件中不包含 NODEFAULT,則不會顯示適合於與該檔案的設計工具或編輯器,而且不會修改該檔案。反之,則會在適合的設計工具或編輯器中開啟該檔案。


使用 [移出] 按鈕刪除檔案

當您按一下 [專案管理員] 中的 [移出] 按鈕,刪除專案中的檔案時,將發生下列事件︰

1.發生專案連鉤的 QueryRemoveFile 事件。
2.將需要移除之檔案的檔案物件當作參數傳遞到 QueryRemoveFile 事件。如果 QueryRemoveFile 事件中不包含 NODEFAULT,則不會從專案中移除該檔案。反之,則會從專案中將該檔案移除。


使用 [執行] 按鈕執行程式檔

當您按一下 [專案管理員] 中的 [執行] 按鈕,執行專案中的檔案時,將發生下列事件︰

1.發生專案連鉤的 QueryRunFile 事件。
2.將需要執行之檔案的檔案物件當作參數傳遞到 QueryRunFile 事件。如果 QueryRunFile 事件中不包含 NODEFAULT,則不會執行該檔案。反之,則會執行該檔案。


使用 [建立] 按鈕重新建立一個專案或者建立檔案

當您按一下 [專案管理員] 中的 [建立] 按鈕,重新建立一個專案,或者從專案中建立一個 .app、.dll 或 .exe 檔案時,將發生下列事件︰

1.顯示 [編譯連結選項] 對話方塊。
2.選取 [重建專案]、[建立應用程式檔]、[建立可執行檔] 或 [建立 COM DLL],並指定附加的建立選項。如果按一下 [取消] 按鈕,將不會進行建立。
3.如果按一下 [確定] 按鈕,將發生專案連鉤的 BeforeBuild 事件,並且進行建立。
4.建立結束時,發生專案連鉤的 AfterBuild 事件。



相關資訊

專案管理員連鉤

專案物件的階層架構

延伸 Visual FoxPro 的專案

處理專案




----------------------------------------------------------------------------------------------
原文:


Project Object Architecture


A Visual FoxPro Projectobject exposes the IDispatch interface so that Automation clients, ActiveX controls, and other COM objects can access the project object through standard OLE interfaces. When manipulating projects, errors that might occur are OLE errors because a Projectobject exposes the IDispatch interface.



Project Events

The following sections describe events and the order in which they occur when projects are created, modified, closed, built, and so on.


Creating a New Project

The following events occur when you execute CREATE PROJECT, create a new project from the File menu, or click the New button on the standard toolbar to create a new project:

1.The Project object is created.
2.The ProjectHook object instantiates.
3.The Init event for the ProjectHook object occurs. If the Init event returns true (.T.), the default, the project is created and the project is displayed in the Project Manager. If the Init event returns false (.F.), the project isn't created, the project and ProjectHook objects are released, and the Project Manager isn't displayed.


Modifying an Existing Project

The following events occur when you execute MODIFY PROJECT, modify an existing project from the File menu, or click the Open button on the standard toolbar to open an existing or create a new project:

1.The project object is created. The project object obtains its values from the project's .pjx file.
2.The ProjectHook object is instantiated.
3.The Init event for the ProjectHook object occurs. If the Init event returns true (.T.) (the default), the project is opened for modification in the Project Manager. If the Init event returns false (.F.), the project isn't opened for modification, the project and ProjectHook objects are released, and the Project Manager isn't displayed.


Closing a Project

The following events occur when an open project is closed:

1.The ProjectHook Destroy event occurs and the ProjectHook object is released.
2.The Project object is released.


Issuing BUILD APP, BUILD DLL, or BUILD EXE

The following events occur when BUILD APP, BUILD DLL, or BUILD EXE is issued:

1.The project object is created. The project object obtains its values from the project's .pjx file.
2.The ProjectHook object is instantiated.
3.The Init event for the ProjectHook object occurs. If the Init event returns true (.T.), the default, the ProjectHook BeforeBuild event occurs. If NODEFAULT is included in the BeforeBuild event, the .app, .dll, or .exe isn't built. Otherwise, the build process continues. If any files are added to the project during the build process, the ProjectHook QueryAddFile event occurs before each file is added. If NODEFAULT is included in the QueryAddFile event, a file isn't added to the project. Otherwise, the file is added to the project. When the .app, .dll, or .exe is successfully built, the ProjectHook AfterBuild event occurs, and then the ProjectHook Destroy event occurs. If the Init event returns false (.F.), the app, .dll, or .exe isn't built, and the project and ProjectHook objects are released.


Issuing BUILD PROJECT

The following events occur when BUILD PROJECT with the FROM clause is issued. If the FROM clause is omitted, the events occur in the order described above when BUILD APP, BUILD DLL, or BUILD EXE is issued.

1.The project object is created. The project object obtains its values from the project's .pjx file.
2.The ProjectHook object is instantiated.
3.The Init event for the ProjectHook object occurs. If the Init event returns true (.T.), the default, the files specified in the FROM clause are added individually to the project. The ProjectHook QueryAddFile event occurs before each file is added to the project. If NODEFAULT is included in the QueryAddFile event, the file isn't added to the project. Otherwise, the file is added to the project. The ProjectHook BeforeBuild event then occurs. If NODEFAULT is included in the BeforeBuild event, the project isn't built. Otherwise, the project is built.
4.When the project build is complete, the ProjectHook AfterBuild event occurs, and then the ProjectHook Destroy event occurs. If the ProjectHook Init event returns false (.F.), the project isn't built. The project and ProjectHook objects are released and a new .pjx file isn't created.


Using a Drag and Drop Operation

The following events occur when you drag a file or a set of files over the outline section (treeview) of the Project Manager:

1.When the mouse pointer is positioned over the outline section of the Project Manager, the ProjectHook OLEDragOver event occurs with the nState parameter set to 0 (DRAG_ENTER in Foxpro.h). The OLEDragOver event then occurs repeatedly with thenStateparameter set to 2 (DRAG_OVER in Foxpro.h). If the mouse pointer moves outside of the outline section of the Project Manager, the OLEDragOver event occurs with the nState parameter set to 1 (DRAG_LEAVE in Foxpro.h).
2.The ProjectHook OLEDragDrop event occurs if you release the mouse button while the mouse pointer is positioned over the outline section of the Project Manager. By default, Visual FoxPro adds each file dropped on the Project Manager to the project. The ProjectHook QueryAddFile event occurs before each file is added to the project.


Adding a File with the Add Button

The following events occur when you add a file to a project by clicking the Add button in the Project Manager:

1.The Open dialog box appears.
2.If you select a file and choose OK, a file object is created for the file you select.
3.The ProjectHook QueryAddFile event occurs and the name of the file object is passed to the event. If NODEFAULT is included in the QueryAddFile event, the file isn't added to the project. Otherwise, the file is added to the project.


Adding a File with the New Button

The following events occur when you add a new file to a project by clicking the New button in the Project Manager:

1.The appropriate designer or editor for the file is displayed.
2.When the new file is saved, the Save As dialog box is displayed. Clicking Save creates a file object for the new file.
3.The ProjectHook QueryAddFile event occurs and the name of the file object is passed to the event. If NODEFAULT is included in the QueryAddFile event, the file isn't added to the project. Otherwise, the file is added to the project.


Modifying a File with the Modify Button

The following events occur when you modify a file in a project by clicking the Modify button in the Project Manager:

1.The ProjectHook QueryModifyFile event occurs before the appropriate designer or editor for the file is displayed.
2.The file object for the file to modify is passed as a parameter to the QueryModifyFile event. If NODEFAULT is included in the QueryModifyFile event, the appropriate designer or editor for the file isn't displayed and the file isn't modified. Otherwise, the file is opened in the appropriate designer or editor for modification.


Removing a File with the Remove Button

The following events occur when you remove a file in a project by clicking the Remove button in the Project Manager:

1.The ProjectHook QueryRemoveFile event occurs.
2.The file object for the file to be removed is passed as a parameter to the QueryRemoveFile event. If NODEFAULT is included in the QueryRemoveFile event, the file isn't removed from the project. Otherwise, the file is removed from the project.


Executing a File with the Run Button

The following events occur when you execute a file in a project by clicking the Run button in the Project Manager:

1.The ProjectHook QueryRunFile event occurs.
2.The file object for the file to be executed is passed as a parameter to the QueryRunFile event. If NODEFAULT is included in the QueryRunFile event, the file isn't executed. Otherwise, the file is executed.


Rebuilding a Project or Building a File with the Build Button

The following events occur when you rebuild the project or build an .app, .dll, or .exe from a project by clicking the Build button in the Project Manager:

1.The Build Options dialog box is displayed.
2.You can choose Rebuild Project, Build Application, Build Executable, or Build COM DLL, and specify additional build options. If you click Cancel, the build doesn't occur.
3.The ProjectHook BeforeBuild event occurs if you click OK, and the build process begins.
4.When the build is completed, the ProjectHook AfterBuild event occurs.



See Also

Project Manager Hooks

Project Object Hierarchy

Extending Projects in Visual FoxPro

Working with Projects

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 127 樓

發表發表於: 星期二 十一月 09, 2004 2:32 am    文章主題: 引言回覆

組態應用程式


您需要適當地組態您的 Visual FoxPro 應用程式以便它執行依照在應用程式規劃期間的規格設定。典型的情況是,可以建立一個應用程式物件來完成這些任務。也可以使用一個主程式來完成這些任務。



在本章節中


如何:設定起始點

說明該如何設計一個檔案作為主程式以及應用程式的起始點。


在應用程式中的主程式

介紹在應用程式中使用主程式。


如何:起始化環境

描述該如何組態應用程式的環境。


如何:控制事件的迴圈

描述該如何啟動及停止應用程式的事件迴圈。


如何:自訂應用程式的外觀

描述該如何改變應用程式的外觀,例如,不改變程式碼而變更應用程式的圖示或標題。



相關章節


建立應用程式

說明該如何發展 Visual FoxPro 應用程式的概念、建立資料庫和使用者界面的指令以及其他任務需要產生 Visual FoxPro 應用程式。


應用程式架構

描述 Visual FoxPro 應用程式架構如何因您決定建立的應用程式的類型而改變。




----------------------------------------------------------------------------------------------
原文:


Configuring an Application


You need to configure your Visual FoxPro application properly so that it performs according to the specifications set during application planning. Typically, you might create an application object to perform these tasks. You can also use a main file to handle these tasks.



In This Section


How to: Set the Starting Point

Explains how to designate a file as the main file and starting point of your application.


Main Files in Applications

Introduces using main files in applications.


How to: Initialize the Environment

Describes how to configure the application environment.


How to: Control the Event Loop

Describes how to start and stop the event loop for an application.


How to: Customize the Appearance of Applications

Describes how you can change the appearance of your application, for example, the application icon or title, without changing code.



Related Sections


Creating Applications

Explains concepts about how to develop Visual FoxPro applications, instructions for creating databases and the user interface, and other tasks needed for Visual FoxPro applications.


Application Architecture

Describes how Visual FoxPro application architecture varies with the type of application you decide to create.

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 128 樓

發表發表於: 星期三 十一月 10, 2004 12:49 am    文章主題: 引言回覆

如何:設定起始點


每個應用程式只能包含一個主程式,該主程式為應用程式設定一個起始點,在應用程式中完成主要工作並將各個元件聯結在一起。

注意:
專案中僅有一個檔案可以設定為主程式。

當使用應用程式精靈建立應用程式的專案時,此精靈會自動建立一個主程式。不過,您可以修改此精靈所建立的主程式,或者在專案中設計不同的檔案作為主程式。

應用程式精靈也可以建立應用程式物件來讓您處理應用程式。由應用程式精靈所建立的主程式中包括範例化和組態應用程式物件的片段。



若要設定應用程式的主程式

1.開啟您應用程式的專案。

2.在 [專案管理員] 中,展開包含您想要的檔案所在的節點。

3.選定要設定為主程式的檔案。

4.在 [專案] 功能表上按一下 [設定主程式]。


在 [專案管理員] 中,主程式檔用粗體表示。

注意:
應用程式的主程式在建立過程中會自動包含進去,並且在編譯連結完應用程式時會標示為唯讀。



相關資訊

在應用程式中的主程式

組態應用程式




----------------------------------------------------------------------------------------------
原文:


How to: Set the Starting Point


All applications must have a main file, which is a file that sets the starting point for your application, performs the major tasks in your application, and links components in the application together.

Note:
You can set only one file in a project as the main file.

When you use the Application Wizard to create the project for your application, the wizard creates a main program file automatically. However, you can modify the main file created by the wizard or designate a different file in the project as the main file.

The Application Wizard also creates an application object you can use to manipulate your application. The main program created by the Application Wizard includes sections for instantiating and configuring the application object.



To set a main file for an application

1.Open the project for your application.

2.In the Project Manager, expand the nodes containing the file you want.

3.Click the file to select it.

4.On the Project menu, click Set Main.

The name of the main file appears in bold in the Project Manager.

Note:
The file that you set as the main file is included in the build process automatically and is marked as read-only when you compile the application.



See Also

Main Files in Applications

Configuring an Application

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 129 樓

發表發表於: 星期三 十一月 10, 2004 10:46 pm    文章主題: 引言回覆

在應用程式中的主程式


應用程式中的主程式可以是一個程式或一個表單。雖然,以程式檔 (.prg) 作為主程式是最好的方法,但可以將主程式的功能和起始的使用者界面整合在一起。當使用者執行應用程式時,Visual FoxPro 將為應用程式啟動主程式,然後主程式再依次呼叫所需要的應用程式。



如果在應用程式中使用一個程式檔案作為主程式,請確定它包含了處理在應用程式中主要任務的命令。但是,在主程式中,沒有必要直接包含執行所有任務的命令。例如,主程式可以呼叫程序或者函數來控制像環境起始化和清除記憶體這樣的任務。

以下列出包含和描述在主程式檔案中的主要任務與執行它們的次序:

1.透過開啟資料庫、變數宣告等等進行應用程式的環境起始化。相關詳細資訊請參考「如何:起始化環境」。

2.呼叫一個功能表或表單來建立和顯示起始的使用者界面。 起始的使用者界面可以是個功能表,也可以是一個表單或其他的使用者元件。 有時,在顯示已開啟的功能表或者表單之前,應用程式顯示 [登入] 方塊要求使用者認證。 在主程式中,使用 DO 命令執行一個功能表,或者使用 DO FORM 命令執行一個表單對使用者界面進行起始化。 例如,下面這行程式碼呼叫 Startup 執行一個表單:

DO FORM BeginApp.scx

相關詳細資訊請參考「DO 命令」和「DO FORM 命令」。

3.建立偵測和回應使用者動作以及使用 READ EVENTS 命令控制事件迴圈。相關詳細資訊請參考「如何:控制事件的迴圈」。

4.當使用者使用功能表命令 (例如 Exit 命令) 或 [結束] 按鈕離開應用程式時結束事件處理。相關詳細資訊請參考「如何:控制事件的迴圈」。

5.當使用者結束應用程式時,回復原始的開發環境。 通常,一般建議是在公用變數、使用者自定類別或者應用程式物件的屬性中儲存預設設定值。這樣,在應用程式結束時,這些值會再次儲存起來。

提示:
如果起始化時使用的程式和回復環境的程式不同,這時,要確保可以對所儲存的值進行存取。例如,假定您呼叫了一個程序進行起始化,而呼叫另外一個程序回復環境。請確定在公用變數、使用者自定類別或者應用程式物件的屬性中儲存值,以便回復環境時使用。

注意:
用巨集替換時使用的變數名稱不要以 m. 為字首,因為 . 會被認為是變數連結,並產生一個語法錯誤。


例如,主程式可能含有下列的程式碼行:

DO SETUP.PRG
DO MAINMENU.MPR
READ EVENTS
DO CLEANUP.PRG

這些程式碼行執行下列任務:

•執行安裝程式來起始化環境。
•執行功能表檔案來建立應用程式的功能表。
•呼叫 READ EVENTS 建立事件迴圈。
•執行清理程式來回復環境。



相關資訊

如何:設定起始點

處理程式

處理表單

組態應用程式




----------------------------------------------------------------------------------------------
原文:


Main Files in Applications


The main file in an application can be a program or a form. Though the best choice for a main file is a program (.prg) file, you can combine the functionality of a main program and the user interface that the user initially sees by using a form. When users run your application, Visual FoxPro launches the main file in your application and runs all other components as needed.



If you use a program file as the main file in your application, make sure that it contains commands to handle the major tasks in your application. However, the main file does not need to issue commands directly to accomplish all the tasks. For example, the main file can call procedures or functions to handle tasks such as initializing the environment and cleaning up memory.

The following list contains and describes major tasks and the order to perform them in a main program file:

1.Initialize the environment for the application by opening databases, declaring variables, and so on. For more information, see How to: Initialize the Environment.

2.Establish and display the initial user interface by calling a menu or form. The initial user interface can be a menu, form, or any other user component. Sometimes, an application displays login box to request user credentials before displaying the opening menu or form. You can initiate the user interface in the main program by using the DO command to run a menu or the DO FORM command to run a form. For example, the following line of code runs a form called Startup:

DO FORM BeginApp.scx

For more information, see DO Command and DO FORM Command.

3.Detect and respond to user actions by establishing and control the event loop using the READ EVENTS command. For more information, see How to: Control the Event Loop.

4.End event processing when the user quits the application using a menu command, such as an Exit command, or an Exit button. For more information, see How to: Control the Event Loop.

5.Restore the environment when the user quits the application. Typically, it is recommended that you save default settings of the environment in public variables, a custom class, or as properties of an application object so that you can restore these values when quitting the application.

Tip:
If you initialize the environment using a different program than the one you use to restore it, make sure you can access the values you stored. For example, suppose you initialize the environment by calling one procedure but restore the environment by calling another. Make sure to store the values you want to restore in public variables, custom classes, or as properties of an application object.

Note:
Variable names used with macro substitution should not contain the m. prefix because the period assumes variable concatenation and produces a syntax error.


For example, a main program file might contain the following lines of code:

DO SETUP.PRG
DO MAINMENU.MPR
READ EVENTS
DO CLEANUP.PRG

These lines of code perform the following tasks:

•Run a setup program to initialize the environment
•Run a menu file to display an application menu.
•Call READ EVENTS to establish the event loop.
•Run a cleanup program to restore the environment.



See Also

How to: Set the Starting Point

Working with Programs

Working with Forms

Configuring an Application

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 130 樓

發表發表於: 星期四 十一月 11, 2004 10:46 pm    文章主題: 引言回覆

如何:起始化環境


當 Visual FoxPro 啟動時,預設 Visual FoxPro 開發環境將設定 SET 命令和系統變數的值。但是,對應用程式來說,這些值不見得是最合適的。因此,主程式或者主應用程式必須做的第一件事情就是對應用程式的環境進行起始化。

提示:
對於您的應用程式來說,一般建議是將起始的環境設定儲存起來,在啟動程式碼中為程式修改特定的環境設定。如果要檢視 Visual FoxPro 開發環境預設的設定值,在沒有組態檔的情況下鍵入 VFP -C 命令啟動 Visual FoxPro 再執行 DISPLAY STATUS 命令。相關詳細資訊請參考「DISPLAY STATUS 命令」。



若要從目前環境中檢視和儲存設定

1.在 [工具] 功能表上,按一下 [選項]。

2.在 [選項] 對話方塊中,按住 SHIFT 鍵然後按一下 [確定]。

SET 命令和其他環境設定會顯示在 [命令] 視窗中。

3.在 [命令] 視窗中,將 SET 命令和環境設定複製和黏貼到初始化程式檔案中。

您現在可以把應用程式中的 SET 命令和環境設定適當地修改。在應用程式的環境中,可能需要使用程式碼來執行下列:

•起始化變數。
•建立一個預設路徑。
•開啟需要的資料庫、獨立資料表格及索引。如果應用程式需要存取遠端資料,則起始的程式也可以提示使用者所需的註冊訊息。
•新增外部函數庫和程序檔。

例如,假定您要測試 SET TALK 命令的預設值,同時儲存該值,並將應用程式的 TALK 設為 OFF。可以在啟動程序中包含如下的程式碼:

IF SET('TALK') = "ON"
SET TALK OFF
cTalkVal = "ON"
ELSE
cTalkVal = "OFF"
ENDIF


相關詳細資訊請參考「SET 命令概觀」。



相關資訊

組態應用程式

如何:設定起始點

如何:控制事件的迴圈




----------------------------------------------------------------------------------------------
原文:


How to: Initialize the Environment


When Visual FoxPro starts, the default Visual FoxPro development environment establishes certain values for SET commands and system variables. However, these settings might not be the best environment for your application. Therefore, the first task that the main file or application object must perform is setting up the environment for the application.

Tip:
It is recommended that you save the initial environment settings and modify them to set up a specific environment for your application. To see the default values of the Visual FoxPro development environment, start Visual FoxPro without a configuration file by typing VFP -C and then call the DISPLAY STATUS command. For more information, see DISPLAY STATUS Command.



To view and save settings for the current environment

1.On the Toolsmenu, click Options.

2.In the Options dialog box, press and hold the SHIFT key while you click OK.

The SET commands and other environment settings display in the Commandwindow.

3.In the Command window, copy and paste the SET commands and environment settings into a setup program file.

You can now edit the SET commands and environment settings as appropriate for your application. In the environment for your application, you might want to include code to perform the following:

•Initialize variables.
•Establish a default path.
•Open needed databases, free tables, and indexes. If your application requires access to remote data, the initialization routine can also prompt the user for the necessary login information.
•Reference external library and procedure files.

For example, suppose you wanted to test the default value of the SET TALK command, store the value, and set TALKtoOFF for your application. You might place the following code in your setup procedure:

IF SET('TALK') = "ON"
SET TALK OFF
cTalkVal = "ON"
ELSE
cTalkVal = "OFF"
ENDIF


For more information, see SET Command Overview.



See Also

Configuring an Application

How to: Set the Starting Point

How to: Control the Event Loop

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 131 樓

發表發表於: 星期五 十一月 12, 2004 11:49 pm    文章主題: 引言回覆

如何:控制事件的迴圈


在應用程式的環境建立起來以及顯示出起始的使用者界面之後,應用程式需要建立一個事件的迴圈來偵測與回應使用者的交談方式。當使用者結束應用程式時,應用程式必須提供一種方法來結束事件的迴圈。

注意:
在啟動事件的迴圈之前,需要提供一個方法結束事件迴圈。必須確認在應用程式的使用者界面中存在一個可結束事件的迴圈的機制,例如,[結束] 按鈕或 [結束] 功能表命令。



若要建立事件的迴圈

•在應用程式的主程式中要有 READ EVENTS 命令。



READ EVENTS 命令使 Visual FoxPro 開始處理像滑鼠按一下、鍵盤輸入這樣的使用者事件。相關詳細資訊請參考「READ EVENTS 命令」。

注意:
如果在起始程序中沒有 READ EVENTS 命令,應用程式執行後將傳回到作業系統中。從執行 READ EVENTS 命令開始,到相對的 CLEAR EVENTS 命令執行期間,由於主程式中所有的處理程序全部暫停執行,因此將 READ EVENTS 命令正確地放在主程式中十分重要。例如,在一個起始程序中,可以將 READ EVENTS 作為最後一個命令,在環境已經被起始化,顯示了界面後才執行。


在開始了事件的迴圈之後,應用程式將處在最後顯示的界面元件控制之下。例如,假設你在主程式中僅執行下面的命令:

DO FORM STARTUP.SCX


應用程式將顯示表單 STARTUP.scx。在開發環境下的 [命令] 視窗中,可以正確的執行應用程式。但是,如果要在功能表或者主螢幕中執行應用程式,程式將顯示片刻,然後結束。


若要結束事件的迴圈

•可以使用一個功能表命令或者表單上的按鈕執行 CLEAR EVENTS 命令。

CLEAR EVENTS 命令將暫停執行事件處理程序,同時將控制權傳回給執行 READ EVENTS 命令的程式。

注意:
典型情況下,可以使用一個功能表項目或者表單上的按鈕執行 CLEAR EVENTS 命令。主程式不應直接執行 CLEAR EVENTS 命令。


相關詳細資訊請參考「CLEAR 命令」。



相關資訊

組態應用程式




----------------------------------------------------------------------------------------------
原文:


How to: Control the Event Loop


After setting up the environment and displaying the initial user interface, your application needs to establish an event loop so it can detect and respond to user interaction. When the user quits the application, your application must provide a way to end the event loop.

Note:
You need to establish a way to exit the event loop before you start it. Make sure the application user interface has a mechanism, for example, a Quit button or Exit menu command, to end the event loop.



To establish the event loop

•In the main file for your application, include the READ EVENTS command.



The READ EVENTS command causes Visual FoxPro to begin processing user events such as mouse clicks and keystrokes. For more information, see READ EVENTS Command.

Note:
If you do not include the READ EVENTS command, your application returns to the operating system after running. It is important to place the READ EVENTS command correctly in your main file because all processing in the main file is suspended from the time it executes the READ EVENTS command until it executes a subsequent CLEAR EVENTS command. For example, you might call the READ EVENTS command as the last command in an initialization procedure and after initializing the environment and displaying the user interface.


After the event loop begins, the application runs under the control of the user interface element that last displayed. For example, suppose you include only the following command in the main file:

DO FORM STARTUP.SCX


The application displays the form Startup.scx. Within the development environment, your application might run properly in the Command window. However, if you run the application from a menu or screen, the application appears briefly, then quits.


To end the event loop

•Call the CLEAR EVENTS command using a menu command or button on a form.

The CLEAR EVENTS command suspends the event processing and returns control to the program that called the READ EVENTS command.

Note:
Typically, you call the CLEAR EVENTS command from a menu or a button in a form. The main program file should not call CLEAR EVENTS directly.


For more information, see CLEAR Commands.



See Also

Configuring an Application

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 132 樓

發表發表於: 星期六 十一月 13, 2004 10:22 pm    文章主題: 引言回覆

如何:自訂應用程式的外觀


可以透過下列方法,改變應用程式的外觀,而無需變更應用程式的程式碼:

•變更預設功能表系統。 使用 [功能表設計工具] 可以建立和新增自定功能表和功能表選項。否則,於執行時期環境顯示預設 Visual FoxPro 功能表。相關詳細資訊請參考「如何:建立功能表和子功能表」。

•變更預設的應用程式標題。 當執行應用程式時,它在 Visual FoxPro 桌面視窗中執行以及在預設情況下,文字 [Microsoft Visual FoxPro] 顯示在標題中。 可以將預設的應用程式標題變更為較適合的標題。

•變更預設應用程式圖示。 在應用程式編譯連結過之後,預設 Visual FoxPro 圖示會顯示在 Windows 檔案總管或 [開始] 功能表中,作為應用程式圖示。可以使用 Visual FoxPro 提供的圖示,也可以自己設計圖示。相關詳細資訊請參考「在 Visual FoxPro 中所支援的圖形」。



若要變更應用程式的標題

在應用程式的組態檔中,包含下列敘述以及把 MyProgramTitle 取代成應用程式的適合標題:

TITLE = MyProgramTitle


提示:
若要在標題中包含一個 Visual FoxPro 函數,例如,顯示版本編號,請將下列包含在組態檔案中,使用適合的應用程式標題和函數名稱來設定桌面視窗的 Caption 屬性,如所顯示的:COMMAND=_SCREEN.Caption="MyProgramTitle " + FunctionName()



相關詳細資訊請參考「組態檔中的特殊術語」。


若要變更預設應用程式圖示

1.開啟您應用程式的專案。

2.在 [專案管理員] 中,選定專案的主程式。

3.在 [專案] 功能表上,按一下 [專案資訊]。

專案會出現 [專案資訊] 對話方塊。

4.在 [專案資訊] 對話方塊 中,按一下 [專案] 標籤。

5.在 [專案] 標籤上,按一下 [附加圖示]。

6.在 [開啟] 對話方塊中,為您的專案瀏覽和選擇一個圖示 (.ico) 檔案。

7.按一下 [確定]。


相關詳細資訊請參考「[專案管理員] 視窗」和「[專案資訊] 對話方塊」。



相關資訊

準備分送應用程式

組態應用程式




----------------------------------------------------------------------------------------------
原文:


How to: Customize the Appearance of Applications


You can change the appearance of your application in the following ways without changing application code:

•Change the default menu system. You can create and add custom menus and menu options using the Menu Designer. Otherwise, the run-time environment displays the default Visual FoxPro menu. For more information, see How to: Create Menus and Submenus.

•Change the default application title. When you run your application, it runs in the main Visual FoxPro window and displays the text "Microsoft Visual FoxPro" in the title bar by default. You can change the default application title to a more appropriate title.

•Change the default application icon. When you compile your application, the default Visual FoxPro icon appears in the Windows Explorer or Start Menu as the application icon. You can use the generic icon supplied by Visual FoxPro or supply your own. For more information, see Graphics Support in Visual FoxPro.



To change the application title

In a configuration file for your application, include the following statement and replace MyProgramTitle with the appropriate title of your application:

TITLE = MyProgramTitle


Tip:
To include a Visual FoxPro function, for example, to display a version number, as part of the title, include the following line in the configuration file to set the Caption property of the main window with the appropriate application title and function name as shown: COMMAND=_SCREEN.Caption="MyProgramTitle " + FunctionName()



For more information, see Special Terms for Configuration Files.


To change the default application icon

1.Open the project for your application.

2.In the Project Manager, select the main file for your project.

3.On the Project menu, click Project Info.

The Project Information dialog box appears for your project.

4.In the Project Information dialog box, click the Project tab.

5.On the Project tab, click Attach icon.

6.In the Open dialog box, browse for and select an icon (.ico) file to assign to your project.

7.Click OK.


For more information, see Project Manager Window and Project Information Dialog Box.



See Also

Preparation for Distributing Applications

Configuring an Application

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 133 樓

發表發表於: 星期日 十一月 14, 2004 10:29 pm    文章主題: 引言回覆

建立具有 [應用程式框架] 的應用程式


[應用程式框架] 的設計是為了包含所有必要的以及許多選擇性的元素,以便使應用程式有效而好用。雖然框架本身提供極大的彈性與能力,使您能以最適合的方式建立應用程式,但本章節將討論 [應用程式精靈] 和 [應用程式輔助設計工具] 的使用方式,讓應用程式的開發能夠更容易。



在本章節中


如何:建立框架

學習如何使用 [應用程式精靈],或 [元件陳列庫] 的 [新的應用程式] 資料項,建立一個 [應用程式框架]。


[應用程式框架] 檔案

提供清單和包含在 [應用程式框架] 中的檔案說明。


[應用程式輔助設計工具] 的資料選取

描述在規劃好應用程式之後,該如何選取在開發應用程式時所要的資料來源。


如何:使用 [應用程式輔助設計工具] 管理文件

討論當您選定資料來源之後,該如何規劃並選擇想要加入到應用程式中的文件。


如何:使用 [應用程式輔助設計工具] 產生表單和報表

說明該如何不用撰寫任何程式碼來產生表單或報表。


如何:使用 Builder.dbf 指定 [應用程式輔助設計工具]

提供 Builder.dbf 資料表格,可用於指定一個 [應用程式輔助設計工具]。此資料表格包括代表輔助設計工具名稱的欄位,也可以包括輔助設計工具的說明以及名稱為 Type 的欄位,Type 欄位可識別激發自訂輔助設計工具的 [類別] 或 [基本類別] 的屬性。



相關章節


建立應用程式

討論該如何建立 Visual FoxPro 應用程式,可能包括一個或多個資料庫、設定應用程式系統環境的主程式以及使用者界面 (諸如表單、工具列和功能表等)。


組態應用程式

說明在設定一個 Visual FoxPro 應用程式方面所涉及的步驟。


最佳化主從架構效能

討論該如何透過提高資料傳輸量對應用程式做一些精細的調節工作以獲得最佳效能。


建立使用者界面

闡述如何建立表單、類別、控制項和工具列為使用者界面提供一系列的工具。


上移 Visual FoxPro 資料庫

說明如何使用上移精靈將資料庫、資料表格及資料集從您的系統移到遠端 Microsoft SQL Server 上。


建立國際化應用程式

描述該如何設計和開發 Visual FoxPro 應用程式使其國際化如同合乎國內式地有效。




----------------------------------------------------------------------------------------------
原文:


Creating Applications with the Application Framework


The Application Framework is designed to include all required, and many optional, elements that make an application effective and pleasurable to use. Though the framework itself provides a great deal of flexibility and power to create applications the way that works best for you, this section discusses the ways using the Application Wizard and the Application builder ease your application development.



In This Section


How to: Create a Framework

Learn how to create an Application Framework by using the Application Wizard or by using the New Application item in the Component Gallery.


Application Framework Files

Provides a list and description of files that are included in the Application Framework.


Data Selection with Application Builder

Describes how to select the data sources you want in developing your application after you plan your application.


How to: Manage Documents with Application Builder

Discusses how to plan and choose the documents that you want to add to your application once you have selected data sources.


How to: Generate Forms and Reports with Application Builder

Explains how to generate forms or reports without writing any code.


How to: Specify a Builder Application with Builder.dbf

Provides the Builder.dbf table, which you can use to specify a builder application. The table contains fields that represent the name of a builder, a description of the builder, and a field called Type that identifies the Class or Base Class property that invokes the custom builder.



Related Sections


Creating Applications

Discusses how to create Visual FoxPro applications, which may include one or more databases, a main program that sets up the application's system environment, and a user interface comprised of forms, toolbars, and menus.


Configuring an Application

Explains the steps involved in configuring a Visual FoxPro application.


Optimizing Client/Server Performance

Discusses how you can fine-tune your application to gain maximum performance by increasing data throughput.


Creating the User Interface

Covers how creating forms, classes, controls, and toolbars can provide a rich set of tools for your user interface.


Upsizing Visual FoxPro Databases

Explains how to use the upsizing wizards to move databases, tables, and views from your system to a remote Microsoft SQL Server.


Creating International Applications

Describes how you can design and develop your Visual FoxPro applications so they are as effective internationally as domestically.

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 134 樓

發表發表於: 星期一 十一月 15, 2004 10:41 pm    文章主題: 引言回覆

如何:建立框架


您可以使用 [應用程式精靈],或 [元件陳列庫] 的 [新的應用程式] 資料項,建立一個 [應用程式框架]。在使用 [元件陳列庫] 時,新的專案資料夾項目將會加入到 [我的最愛] 資料夾中。

不論使用何種方法程序,Visual FoxPro 都將顯示 [應用程式輔助設計工具],以便於您加入要儲存在中繼資料表格中的資訊。



若要建立應用程式

1.從 [工具] 功能表中,指定 [精靈] 然後按一下 [應用程式]。

-或者-

在 [元件陳列庫] 的 [Visual Foxpro 目錄] 資料夾中,連按兩下 [新的應用程式] 資料項。

2.在 [應用程式精靈] 對話方塊中:

•指定專案名稱。
•接受或搜尋專案檔。
•選擇 [建立專案目錄結構] (預設值) 和 [加至 [我的最愛] 目錄] (預設值) 的選項。


相關詳細資訊請參考說明中的「建立具有 [應用程式框架] 的應用程式」。

您也可以使用 [元件陳列庫] 在新的應用程式框架中加入表單、報表、資料和伺服物件,以及在表單中加入控制項。當您使用 [元件陳列庫],在應用程式加入表單時,可以根據既存的類別,建立新的表單或次類別。



相關資訊

[應用程式框架] 檔案

建立具有 [應用程式框架] 的應用程式

開發生產力工具




----------------------------------------------------------------------------------------------
原文:


How to: Create a Framework


You can create an Application Framework by using the Application Wizard or by using the New Application item in the Component Gallery. When you use the Component Gallery, a new project folder item is added to your Favorites folder.

Whichever method you use, Visual FoxPro displays an Application Builder so you can add information to be stored in a meta table.



To create an application

1.From the Tools menu, point to Wizards, and then click Application.

-or-

In the Catalogs folder of the Component Gallery, double-click the New Application item.

2.In the Application Wizard dialog box:

•Specify the project name.
•Accept or locate the project file.
•Choose your options to Create project directory structure (default) and Add to Favorites catalog (default).


For more information, see Creating Applications with the Application Framework in Help.

You can also use the Component Gallery to add forms, reports, data, and service objects to your new application framework and controls to forms. When you use the Component Gallery to add a form to an application, you can create a new form or subclass from an existing class.



See Also

Application Framework Files

Creating Applications with the Application Framework

Development Productivity Tools

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 135 樓

發表發表於: 星期二 十一月 16, 2004 11:41 pm    文章主題: 引言回覆

[應用程式框架] 檔案


應用程式框架包含專案檔和一個初級的類別定義函數庫,該類別定義函數庫是 Visual FoxPro 基本類別的次類別,您隨時可用新建或既存的資料表格和文件填入其中。



主含入檔

這個 #INCLUDE 檔案是由包含設定和文字串的元件使用。檔案中也包含 APP_GLOBAL 值,即元件用來參考的名稱。


組態檔

一個選擇性的 Config.fpw 檔案,由諸如最高層的表單等應用程式使用,以便進行 SCREEN=OFF 這類的設定。


專案連鉤類別

控制與專案有關的事件,例如加入新檔案。也可以存取 [應用程式輔助設計工具],以便設定應用程式中檔案互動的行為和屬性。


應用程式中繼資料表格

包含專案設定等資訊,該資訊由 [應用程式輔助設計工具] 和專案連鉤來設定或使用。


應用程式輔助設計工具

在專案中加入元件和設定屬性的工具,例如導覽選項。


使用框架可以指定是否要建立一個完整的應用程式,或者只是要建立一個應用程式框架。如果選擇建立一個完整的應用程式,可在應用程式中含入已經建立好的資料庫和表單或報表,也可使用資料庫範本,從頭開始建立新的應用程式。如果選擇只要建立一個框架,則可稍後再在框架中加入元件。



相關資訊

建立具有 [應用程式框架] 的應用程式

開發生產力工具




----------------------------------------------------------------------------------------------
原文:


Application Framework Files


An application framework includes the project file and a starter class library subclassed from the Visual FoxPro base classes, ready for you to populate with new or existing tables and documents.



Master Include File

This common #INCLUDE file is used by components with settings and strings. The file also includes the APP_GLOBAL value, the name used by components for referencing.


Configuration File

An optional Config.fpw used for applications such as top-level forms in order to implement settings such as SCREEN=OFF.


Project Hook Class

Controls events related to the project such as adding new files. It also can access Application Builder for setting actions and properties of file interaction within the application.


Application Meta Table

Contains information such as project settings made or used by the Application Builder and Project Hooks.


Application Builder

Facilitates adding components to the project and setting properties such as navigation options.


The framework allows you to specify whether to create a complete application or just an application framework. If you choose to create a complete application, you can either include in the application a database and forms or reports you have already created, or you can create a new application from scratch using a database template. If you choose to create a framework, you can go back later and add components to the framework.



See Also

Creating Applications with the Application Framework

Development Productivity Tools

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
從之前的文章開始顯示:   
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區 所有的時間均為 台北時間 (GMT + 8 小時)
前往頁面 上一頁  1, 2, 3 ... 8, 9, 10 ... 12, 13, 14  下一頁
9頁(共14頁)

 
前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
無法 在這個版面附加檔案
無法 在這個版面下載檔案


Powered by phpBB © 2001, 2005 phpBB Group
正體中文語系由 phpbb-tw 維護製作