Products for USB Sensing and Control
It is currently Wed Aug 20, 2014 6:40 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 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:
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


Top
  
 
PostPosted: Thu Oct 20, 2011 11:32 am 
Offline
Human-Cyborg Relations
User avatar

Joined: Tue Sep 27, 2011 2:37 pm
Posts: 404
Location: Calgary
Will the sample code for Delphi compile and run on your PC?

_________________
Brian Burley
403-282-7335 ext. 6003
support@phidgets.com


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group