unit uMeasureWei;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uMeasureBase, dxExEdtr, SPComm, ADODB, DB, ExtCtrls, dxBar,
  dxBarExtItems, ImgList, StdCtrls, MPlayer, dxTL, dxCntner,uFunMesClient;

type
  TfrmMeasureWei = class(TfrmMeasureBase)
    procedure Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
      BufferLength: Word);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMeasureWei: TfrmMeasureWei;

implementation

uses PublicDBUnit;

{$R *.dfm}

procedure TfrmMeasureWei.Comm1ReceiveData(Sender: TObject;
  Buffer: Pointer; BufferLength: Word);
var
  i: real;
  str,firchar :string;
begin
  ImageOff.Visible  := false ;
  ImageOn.Visible   := true ;
  if edtCode.Text = '' then Exit;
  x := x + 1 ;
  x := X mod 3;
  if x = 0 then
  begin
    SetLength(Str,BufferLength);
    move(buffer^,pchar(@Str[1])^,bufferlength);
    str := trim(Str);
    firchar := Copy(str,1,1);
    if firchar <> '+' then
    begin
      ImgYel.Visible := not ImgYel.Visible ;
      Exit;
    end;
    i := GetLight(str) ;
    if meNum <> i then
    begin
      meNum := i ;
      if (meNum > MyWork.MaxNum)or (meNum < MyWork.MinNum) then
      begin
        ImgRed.Visible := true   ;
        ImgGreen.Visible := false ;
      end
      else
      begin
        ImgRed.Visible := false   ;
        ImgGreen.Visible := true ;
      end;
      edtNum.Text := FloatToStr(meNum)+ 'g' ;
    end;
  end;

end;

end.
