aditri 0 Newbie Poster

i/m try to record my data from gps to array but i get so much problem here

unit tgn_Main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, oaGPS_NMEA_Extractor, ExtCtrls, ComCtrls;

type
  TfTest = class(TForm)
    gbStrigs: TGroupBox;
    lbLog: TListBox;
    gbPosition: TGroupBox;
    lLongitude: TLabel;
    lLatitude: TLabel;
    lAltitude: TLabel;
    gbDateTime: TGroupBox;
    lTime: TLabel;
    lDate: TLabel;
    btnPort: TButton;
    btnConnect: TButton;
    gbDirection: TGroupBox;
    lTrack: TLabel;
    lKts: TLabel;
    lMagDev: TLabel;
    memo1: TMemo;
    Memo2: TMemo;
    Memo3: TMemo;
    Memo4: TMemo;
    Memo5: TMemo;
    Button1: TButton;
    Memo6: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure btnPortClick(Sender: TObject);
    procedure btnConnectClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Déclarations privées }
    GPS_Info : ToaGPS_NMEA;
    procedure AddString;
    procedure ShowInfo;
    //Longitude : Array of string;  // Static array, 2 dimensions
    //Latitude : Array of lLatitude.Caption;     // Static array, size = 16

  public
    { Déclarations publiques }
  end;

var
  fTest: TfTest;
  arr: array of Tlabel

implementation

{$R *.DFM}

procedure TfTest.FormCreate(Sender: TObject);
begin
  GPS_Info := ToaGPS_NMEA.Create(Self, 'GPS_COM');
  GPS_Info.OnInputStr := AddString;
  GPS_Info.OnNewPosition := ShowInfo;
  GPS_Info.Active := True;
end;

procedure TfTest.AddString;

begin
  with lbLog do ItemIndex := Items.Add(GPS_Info.InputStr);
end;

procedure TfTest.ShowInfo;
var
  GPS_Info:string;
begin
  lTime.Caption := 'Time : ' + TimeToStr(GPS_Info.TU_GPS);
  lDate.Caption := 'Date : ' + DateToStr(GPS_Info.Date_GPS);
  lLongitude.Caption := 'Longitude : ' + FormatFloat(',.0000', GPS_Info.Longitude);
  lLatitude.Caption := 'Latitude : ' + FormatFloat(',.0000', GPS_Info.Latitude);
  lAltitude.Caption := 'Altitude : ' + FormatFloat(',.0', GPS_Info.Altitude);
  lTrack.Caption := 'Track angle : ' + FormatFloat(',.0000', GPS_Info.TrackAngle);
  lKts.Caption := 'Speed (kts) : ' + FormatFloat(',.0000', GPS_Info.Kts);
  lMagDev.Caption := 'Magnetic deviation : ' + FormatFloat(',.0', GPS_Info.MagneticDeviation);
  GPS_Info.Longitude := string;
  arr[GPS_Info.Longitude]:=Tlabel.Create(Self);
    arr[GPS_Info.Longitude].parent:=Self;
    arr[GPS_Info.Longitude].Caption :='Tlabel' + FormatFloat(GPS_Info.Longitude, GPS_Info.Latitude);
  //Memo5.lines.Add('Panjang longitude = '+IntToStr(Length(lLongitude)));
end;
procedure TfTest.btnPortClick(Sender: TObject);
begin
  GPS_Info.Comport.ShowSetupDialog;
end;

procedure TfTest.btnConnectClick(Sender: TObject);
begin
  GPS_Info.Active := True;
  memo1.clear;
  memo1.lines.Add(TimeToStr(GPS_Info.TU_GPS));
  Memo2.clear;
  Memo2.lines.Add(DateToStr(GPS_Info.Date_GPS));
  Memo3.clear;
  Memo3.lines.Add(FormatFloat(',.0000', GPS_Info.Longitude));
  Memo4.clear;
  Memo4.lines.Add(FormatFloat(',.0000', GPS_Info.Latitude));
  Memo5.clear;
  Memo5.lines.Add(FormatFloat(',.0', GPS_Info.Altitude));

  end;
procedure TfTest.Button1Click(Sender: TObject);
begin
   lTime.Caption := 'Time : ' + TimeToStr(GPS_Info.TU_GPS);

end;

end.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.