Error E2018 - Encoder Programming

Forum for Delphi Discussion
tobkin

Error E2018 - Encoder Programming

Postby tobkin » Fri Oct 14, 2011 4:19 am

Hi,
I'am a verry beginer in Delphi.

I have the Problem that this following Code does not work :

Code: Select all

unit Encoder;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, Phidget21COM_TLB, ComCtrls, ComObj, ActiveX;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    TrackBar1: TTrackBar;
    procedure PhidgetEncoderPositionChange(ASender: TObject; Index, Time,
      EncoderDisplacement: Integer);
    procedure PhidgetEncoderDetach(Sender: TObject);
    procedure PhidgetEncoderAttach(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  TrackBar1.Frequency := 50;
  TrackBar1.Min := -1000;
  TrackBar1.Max := 1000;
  Label2.Caption := 'Unattached';
  Label4.Caption := '';
  PhidgetEncoder.Open(-1);
  PhidgetEncoder.WaitForAttachment(3000);

end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  PhidgetEncoder.Enabled[0] := False;
  PhidgetEncoder.Close;

end;

procedure TForm1.PhidgetEncoderAttach(Sender: TObject);
begin
  Label2.Caption := 'Attached';
  PhidgetEncoder.Enabled[0] := True;
  PhidgetEncoder.EncoderPosition[0] := 0;
  TrackBar1.Position := 0;
end;

procedure TForm1.PhidgetEncoderDetach(Sender: TObject);
begin
  Label2.Caption := 'Unattached';
end;

procedure TForm1.PhidgetEncoderPositionChange(ASender: TObject; Index, Time,
  EncoderDisplacement: Integer);
begin
  TrackBar1.Position := TrackBar1.Position + EncoderDisplacement;
  Label4.Caption := IntToStr(PhidgetEncoder.EncoderPosition[0]);
end;

end.


I got this Message:
[DCC Fehler] Encoder.pas(41): E2018 Record, Objekt oder Klassentyp erforderlich

What is wrong?

Thank you for your Help and sorry about my english

Tobias

User avatar
burley
Human-Cyborg Relations
Posts: 439
Joined: Tue Sep 27, 2011 2:37 pm
Location: Calgary
Contact:

Re: Error E2018 - Encoder Programming

Postby burley » Thu Oct 20, 2011 11:32 am

Will the sample code for Delphi compile and run on your PC?
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com


Return to “Delphi”

Who is online

Users browsing this forum: No registered users and 1 guest