Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-08

Getting my app. to 'sleep'

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

Hi,

I have been using the following code to write data to a serial printer:

var  ser:TBlockSerial;
  buf:string;
begin
    ser:=TBlockserial.Create;
    try
      ser.RaiseExcept:=True;
      ser.Connect(cashdrawer);
      ser.Config(9600,8,'N',0,false,false);
      ser.SendString(buf);
      ser.Flush;
    finally
      ser.Free;
    end;
end;

However, if I use this nothing gets sent to the printer.

But if I place

      showmessage('Printed!');

after the ser.SendString(but) then it prints out as expected.

Is there any way to get the program to pause before it frees up the TSerial object? It's a bit of a pain having to click the okay button of the Showmessage() all the time....

Reply by email

Lee Jenkins
to Dave Coventry
Dave Coventry wrote 25 lines
Hi, I have been using the following code to write data to a serial printer: var ser:TBlockSerial; buf:string; begin ser:=TBlockserial.Create; try ser.RaiseExcept:=True; ser.Connect(cashdrawer); ser.Config(9600,8,'N',0,false,false); ser.SendString(buf); ser.Flush; finally ser.Free; end; end; However, if I use this nothing gets sent to the printer. But if I place showmessage('Printed!'); after the ser.SendString(but) then it prints out as expected.

What a call to Sleep() ?

Warm Regards, Lee

Reply by email