Welcome, Guest
Username: Password: Remember me
General Purpose Components and Libraries, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4594

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
Hi everyone!
I'm using CT 4.50 on Windows 7.
I've created an ordinary Application (File -> new -> Application) with Forms etc.
I derived a TForm from the existing one which derived from TForm
type
  { Tfneu }
  Tfneu = class(TForm)
    Button1: TButton; // just as example
  private
    { private declarations }
  public
    { public declarations }
  end;

now i try to derive a from from TFneu
with File -> new -> derived point -> derived project-component (in german Datei -> neu -abgeleiteter Punkt - abgeleitete Projektkomponenten)
selected TFneu and a new Form is created.
type
  Tfneu1 = class(Tfneu)
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  fneu1: Tfneu1; 

But it is not possible to place a component from the palette onto this new component TFneu1!
Are there any ideas??

Just to explain:
I use these kind of technique to create childforms which inherits specific properties and functions from their ancestor
It works in delphi ...

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4597

  • zeljko
  • zeljko's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 207
  • Thank you received: 38

Just to explain:
I use these kind of technique to create childforms which inherits specific properties and functions from their ancestor
It works in delphi ...


And I tried without success

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4598

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
Did you try it in Delphi ??
with Delphi XE 2 starter, it does work (i just tried, to be sure )..

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4601

  • Lieven Vandaele
  • Lieven Vandaele's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 6
  • Thank you received: 1
Could this help?

classmethod

Definition: A class method is a method that operates on classes instead of objects.
The definition of a class method must begin with the reserved word class.

The most common used class method in Delphi language is the "Create" constructor.

In the defining declaration of a class method, the identifier Self represents the class where the method is called (which could be a descendant of the class in which it is defined). If the method is called in the class TCar, then Self is of the type class of TCar. Thus you cannot use Self to access fields, properties, and normal (object) methods, but you can use it to call constructors and other class methods
A class method can be called through a class reference or an object reference. When it is called through an object reference, the class of the object becomes the value of Self.

Examples:
type
TCar = Class
//"object" method
procedure Drive;
//class method
class procedure Stop;

end;

...

class procedure Stop;
begin
...
end;
The following user(s) said Thank You: Adular

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4602

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
Hm, thank you, but i believe, this won't help ...

I was using the form designer for the example, so i didn't create any classes or objects on my own.

There is an interesting effect: The effect shows when 2 conditions are met:
1. The unit1 with TFNeu (class(TForm) has to be saved
If you don't save TFneu, then putting a component on the derived TFNeu1 is possible, unless you don't save ...

2. Only placing component on the derived class (TFNeu1) doesn't work.
If you put a TPanel on TFNeu, then placing a Button on the inherited Panel on TFneu1 (derived from TFneu) does work ...

Should the artificial intelligence of my CPU be working against me ???

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4606

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
FYI:
I've just created an example project.
While it is possible to create a new Form which inherits from TForm1, it ist not possible to put a component on the newly created form ...

I tried it this way:
File-> new and then 'inherited item' and then 'inherited project component', selecting form1 (see screenshot)

I'm quite puzzled ...

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4607

  • Wai-kit
  • Wai-kit's Avatar
  • Visitor
  • Visitor
search for Visual Form Inheritance and you'll get some hits.
FPC/Lazarus has issues with it. :(

Please Log in or Create an account to join the conversation.

Last edit: by Wai-kit.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4608

  • zeljko
  • zeljko's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 207
  • Thank you received: 38
please an example

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4609

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
Ok, i found it in the Lazarus-Bugtracker
This is a Bug (Bug-ID 0025084 in the Mantis-Bugtracker), but fixed in Lazarus-Revision 42945!

Has anyone an idea how to get this revision (or newer, actually) into the current codetyphon-version ??
Just copying the lazarus-sources in the typhon-directory and then compiling?

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4610

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4535
  • Thank you received: 1114
You must wait for CT ver 4.6 Sir
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: zeljko, Adular

Please Log in or Create an account to join the conversation.

placing a component (TPanel e.g) on a derived Form 11 years 1 month ago #4611

  • Adular
  • Adular's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 2
Ok, thank you

Please Log in or Create an account to join the conversation.

  • Page:
  • 1