Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

?! Can´t See Our Own Events in Object Inspector

Status
Not open for further replies.

Pontelo

Programmer
Dec 18, 2001
80
BR
We have a base class, with basic functionallities, and we intend to inherit from it to make different things. We create some events but we can´t see them in object inspector. What are we doing wrong ? Tks in advance !
The class :
type
TMyOwnEvent : procedure(Sender:TObject; X:TX) of object;

TBaseSomeThing = class (TForm)
:
:
private
:
fBeforeSomeThing : TMyOwnEvent;
fAfterSomeThing : TMyOwnEvent;
protected
procedure DoBeforeFatura;
procedure DoAfterFatura;
published
property BeforeSomeThing : TMyOwnEvent
read fBeforeSomeThing
write fBeforeSomeThing;
property AfterSomeThing : TMyOwnEvent
read fAfterSomeThing
write fAfterSomeThing;
end;


 
You dont seem to have missed anything. I copied your sample component code and added it into a package project on Delphi 2005. I compiled and installed the package succesfully. The component was registered. I then created a sample VCL forms project and dropped a TBaseSomeThing component in one form. The final result was that i saw both events on Object inspector. I think you need to make sure install and register your component correctly.

Below your sample component code exactly as i compiled and packaged it in my machine.
Code:
unit MyFormComponent;

interface

uses
    Forms, Classes;

type

  TMyOwnEvent = procedure(Sender:TObject) of object;

  TBaseSomeThing = class (TForm)
  private
    fBeforeSomeThing : TMyOwnEvent;
    fAfterSomeThing  : TMyOwnEvent;

  protected
   // ...

  published
    property  BeforeSomeThing : TMyOwnEvent
              read  fBeforeSomeThing
              write fBeforeSomeThing;
    property  AfterSomeThing  : TMyOwnEvent
              read  fAfterSomeThing
              write fAfterSomeThing;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TBaseSomeThing]);
end;

end.

I will also try tomorrow in Delphi 6. But considering the simplicity of the component i dont think there will be a problem there either.


I hope this will help you a little
 
Bledazemi Tks ! What i missed was create and install it as a
component. But help me a little bit more pls ? This component is a form. A clear form full of code necessary to do our things (especifically a selling module). We intend to create 2 or 3 or more different GUIs inheriting all common code to all of them. But how do I create a form component in a way that add it to our projects. Excuse me I don´t have enough knowledge in Delphi mechanisms yet. How do I begin another form based in a form component ? I cannot drag it as any other component. I tried, p.ex., send it to repository. But this way I cannot see those properties and events we need.
Thanks !
 
Try the following steps:

It seems to me that the easiest way for you to add your form to repository. To make sure your published properties are displayed in object inspector try the following steps:

- Change Register method
Replace RegisterComponents with RegisterCustomModule

- Recompile and install the package containing your form

- Add your form to repository


I have tested the above steps in Delphi 2005. Basically i created a VCL forms project and added a new form to inherit from (TBasicSomething) form in repository. Performing the above steps did make the custom published properties visible in object inspector.

Below is your code for TBaseSomething adjusted to use RegisterCustomModule.

Code:
unit UBaseSomething;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes,
  Graphics, Controls, Forms, Dialogs,
  DesignEditors, //TCustomModule is defined here
  DesignIntf;    //RegisterCustomModule is defined here
  
  //Note: DesignIntf and DesignEditors are located in: 
  //<DelphiDir>\source\ToolsApi
  //Note 2: In D2005 compiling DesignIntf produces error:
  //        DesignerTypes.dcu not found
  //        To fix this problem add designide.dcp in the 
  //        required list of the package containing this 
  //        file. designide.dcp is located in:  
  //        <DelphiDir>\lib 


type
  TMyOwnEvent = procedure(Sender:TObject) of object;

  TBaseSomething = class(TForm)
  private
    fBeforeSomeThing : TMyOwnEvent;
    fAfterSomeThing  : TMyOwnEvent;

  protected
   // ...
  public

  published
    property  BeforeSomeThing : TMyOwnEvent
              read  fBeforeSomeThing
              write fBeforeSomeThing;
    property  AfterSomeThing  : TMyOwnEvent
              read  fAfterSomeThing
              write fAfterSomeThing;
  end;

procedure Register;

implementation

{$R *.dfm}

procedure Register;
begin
  //Use register custom module instead of RegisterComponents
  RegisterCustomModule(TBaseSomething, TCustomModule);
end;

I hope this will help a little more.


It is worth to mention here that Delphi provides a number of interfaces that you may use to implement your own add-ins that integrate with delphi IDE. Search for help on Tools Api . Credits for this particular solution go to the following link:
 
Bledazemi
it worked. I think this way is a simple and good way to work with our base form. Thank you very much !
I downloaded gexpert too. I´ll look carefully over it.
TKS !

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top