Ver Mensaje Individual
  #5  
Antiguo 02-03-2015
CM6ISG CM6ISG is offline
Registrado
NULL
 
Registrado: feb 2015
Posts: 4
Reputación: 0
CM6ISG Va por buen camino
Hola Necesito ayuda con Cortar Cadenas en Delphi 7

Saludos: Gracias por acudir en mi ayudad, hice la simulación y todo perfecto, exactamente eso es lo que necesito hacer. Pero cuando fui a implementarlo entre las propiedades y funciones del ComPort que tengo no encuentro (Output_CportLib), la versión que tengo es ComPort Library ver. 2.64, estoy usado Delphi 7, Windows 7 Professional x32
Use ComPort1.ReadStr, que la que he probado y me funciona,
A la hora de compilar me da el siguiente error

Project Catsimulado.exe raised exception class EStringListError with message ‘List index out bounds (1)’. Process stopped. Use Step or run to continue.
no logro determinar donde esta el error.

Código Delphi [-]
unit simulacion;      
 interface       uses     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,     Dialogs, StdCtrls, CPort;
type   
  TForm1 = class(TForm)  
 Memo1: TMemo;
 Edit1: TEdit;
 Edit2: TEdit;
 Edit3: TEdit;
 Edit4: TEdit;
 Edit5: TEdit;  
 Edit6: TEdit;
 Label1: TLabel; 
 Label2: TLabel;
 Label3: TLabel;
 Label4: TLabel; 
 Label5: TLabel;
 Label6: TLabel; 
 Label7: TLabel;
 Button1: TButton; 
 ComPort1: TComPort;

  procedure ComPort1RxChar(Sender: TObject; Count: Integer);
  private       { Private declarations }     
  public       { Public declarations } 
  end;    

 var     
 Form1: TForm1;      
 implementation
   {$R *.dfm} 
 procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);

 var      
StrList: TStringList;
Power, Qsl, Modo, FTX, FTR, Str : String;   

    begin
   ComPort1.ReadStr(Str, Count);
   StrList := TStringList.Create;  
   ExtractStrings(['#'], [], PChar(Str), StrList);   
   
   Power := StrList[0];      
   Qsl := StrList[1]; 
   Modo := StrList[2];  
   FTX := Copy(StrList[3],3,Length(StrList[3]));  
   FTR := Copy(StrList[4],3,Length(StrList[4]));      
   Memo1.Text := Str;
   Edit1.Text := Str;
   Edit2.Text := Power;   
   Edit3.Text := Qsl;   
   Edit4.Text := Modo;    
   Edit5.Text := FTX;  
   Edit6.Text := FTR;    
   StrList.Free;  
   end;   
end.

Gracias colega por tu respuesta, tan rápido.
Imágenes Adjuntas
Tipo de Archivo: jpg Error.JPG (23,3 KB, 4 visitas)

Última edición por CM6ISG fecha: 02-03-2015 a las 06:15:22. Razón: Arreglando etiquetas
Responder Con Cita