|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PaxDebugger can easy be embedded into existing application.
Now application is scriptable through PaxScripter/PaxDebugger, so run it. A file-based project can be inserted in two ways:
Every module will be saved on a single file, that will contain the code text. Filename is given by <ModuleName>.<LangExt>, where LangExt is a file extension that depends on (pax)language used for the module. The project file, that will have a .pax extension, is in XML format, and contains groups and their modules relations. Here's two examples on how file-based project can be inserted without using IDE (so using PaxDebugger methods):
procedure LoadProjectFromFile1;
begin
PaxDebugger.OpenProject('c:\Projects\TestProject.pax');
end;
procedure LoadProjectFromFile2;
begin
PaxDebugger.NewProject('TestProject', TRUE);
// now modules can be added using AddModule method
end;
A db-based project can be inserted only via PaxDebugger component. This means that IDE is unusefull for this type of task. Lets have a see of a typical application that uses PaxDebugger with a db-based project: procedure OpenDBProject;Specific database stuff (open db, read records and close db) is left to the application; it may be, for example, an ADO connection or a ODBC one. PaxDebugger is used to create project, add modules and assign code for each inserted module. The second parameter of AddModule is a TPaxLanguage class; if nil is specified (like in the above example), the default language will be used. The call to ImposeProjectLoaded is necessary to inform PaxDebugger that the project is completely loaded. In the case of file-based projects, this call is not needed. Once a project has been created or loaded, IDE can be used to debug procedures, move modules, create new groups and modules, edit code and so on. A project can be saved using the 'Save project' item from 'File' menu, or through the PaxDebugger SaveProject method. The result is exactly the same. If the project was on file, everything goes ok, but if it was on database, how can application know that project and modules are being to saved? Events are the answer.
PaxDebugger component is rich of events. For a complete list, click here. For a basic embedding, save events are the ones important.
When a project is saved, the event chain is as follow:
Here's a typical OnSaveModule event implementation (usefull for db-based projects):
Procedure PaxDebugger1OnSaveModule(Sender: TObject; const Module: TPaxDebuggerModule);
begin
if (Module.NeedSave) then begin
<Save module informations to a database record>
end;
end;
The NeedSave property of TPaxDebuggerModule class, can be used to check if the module has been changed. A module is considered changed if:
This information can save several db update operations.
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||