Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #8  
Antiguo 14-06-2011
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 4.214
Poder: 24
newtron Va camino a la fama
Hola.

Aquí te envío un ejemplo de la captura del evento "Receivedata" del componente por si te sirve.

Código Delphi [-]

procedure TFormularioVentasTactil.PesoReceiveData(Sender: TObject;
  DataPtr: Pointer; DataSize: Cardinal);
var
  iLastLine, i: integer;
  s, ss: string;
begin
//
  //Convertimos los datos recibidos en una cadena
  s := StringOfChar(' ', DataSize);
  Move(DataPtr^, pchar(s)^, DataSize);

  //Salimos si recibimos el caracter nulo
  while Pos(#0, s) > 0 do
    Delete(s, pos( #0, s ), 1);

  //Comprobamos que la cadena recibida no este vacia o que el valor que esta recibiendo sea '0000000'(que no hay nada en el peso)
  if (s = '') then begin
    Exit;
  end;
  if (Pos('0000000',s) = 1) and (Not Pesamos) then exit;

  if Pos('0000000',s)=1 then
    Pesamos:=False
  else
    Pesamos:=True;

  // Remove line feeds
  i := pos( #10, s );
  while i <> 0 do begin
    delete( s, i, 1 );
    i := pos( #10, s );
  end;

  // Don't redraw the rich edit control until we finished updating it
  //IncomingRichEdit.Lines.BeginUpdate;
  // Get last line index
  iLastLine := NTMemo1.Lines.Count-1;
  // If the rich edit is empty...
  if iLastLine = -1 then begin
    // Remove line feeds from the string
    i := pos( #10, s );
    while i <> 0 do begin
      delete( s, i, 1 );
      i := pos( #10, s );
    end;
    // Remove carriage returns from the string (break lines)
    i := pos( #13, s );
    while i <> 0 do begin
      ss := copy( s, 1, i-1 );
      delete( s, 1, i );
      NTMemo1.Lines.Append( ss );
      i := pos( #13, s );
    end;
    NTMemo1.Lines.Append( s );

  end else begin
    // String to add is : last line added + new one
    s := NTMemo1.Lines[iLastLine] + s;
    // Remove carriage returns (break lines)
    i := pos( #13, s );
    while i <> 0 do begin
      ss := copy( s, 1, i-1 );
      delete( s, 1, i );
      if iLastLine <> -1 then begin
        NTMemo1.Lines[iLastLine] := ss;
        iLastLine := -1;
      end else begin
        //introducimos cantidad en el grid de ventas
        NTMemo1.Lines.Append( ss );
      end;
      if ss<>'0000000' then begin
        MiVenta.CambiaModoEdit(tEntradaDatos);
        NtEditTotal.TomaValor(ss);
      end else begin
        Miventa.CambiaModoEdit(tPresentaTotal);
      end;
      i := pos( #13, s );
    end;

    if iLastLine <> -1 then
      NTMemo1.Lines[iLastLine] := s
    else
      NTMemo1.Lines.Append( s );
  end;

end;

Saludos
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 16:57:59.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi