[Ocs-comps-commits] OCS2/Samples/VCL/PluginManager/DBShare/Interbase/Clients/Country Country.cfg,NON
Brought to you by:
tectsoft
From: Si C. <tec...@us...> - 2005-11-21 10:33:51
|
Update of /cvsroot/ocs-comps/OCS2/Samples/VCL/PluginManager/DBShare/Interbase/Clients/Country In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10593/Samples/VCL/PluginManager/DBShare/Interbase/Clients/Country Added Files: Country.cfg Country.dof Country.dpr Country.res CountryForm.dfm CountryForm.pas CountryUnit.pas earth.ico images.rc images.res Log Message: Initially added to source control --- NEW FILE: images.rc --- COUNTRYICON ICON "earth.ico" --- NEW FILE: Country.dpr --- library Country; {$R 'images.res' 'images.rc'} uses CountryUnit in 'CountryUnit.pas', CountryForm in 'CountryForm.pas' {frmCountry}; {$R *.res} begin end. --- NEW FILE: earth.ico --- (This appears to be a binary file; contents omitted.) --- NEW FILE: CountryForm.pas --- unit CountryForm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, IBCustomDataSet, IBUpdateSQL, StdCtrls, ExtCtrls, DBCtrls, Mask, DB, IBTable, IBDatabase, AppEvnts; type TfrmCountry = class(TForm) IBDatabase1: TIBDatabase; IBTransaction1: TIBTransaction; IBTable1: TIBTable; DataSource1: TDataSource; IBTable1COUNTRY: TIBStringField; IBTable1CURRENCY: TIBStringField; Label1: TLabel; DBEdit1: TDBEdit; Label2: TLabel; DBEdit2: TDBEdit; Bevel1: TBevel; DBNavigator1: TDBNavigator; Button1: TButton; IBUpdateSQL1: TIBUpdateSQL; Button2: TButton; ApplicationEvents1: TApplicationEvents; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public constructor CreateCountryForm(DBHandle: Pointer); destructor Destroy; override; end; implementation {$R *.dfm} { TfrmCountry } constructor TfrmCountry.CreateCountryForm(DBHandle: Pointer); begin inherited Create(nil); IBDatabase1.SetHandle(DBHandle); IBTable1.Open; end; destructor TfrmCountry.Destroy; begin IBDatabase1.Close; inherited Destroy; end; procedure TfrmCountry.Button1Click(Sender: TObject); begin Close; end; procedure TfrmCountry.Button2Click(Sender: TObject); begin if (Assigned(ApplicationHandleException)) then begin raise exception.create('test'); end; end; end. --- NEW FILE: Country.dof --- [FileVersion] Version=7.0 [Compiler] A=8 B=0 C=1 D=1 E=0 F=0 G=1 H=1 I=1 J=0 K=0 L=1 M=0 N=1 O=0 P=1 Q=0 R=0 S=0 T=0 U=0 V=1 W=0 X=1 Y=1 Z=1 ShowHints=1 ShowWarnings=1 UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; NamespacePrefix= SymbolDeprecated=1 SymbolLibrary=1 SymbolPlatform=1 UnitLibrary=1 UnitPlatform=1 UnitDeprecated=1 HResultCompat=1 HidingMember=1 HiddenVirtual=1 Garbage=1 BoundsError=1 ZeroNilCompat=1 StringConstTruncated=1 ForLoopVarVarPar=1 TypedConstVarPar=1 AsgToTypedConst=1 CaseLabelRange=1 ForVariable=1 ConstructingAbstract=1 ComparisonFalse=1 ComparisonTrue=1 ComparingSignedUnsigned=1 CombiningSignedUnsigned=1 UnsupportedConstruct=1 FileOpen=1 FileOpenUnitSrc=1 BadGlobalSymbol=1 DuplicateConstructorDestructor=1 InvalidDirective=1 PackageNoLink=1 PackageThreadVar=1 ImplicitImport=1 HPPEMITIgnored=1 NoRetVal=1 UseBeforeDef=1 ForLoopVarUndef=1 UnitNameMismatch=1 NoCFGFileFound=1 MessageDirective=1 ImplicitVariants=1 UnicodeToLocale=1 LocaleToUnicode=1 ImagebaseMultiple=1 SuspiciousTypecast=1 PrivatePropAccessor=1 UnsafeType=0 UnsafeCode=0 UnsafeCast=0 [Linker] MapFile=0 OutputObjs=0 ConsoleApp=1 DebugInfo=0 RemoteSymbols=0 MinStackSize=16384 MaxStackSize=1048576 ImageBase=4194304 ExeDescription= [Directories] OutputDir=C:\Projects\Components\OCS2.3\Samples\VCL\PluginManager\DBShare\Interbase\Prog UnitOutputDir= PackageDLLOutputDir= PackageDCPOutputDir= SearchPath=$(DELPHI)\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\ Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;soaprtl;dbexpress;dbxcds;indy;dclOffice2k Conditionals= DebugSourceDirs= UsePackages=0 [Parameters] RunParams= HostApplication=C:\Projects\Components\OCS2.3\Samples\VCL\PluginManager\DBShare\Interbase\Prog\IB_DB_SHARE.exe Launcher= UseLauncher=0 DebugCWD= [Language] ActiveLang= ProjectLang= RootDir=D:\Program Files\Borland\Delphi6\Bin\ [Version Info] IncludeVerInfo=0 AutoIncBuild=0 MajorVer=1 MinorVer=0 Release=0 Build=0 Debug=0 PreRelease=0 Special=0 Private=0 DLL=0 Locale=2057 CodePage=1252 [Version Info Keys] CompanyName= FileDescription= FileVersion=1.0.0.0 InternalName= LegalCopyright= LegalTrademarks= OriginalFilename= ProductName= ProductVersion=1.0.0.0 Comments= [Excluded Packages] c:\program files\borland\delphi7\Projects\Bpl\PLGMDO.bpl=(untitled) [HistoryLists\hlUnitAliases] Count=1 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hlSearchPath] Count=2 Item0=$(DELPHI)\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\ Item1=..\..\ [HistoryLists\hlOutputDirectorry] Count=2 Item0=C:\Projects\Components\OCS2.3\Samples\VCL\PluginManager\DBShare\Interbase\Prog Item1=..\..\Prog --- NEW FILE: Country.cfg --- -$A8 -$B- -$C+ -$D+ -$E- -$F- -$G+ -$H+ -$I+ -$J- -$K- -$L+ -$M- -$N+ -$O- -$P+ -$Q- -$R- -$S- -$T- -$U- -$V+ -$W- -$X+ -$YD -$Z1 -cg -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -H+ -W+ -M -$M16384,1048576 -K$00400000 -E"C:\Projects\Components\OCS2.3\Samples\VCL\PluginManager\DBShare\Interbase\Prog" -LE"c:\program files\borland\delphi7\Projects\Bpl" -LN"c:\program files\borland\delphi7\Projects\Bpl" -U"c:\program files\borland\delphi7\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\" -O"c:\program files\borland\delphi7\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\" -I"c:\program files\borland\delphi7\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\" -R"c:\program files\borland\delphi7\Lib\Debug;C:\Projects\COMPON~1\jcl\lib\D7\debug;..\..\" -w-UNSAFE_TYPE -w-UNSAFE_CODE -w-UNSAFE_CAST --- NEW FILE: CountryForm.dfm --- object frmCountry: TfrmCountry Left = 227 Top = 110 BorderStyle = bsDialog Caption = 'Country' ClientHeight = 177 ClientWidth = 258 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False Position = poDesktopCenter PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 8 Top = 8 Width = 53 Height = 13 Caption = 'COUNTRY' FocusControl = DBEdit1 end object Label2: TLabel Left = 8 Top = 56 Width = 60 Height = 13 Caption = 'CURRENCY' FocusControl = DBEdit2 end object Bevel1: TBevel Left = 8 Top = 136 Width = 241 Height = 2 end object DBEdit1: TDBEdit Left = 8 Top = 24 Width = 199 Height = 21 DataField = 'COUNTRY' DataSource = DataSource1 TabOrder = 0 end object DBEdit2: TDBEdit Left = 8 Top = 72 Width = 134 Height = 21 DataField = 'CURRENCY' DataSource = DataSource1 TabOrder = 1 end object DBNavigator1: TDBNavigator Left = 8 Top = 104 Width = 240 Height = 25 DataSource = DataSource1 TabOrder = 2 end object Button1: TButton Left = 176 Top = 144 Width = 75 Height = 25 Caption = '&Close' TabOrder = 3 OnClick = Button1Click end object Button2: TButton Left = 208 Top = 64 Width = 75 Height = 25 Caption = 'Button2' TabOrder = 4 OnClick = Button2Click end object IBDatabase1: TIBDatabase DatabaseName = 'D:\Program Files\Common Files\Borland Shared\Data\employee.gdb' Params.Strings = ( 'user_name=sysdba') DefaultTransaction = IBTransaction1 IdleTimer = 0 SQLDialect = 1 TraceFlags = [] Left = 8 Top = 144 end object IBTransaction1: TIBTransaction Active = False DefaultDatabase = IBDatabase1 AutoStopAction = saNone Left = 40 Top = 144 end object IBTable1: TIBTable Database = IBDatabase1 Transaction = IBTransaction1 BufferChunks = 1000 CachedUpdates = False TableName = 'COUNTRY' UpdateObject = IBUpdateSQL1 Left = 72 Top = 144 object IBTable1COUNTRY: TIBStringField FieldName = 'COUNTRY' Required = True Size = 15 end object IBTable1CURRENCY: TIBStringField FieldName = 'CURRENCY' Required = True Size = 10 end end object DataSource1: TDataSource DataSet = IBTable1 Left = 104 Top = 144 end object IBUpdateSQL1: TIBUpdateSQL RefreshSQL.Strings = ( 'Select ' ' RDB$DB_KEY as IBX_INTERNAL_DBKEY, ' ' COUNTRY,' ' CURRENCY' 'from COUNTRY ' 'where' ' COUNTRY = :COUNTRY') ModifySQL.Strings = ( 'update COUNTRY' 'set' ' COUNTRY = :COUNTRY,' ' CURRENCY = :CURRENCY' 'where' ' COUNTRY = :OLD_COUNTRY') InsertSQL.Strings = ( 'insert into COUNTRY' ' (COUNTRY, CURRENCY)' 'values' ' (:COUNTRY, :CURRENCY)') DeleteSQL.Strings = ( 'delete from COUNTRY' 'where' ' COUNTRY = :OLD_COUNTRY') Left = 136 Top = 144 end object ApplicationEvents1: TApplicationEvents Left = 176 Top = 64 end end --- NEW FILE: images.res --- (This appears to be a binary file; contents omitted.) --- NEW FILE: CountryUnit.pas --- unit CountryUnit; interface uses Windows, Messages, OrckaPluginManagerShared, HostShared; type TCountry = class(TPluginClient) private FService: TPluginServices; FHostShared: THostShared; (* Button's *) FbtnCountry: TOButtonItem; (* Menu's *) FmnuViewCountry: TOMenuItem; protected (* Button Click Events *) procedure btnCountryClickEvent(Sender: TOButtonItem); (* Menu Click Events *) procedure mnuViewCountryClickEvent(Sender: TOMenuItem); procedure ShowCountryEditor; public constructor CreateNew(AService: TPluginServices); destructor Destroy; override; (* Returns the name of the plugin *) function GetName: TOString; override; (* Functions which control the creation and deletion of menu items and toolbar buttons *) procedure CreateMenuItems; override; procedure DeleteMenuItems; override; procedure CreateButtons; override; procedure DeleteButtons; override; (* General functions for applications, can be used to control open/save/close/create documents, Close the application *) procedure Open(PEType: TPluginEventType; var Name: TLargeString; var Handled: Boolean); override; procedure Save(PEType: TPluginEventType; var Name: TLargeString; var Handled: Boolean); override; procedure BeforeClose(PEType: TPluginEventType; var Cancel: Boolean); override; procedure AfterClose(PEType: TPluginEventType); override; procedure BeforeNew(PEType: TPluginEventType; var Cancel: Boolean); override; procedure AfterNew(PEType: TPluginEventType); override; (* Application Events *) procedure OnActivate; override; procedure OnDeactivate; override; procedure OnMinimize; override; procedure OnRestore; override; procedure OnException(ClassName: TMediumString; ErrorMessage: TLargeString); override; procedure OnHelp(Command: Word; Data: Longint; var CallHelp: Boolean); override; procedure OnHint; override; procedure OnIdle(var Done: Boolean); override; procedure OnMessage(var Msg: TMsg; var Handled: Boolean); override; procedure OnSettingsChanged(Flag: Integer; const Section: string; var Result: Longint); override; procedure OnShortCut(var Msg: TWMKey; var Handled: Boolean); override; end; implementation uses SysUtils, CountryForm; var Plugin: TCountry = nil; procedure PluginUnload; stdcall; begin Plugin.Free; end; function PluginLoad(InParams: TOrckaPluginManagerParams; var ExitProc: Pointer): Boolean; stdcall; begin Result := True; try Plugin := TCountry.CreateNew(TPluginServices(InParams.PluginService)); Plugin.FHostShared := THostShared(InParams.User); ExitProc := @PluginUnload; except Result := False; end; end; procedure PluginDescription(var Name, Description: TMediumString); stdcall; begin FillChar(Name, SizeOf(TMediumString), 0); StrPCopy(Name, 'Country'); FillChar(Description, SizeOf(TMediumString), 0); StrPCopy(Description, 'Country Description'); end; exports PluginLoad name OrckaPluginManagerExportProc2, PluginDescription name OrckaPluginManagerDescription; { TNewPlugin } { Button Click Events } procedure TCountry.btnCountryClickEvent(Sender: TOButtonItem); begin ShowCountryEditor; end; (* Menu Click Events *) procedure TCountry.mnuViewCountryClickEvent(Sender: TOMenuItem); begin ShowCountryEditor; end; { Standard methods } procedure TCountry.AfterClose(PEType: TPluginEventType); begin end; procedure TCountry.AfterNew(PEType: TPluginEventType); begin end; procedure TCountry.BeforeClose(PEType: TPluginEventType; var Cancel: Boolean); begin end; procedure TCountry.BeforeNew(PEType: TPluginEventType; var Cancel: Boolean); begin end; procedure TCountry.CreateButtons; begin (* Add the Toolbar's *) FService.InsertToolbar(StringToOString('View')); (* Insert the Button's *) FbtnCountry := FService.InsertButton(1, StringToOString('View'), StringToOString('Country|View or ammend country and currency details'), btnCountryClickEvent); FbtnCountry.SetImageIndex(FService.AddIcon(LoadIcon(Hinstance, 'COUNTRYICON'))); FbtnCountry.SetCaption('Country'); end; procedure TCountry.CreateMenuItems; var mnuTemp: TOMenuItem; begin mnuTemp := FService.FindMenu(StringToOString('mnuView')); if not Assigned(mnuTemp) then mnuTemp := FService.InsertMenu(1, nil, '&View', nil); if Assigned(mnuTemp) then FmnuViewCountry := FService.InsertMenu(0, mnuTemp, StringToOString('&Country'), mnuViewCountryClickEvent); end; constructor TCountry.CreateNew(AService: TPluginServices); begin inherited Create; FService := AService; FService.PluginClientInsert(Self); FService.PluginClientIncludeAppEvent(Self, poAllowInsertToolbars); FService.PluginClientIncludeAppEvent(Self, poAllowRemoveToolbars); end; procedure TCountry.DeleteButtons; begin (* Remove the Button's *) FService.RemoveButton(FbtnCountry); (* Remove the Toolbar's *) FService.DeleteToolbar(StringToOString('View')); end; procedure TCountry.DeleteMenuItems; begin FService.RemoveMenu(FmnuViewCountry); end; destructor TCountry.Destroy; begin FService.PluginClientExcludeAppEvent(Self, poAllowInsertToolbars); FService.PluginClientExcludeAppEvent(Self, poAllowRemoveToolbars); FService.PluginClientRemove(Self); inherited Destroy; end; function TCountry.GetName: TOString; begin Result := StringToOString('Country'); end; procedure TCountry.OnActivate; begin end; procedure TCountry.OnDeactivate; begin end; procedure TCountry.OnException(ClassName: TMediumString; ErrorMessage: TLargeString); begin end; procedure TCountry.OnHelp(Command: Word; Data: Integer; var CallHelp: Boolean); begin end; procedure TCountry.OnHint; begin end; procedure TCountry.OnIdle(var Done: Boolean); begin end; procedure TCountry.OnMessage(var Msg: TMsg; var Handled: Boolean); begin end; procedure TCountry.OnMinimize; begin end; procedure TCountry.OnRestore; begin end; procedure TCountry.OnSettingsChanged(Flag: Integer; const Section: string; var Result: Integer); begin end; procedure TCountry.OnShortCut(var Msg: TWMKey; var Handled: Boolean); begin end; procedure TCountry.Open(PEType: TPluginEventType; var Name: TLargeString; var Handled: Boolean); begin end; procedure TCountry.Save(PEType: TPluginEventType; var Name: TLargeString; var Handled: Boolean); begin end; procedure TCountry.ShowCountryEditor; var frmCountry: TfrmCountry; begin FHostShared.SetTitle('[Country]'); frmCountry := TfrmCountry.CreateCountryForm(FService.GetDatabaseHandle); try frmCountry.ShowModal; finally FHostShared.SetTitle(''); FreeAndNil(frmCountry); end; end; end. --- NEW FILE: Country.res --- (This appears to be a binary file; contents omitted.) |