Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-02

Auto adding interface methods

14 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

Is there a shortcut in Lazarus's editor for Adding all of the methods that are added to an interface ?
Also, Is there a way to tell Lazarus to foreword the parent methods and property for the child's declaration ?

Thanks,
Ido

Reply by email

Mattias Gaertner
to ik
Hello, Is there a shortcut in Lazarus's editor for Adding all of the methods that are added to an interface ?

No. There is already a feature request.

Also, Is there a way to tell Lazarus to foreword the parent methods and property for the child's declaration ?

Can you give an example?

Mattias

Reply by email

Marcos Douglas
to Mattias Gaertner
Mattias Gaertner wrote 9 lines
On Wed, 22 Feb 2012 23:57:12 +0200 ik wrote: > Hello, > > Is there a shortcut in Lazarus's editor for Adding all of the methods > that are added to an interface ? No. There is already a feature request.

Good, good... =)

Show quoted text 6 lines
> Also, Is there a way to tell Lazarus to foreword the parent methods > and property for the child's declaration ? Can you give an example? Mattias

Marcos Douglas

Reply by email

ik
to Mattias Gaertner: On Wed, 22 Feb 2012 23:57:12 +0200 No. There is already a feature request. Can you give…
Mattias Gaertner wrote 15 lines
On Wed, 22 Feb 2012 23:57:12 +0200 ik wrote: > Hello, > > Is there a shortcut in Lazarus's editor for Adding all of the methods > that are added to an interface ? No. There is already a feature request. > Also, Is there a way to tell Lazarus to foreword the parent methods > and property for the child's declaration ? Can you give an example?
TParent = class
private
  FBar : String;
  FBaz : integer;
public
  procedure Foo;
  property Bar : String read FBar; write FBar;
published
  property Baz : Integer read FBaz write FBaz
end;
TChild = class(TParent) // Let's say CTRL+SHIFT+C for example
public
   property Bar; //Foreword from CTRL+SHIFT+C for example
published
   property Baz; // ...
end;
Mattias

Ido

Show quoted text 7 lines
-- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to ik
Show quoted text 36 lines
On Thu, Feb 23, 2012 at 00:09, Mattias Gaertner wrote: > On Wed, 22 Feb 2012 23:57:12 +0200 > ik wrote: > >> Hello, >> >> Is there a shortcut in Lazarus's editor for Adding all of the methods >> that are added to an interface ? > > No. There is already a feature request. > > >> Also, Is there a way to tell Lazarus to foreword the parent methods >> and property for the child's declaration ? > > Can you give an example? TParent = class private FBar : String; FBaz : integer; public procedure Foo; property Bar : String read FBar; write FBar; published property Baz : Integer read FBaz write FBaz end; TChild = class(TParent) // Let's say CTRL+SHIFT+C for example public property Bar; //Foreword from CTRL+SHIFT+C for example published property Baz; // ... end;

The above has no effect.
What do you want to achieve?

Mattias

Reply by email

Ing. Héctor F. Fiandor Rosario
to Mattias Gaertner

Dear colleagues:

i have included a tPopUpMenu in a form and programed as in Delphi, but I can?t make it visible.

i will appreciate any help.

thanks in advance,

yours truly,

Ing. H?ctor F. Fiandor Rosario

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas Infomed: http://www.sld.cu/

Reply by email

ik
to Mattias Gaertner: On Thu, 23 Feb 2012 00:26:32 +0200 The above has no effect. What do you want to achieve?…
Mattias Gaertner wrote 42 lines
On Thu, 23 Feb 2012 00:26:32 +0200 ik wrote: > On Thu, Feb 23, 2012 at 00:09, Mattias Gaertner > wrote: > > On Wed, 22 Feb 2012 23:57:12 +0200 > > ik wrote: > > > >> Hello, > >> > >> Is there a shortcut in Lazarus's editor for Adding all of the methods > >> that are added to an interface ? > > > > No. There is already a feature request. > > > > > >> Also, Is there a way to tell Lazarus to foreword the parent methods > >> and property for the child's declaration ? > > > > Can you give an example? > > TParent = class > private > ? FBar : String; > ? FBaz : integer; > public > ? procedure Foo; > > ? property Bar : String read FBar; write FBar; > published > ? property Baz : Integer read FBaz write FBaz > end; > > TChild = class(TParent) // Let's say CTRL+SHIFT+C for example > public > ? ?property Bar; //Foreword from CTRL+SHIFT+C for example > published > ? ?property Baz; // ... > end; The above has no effect. What do you want to achieve?

That rather constantly doing copy paste of original properties and even methods to foreword to a new class, there will be a tool for that.
With my Redis client, I have a basic class that contain such properties, and few classes that inherits them, and require to have the properties inside.
It would be nice, but not a real demand to have such support.

The CTRL+SHIFT+C is the tool for the job imho, because it completes code declarations, but as you discover, it does not do that at the time.
I think that part of the interface inheritance feature that will or might be designed, it should support also this.

Thanks,

Mattias

Ido

Show quoted text 6 lines
-- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Howard Page-Clark
to Ing. Héctor F. Fiandor Rosario: Dear colleagues: i have included a tPopUpMenu in a form and programed as in Delphi, but I…
Ing. H?ctor F. Fiandor Rosario wrote
Dear colleagues: i have included a tPopUpMenu in a form and programed as in Delphi, but I can?t make it visible.

1. You've hijacked an existing thread with an unrelated topic. Please start a new thread when raising a new issues.

2. A stripped-down version of your code showing the lines that don't achieve the desired effect will help someone here advise you what to do.

3. We presume since your program comes from Delphi that its a Windows target, but it always helps others to make this information explicit.

Reply by email

Mattias Gaertner
to ik: On Thu, Feb 23, 2012 at 00:45, Mattias Gaertner That rather constantly doing copy paste…
Show quoted text 58 lines
On Thu, Feb 23, 2012 at 00:45, Mattias Gaertner wrote: > On Thu, 23 Feb 2012 00:26:32 +0200 > ik wrote: > >> On Thu, Feb 23, 2012 at 00:09, Mattias Gaertner >> wrote: >> > On Wed, 22 Feb 2012 23:57:12 +0200 >> > ik wrote: >> > >> >> Hello, >> >> >> >> Is there a shortcut in Lazarus's editor for Adding all of the methods >> >> that are added to an interface ? >> > >> > No. There is already a feature request. >> > >> > >> >> Also, Is there a way to tell Lazarus to foreword the parent methods >> >> and property for the child's declaration ? >> > >> > Can you give an example? >> >> TParent = class >> private >> ? FBar : String; >> ? FBaz : integer; >> public >> ? procedure Foo; >> >> ? property Bar : String read FBar; write FBar; >> published >> ? property Baz : Integer read FBaz write FBaz >> end; >> >> TChild = class(TParent) // Let's say CTRL+SHIFT+C for example >> public >> ? ?property Bar; //Foreword from CTRL+SHIFT+C for example >> published >> ? ?property Baz; // ... >> end; > > The above has no effect. > What do you want to achieve? That rather constantly doing copy paste of original properties and even methods to foreword to a new class, there will be a tool for that. With my Redis client, I have a basic class that contain such properties, and few classes that inherits them, and require to have the properties inside. It would be nice, but not a real demand to have such support. The CTRL+SHIFT+C is the tool for the job imho, because it completes code declarations, but as you discover, it does not do that at the time. I think that part of the interface inheritance feature that will or might be designed, it should support also this.

I still don't see the point.
The properties have the same visibility, type, getters and setters. I could understand the demand for a tool doing the opposite: to clean up such duplicate properties.
Or a tool to raise the visibility of inherited properties.

Mattias

Reply by email

ik
to Mattias Gaertner
Mattias Gaertner wrote 67 lines
On Thu, 23 Feb 2012 09:32:14 +0200 ik wrote: > On Thu, Feb 23, 2012 at 00:45, Mattias Gaertner > wrote: > > On Thu, 23 Feb 2012 00:26:32 +0200 > > ik wrote: > > > >> On Thu, Feb 23, 2012 at 00:09, Mattias Gaertner > >> wrote: > >> > On Wed, 22 Feb 2012 23:57:12 +0200 > >> > ik wrote: > >> > > >> >> Hello, > >> >> > >> >> Is there a shortcut in Lazarus's editor for Adding all of the methods > >> >> that are added to an interface ? > >> > > >> > No. There is already a feature request. > >> > > >> > > >> >> Also, Is there a way to tell Lazarus to foreword the parent methods > >> >> and property for the child's declaration ? > >> > > >> > Can you give an example? > >> > >> TParent = class > >> private > >> ? FBar : String; > >> ? FBaz : integer; > >> public > >> ? procedure Foo; > >> > >> ? property Bar : String read FBar; write FBar; > >> published > >> ? property Baz : Integer read FBaz write FBaz > >> end; > >> > >> TChild = class(TParent) // Let's say CTRL+SHIFT+C for example > >> public > >> ? ?property Bar; //Foreword from CTRL+SHIFT+C for example > >> published > >> ? ?property Baz; // ... > >> end; > > > > The above has no effect. > > What do you want to achieve? > > That rather constantly doing copy paste of original properties and > even methods to foreword to a new class, there will be a tool for > that. > With my Redis client, I have a basic class that contain such > properties, and few classes that inherits them, and require to have > the properties inside. > It would be nice, but not a real demand to have such support. > > The CTRL+SHIFT+C is the tool for the job imho, because it completes > code declarations, but as you discover, it does not do that at the > time. > I think that part of the interface inheritance feature that will or > might be designed, it should support also this. I still don't see the point. The properties have the same visibility, type, getters and setters. I could understand the demand for a tool doing the opposite: to clean up such duplicate properties. Or a tool to raise the visibility of inherited properties.

In my knowledge in Pascal, if the child does not pass the parent properties, then they are not visible in the child. For example in the RTTI you will not see the published property because it was not foreword to the child.

Show quoted text 8 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Sven Barth
to ik
ik wrote 74 lines
On Thu, Feb 23, 2012 at 10:57, Mattias Gaertner wrote: > On Thu, 23 Feb 2012 09:32:14 +0200 > ik wrote: > >> On Thu, Feb 23, 2012 at 00:45, Mattias Gaertner >> wrote: >>> On Thu, 23 Feb 2012 00:26:32 +0200 >>> ik wrote: >>> >>>> On Thu, Feb 23, 2012 at 00:09, Mattias Gaertner >>>> wrote: >>>>> On Wed, 22 Feb 2012 23:57:12 +0200 >>>>> ik wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> Is there a shortcut in Lazarus's editor for Adding all of the methods >>>>>> that are added to an interface ? >>>>> >>>>> No. There is already a feature request. >>>>> >>>>> >>>>>> Also, Is there a way to tell Lazarus to foreword the parent methods >>>>>> and property for the child's declaration ? >>>>> >>>>> Can you give an example? >>>> >>>> TParent = class >>>> private >>>> FBar : String; >>>> FBaz : integer; >>>> public >>>> procedure Foo; >>>> >>>> property Bar : String read FBar; write FBar; >>>> published >>>> property Baz : Integer read FBaz write FBaz >>>> end; >>>> >>>> TChild = class(TParent) // Let's say CTRL+SHIFT+C for example >>>> public >>>> property Bar; //Foreword from CTRL+SHIFT+C for example >>>> published >>>> property Baz; // ... >>>> end; >>> >>> The above has no effect. >>> What do you want to achieve? >> >> That rather constantly doing copy paste of original properties and >> even methods to foreword to a new class, there will be a tool for >> that. >> With my Redis client, I have a basic class that contain such >> properties, and few classes that inherits them, and require to have >> the properties inside. >> It would be nice, but not a real demand to have such support. >> >> The CTRL+SHIFT+C is the tool for the job imho, because it completes >> code declarations, but as you discover, it does not do that at the >> time. >> I think that part of the interface inheritance feature that will or >> might be designed, it should support also this. > > I still don't see the point. > The properties have the same visibility, type, getters and setters. > I could understand the demand for a tool doing the opposite: to clean up > such duplicate properties. > Or a tool to raise the visibility of inherited properties. In my knowledge in Pascal, if the child does not pass the parent properties, then they are not visible in the child. For example in the RTTI you will not see the published property because it was not foreword to the child.

No, this is wrong. A class always inherits the properties of its parent.

The following example prints "42":

=== example begin ===

program test;
{$mode objfpc}
{$apptype console}
uses
   typinfo;
type
   {$TYPEINFO ON}
   TTest = class
   private
     fFoo: LongInt;
   published
     property Foo: LongInt read fFoo write fFoo;
   end;
   {$TYPEINFO OFF}
   TTestChild = class(TTest)
   end;
var
   t: TTestChild;
begin
   t := TTestChild.Create;
   t.Foo := 42;
   Writeln(GetOrdProp(t, 'Foo'));
end.

=== example end ===

So your suggested tool is basically useless.

You only need to write "property Foo;" in a child class if you want to increase the visibility of the property (e.g. from protected to public or published)

Regards,
Sven

Reply by email

ik
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
On Thu, 23 Feb 2012 11:09:18 +0200 ik wrote: >[...] > In my knowledge in Pascal, if the child does not pass the parent > properties, then they are not visible in the child. > For example in the RTTI you will not see the published property > because it was not foreword to the child. No. In fact you can only raise the visibility of a property, never decrease it.

Wow, damm it's the second thing that I discover that what I think I know, and what actually there are wrong.

Thanks to you and Sven as well for this, and the tool is useless.

Show quoted text 8 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Felipe Monteiro de Carvalho
to Ing. Héctor F. Fiandor Rosario: Dear colleagues: i have included a tPopUpMenu in a form and programed as in Delphi, but I…

2012/2/23 Ing. H?ctor F. Fiandor Rosario :

Dear colleagues: i have included a tPopUpMenu in a form and programed as in Delphi, but I can?t make it visible.

You need to inform a lot more of information, for example:

1-> Your Lazarus and FPC versions
2-> Operating system
3-> What you tryed so far to make it visible
4-> Source code snipets and possibly screenshots (not attached, but a link to imageshack for example)

Felipe Monteiro de Carvalho

Reply by email