Einzelnen Beitrag anzeigen

locutus2k5

Registriert seit: 28. Jan 2007
Ort: Naumburg
13 Beiträge
 
Delphi 2006 Personal
 
#4

Re: JVCL - TJvPlugin - Wie Plugins erstellen?

  Alt 6. Jul 2007, 08:30
Hallo!

Das Formular nützt mir nichts. In den Beispielen der JEDI Plugins sind auch keine Formulare vorhanden sondern lediglich eine dfm Datei. welche ein paar Definitionen sowie Bitmaps für die Buttons enthält.

Code:
{******************************************************************

                       JEDI-VCL Demo

 Copyright (C) 2002 Project JEDI

 Original author:

 Contributor(s):

 You may retrieve the latest version of this file at the JEDI-JVCL
 home page, located at [url]http://jvcl.sourceforge.net[/url]

 The contents of this file are used with permission, subject to
 the Mozilla Public License Version 1.1 (the "License"); you may
 not use this file except in compliance with the License. You may
 obtain a copy of the License at
 [url]http://www.mozilla.org/MPL/MPL-1_1Final.html[/url]

 Software distributed under the License is distributed on an
 "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 implied. See the License for the specific language governing
 rights and limitations under the License.

******************************************************************}

unit SamplePluginOneU;

interface

uses
  Windows,
  Messages,
  SysUtils,
  Classes,
  Dialogs,
  Forms,
  JvPlugin;

type
  TSampleUILPlugin = class(TJvPlugin)
    procedure uilPlugin1Commands0Execute(Sender: TObject);
    procedure uilPlugin1Commands1Execute(Sender: TObject);
    procedure uilPlugin1Commands2Execute(Sender: TObject);
    procedure uilPlugin1PluginMessage(Sender: TObject; APluginMessage: Integer; AMessageText: string);
    procedure uilPlugin1Configure(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function RegisterPlugin: TSampleUILPlugin; stdcall;

implementation

{$R *.DFM}  // <------------- Hier ist der Knackpunkt

// IMPORTANT NOTE: If you change the name of the Plugin container,
// you must set the type below to the same type. (Delphi changes
// the declaration, but not the procedure itself. Both the return
// type and the type created must be the same as the declared type above.

function RegisterPlugin: TSampleUILPlugin;
begin
  Result := TSampleUILPlugin.Create(nil);
end;

procedure TSampleUILPlugin.uilPlugin1Commands0Execute(Sender: TObject);
begin
  ShowMessage('Command One clicked');
end;

procedure TSampleUILPlugin.uilPlugin1Commands1Execute(Sender: TObject);
begin
  ShowMessage('Command Two clicked');
end;

procedure TSampleUILPlugin.uilPlugin1Commands2Execute(Sender: TObject);
begin
  ShowMessage('Command Three clicked');
end;

procedure TSampleUILPlugin.uilPlugin1PluginMessage(Sender: TObject;
  APluginMessage: Integer; AMessageText: string);
begin
  ShowMessage(Format('Plugin Message number %d received. MessageText: %s', [APluginMessage, AMessageText]));
end;

procedure TSampleUILPlugin.uilPlugin1Configure(Sender: TObject);
begin
  ShowMessage('You could put a configuration dialog here, if your plugin requires one.');
end;

end.
und die DFM-Datei sieht in der Textansicht wie folgt aus:

Code:
object SampleUILPlugin: TSampleUILPlugin
  OldCreateOrder = False
  Author = 'Tim Sullivan'
  Commands = <
    item
      Bitmap.Data = {
        4E010000424D4E01000000000000760000002800000012000000120000000100
        040000000000D800000000000000000000001000000010000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
        6666660000006666666000066666660000006666600888800666660000006666
        0780800870666600000066660077077700666600000066660700F07070666600
        0000666070FFF70787066600000066600F0F00707006660000006660FFF0FF8F
        07066600000066800F0F0F007008660000006608F0FFF0FF0F80660000006607
        8000000008F0660000006600078FFFFFF0006600000066077878FFFFF7006600
        000066600878FFFF700666000000666660008FF7066666000000666666666870
        666666000000666666666686666666000000}
      Caption = 'Command &1...'
      Hint = 'Command 1'
      Name = 'Command One'
      ShortCut = 0
      OnExecute = uilPlugin1Commands0Execute
    end
    item
      Bitmap.Data = {
        DE010000424DDE01000000000000760000002800000024000000120000000100
        0400000000006801000000000000000000001000000010000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666666666
        666666666666F6666666666600006666606666666666666666686F6666666666
        000066666006666666666666666886F666666666000066666070666666666666
        6668F86F666666660000666660F70666666666666FF8F686FFFFFFF600006600
        00FF70000000666688886668888888F60000668777FFF777777066668F666666
        666668F60000668FFFFFFFFFFF7066668F666666666668F60000668FFFFFFFFF
        FF7066668F6FFFFFFFFF68F60000668F000000000F7066668F888888888668F6
        0000668FFFFFFFFFFF7066668F6FFFFFFFFF68F60000668F000000000F706666
        8F888888888668F60000668FFFFFFFFFFF7066668F6FFFFFFFFF68F60000668F
        000000000F7066668F888888888668F60000668FFFFFFFFFFF7066668FFFFFFF
        FFFFF8F600006688888888888888666688888888888888660000666666666666
        6666666666666666666666660000666666666666666666666666666666666666
        0000}
      Caption = 'Command &2...'
      Hint = 'Command 2'
      Name = 'Command Two'
      ShortCut = 0
      OnExecute = uilPlugin1Commands1Execute
    end
    item
      Bitmap.Data = {
        4E010000424D4E01000000000000760000002800000012000000120000000100
        040000000000D800000000000000000000001000000010000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00666666688888
        666666000000666668000008886666000000666600FFFFF00886660000006660
        FFFF1FFFF08866000000660FF1FFFFF1FF088600000060FFFFFFFFFFFFF08600
        000060F1FFFFFFFFF1F0880000000FFFFFFFFFFFFFFF080000000FFFFFFFF777
        7FFF080000000F1FFFFF0000FF1F080000000FFFFFFF07FFFFFF080000000FFF
        FFFF07FFFFFF0600000060F1FFFF07FFF1F08600000060FFFFFF07FFFFF06600
        0000660FF1FF07F1FF06660000006660FFFF0FFFF06666000000666600FFFFF0
        066666000000666666000006666666000000}
      Caption = 'Command &3...'
      Hint = 'Command 3'
      Name = 'Command Three'
      ShortCut = 0
      OnExecute = uilPlugin1Commands2Execute
    end>
  Description =
    'Sample Plugin One: A simple plugin with 3 commands. It will also' +
    ' respond (simply) to messages.'
  Copyright = '(c) 1999, Unlimited Intelligence Limited'
  PluginID = 'UIL.Sample Plugin One'
  PluginVersion = '2.0'
  OnPluginMessage = uilPlugin1PluginMessage
  OnConfigure = uilPlugin1Configure
  Height = 150
  Width = 215
end
wie man sieht, sind einige Bilder eingefügt. Dies kann ich doch nicht einfach per Hand erstellen oder???
Nebenbei habe ich ein Assistenten endeckt, welcher wohl beim erstellen der Plugins helfen soll. Jedoch funktioniert dieser nicht, aber irgendwie muss das doch gehen?! Google brachte mir diesbezüglich leider auch keine Ergebnisse...
  Mit Zitat antworten Zitat