paxScript Demo. Inheritance of Imported Classes.


Imported Delphi class TForm is inherited in all demos below.

paxBasic

Imports StdCtrls, Forms

Class MyForm
  Inherits TForm
  Private Memo As TMemo
  
  Sub New(Owner As TComponent)
    Me = MyBase.Create(Owner)
    Top = 100
    Left = 200
    Caption = "MyForm"
    
    Memo = New TMemo(Me)
    Memo.Parent = Me
    Memo.Width = 100
    Memo.Align = "alClient"
  End Sub
End Class

Dim F As MyForm = New MyForm(NULL)
F.Show

paxC

using StdCtrls, Forms

class MyForm: TForm {
  private TMemo Memo;
  void MyForm(Owner) {
    this = base.Create(Owner);
    Top = 100;
    Left = 200;
    Caption = "MyForm";
    
    Memo = new TMemo(this);
    Memo.Parent = this;
    Memo.Width = 100;
    Memo.Align = "alClient";
  }
}

MyForm F = new MyForm(NULL);
F.Show();

paxPascal

program Demo;
uses
  StdCtrls, Forms;

type
  TMyForm = class(TForm)
   private
     Memo: TMemo;
   public
     constructor Create(Owner: TComponent);
   end;

constructor TMyForm.Create(Owner: TComponent);
begin
  inherited;
  Top := 100;
  Left := 200;
  Caption := 'MyForm';
    
  Memo := TMemo.Create(Self);
  Memo.Parent := Self;
  Memo.Width := 100;
  Memo.Align := 'alClient';
end;

var
  F: TMyForm;
begin
  F := TMyForm.Create(nil);
  F.Show;
end.


Copyright © 1999-2006 VIRT Laboratory. All rights reserved.