Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#15

Re: Übersetzung Class MagneticWindow

  Alt 10. Okt 2006, 15:43
Problem mit Property

Delphi-Quellcode:
Type TMagnetic = class
   constructor Create;
   constructor Destroy;
   private
    function GetSnapWidth: Integer;
    procedure SetSnapWidth(NewSnapWidth: Integer);
   public
    property SnapWidth: Integer read GetSnapWidth write SetSnapWidth;

Delphi-Quellcode:
function TMagnetic.GetSnapWidth: Integer;
begin
  Result := SnapWidth;
end;

procedure TMagnetic.SetSnapWidth(NewSnapWidth: Integer);
begin
  SnapWidth := NewSnapWidth;
end;
In Create wird die default SnapWidth zugewiesen.

Delphi-Quellcode:
constructor TMagnetic.create;
begin
  // Default snap width
  SnapWidth := 10;

  // Initialize array (handled windows info)
  m_lWndCount := 0;
end;
Hier kommt der Fehler!

Delphi-Quellcode:
                        Case True of
                          Abs(rcTmp.x1 - x1) < SnapWidth:
                           rcWnd.x1 := x1;
                          Abs(rcTmp.x1 - x2) < SnapWidth:
                           rcWnd.x1 := x2;
                        End;
Zitat:
[Pascal Error] Magnetic.pas(386): E2026 Constant expression expected
Wo liegt das Problem ?

gruß
  Mit Zitat antworten Zitat