[fpc-pascal] Can't close and reopen ptcgraph

James Richters james at productionautomation.net
Wed Jun 28 20:08:45 CEST 2017


I thought I would try to get my demo program to work.  When I try to compile it with

//manually create the ptcwrapper thread
PTCWrapperObject := TPTCWrapperThread.Create;

I get reopengraph.pas(32,23) Error: Identifier not found "TPTCWrapperThread"

Demo program below... Any ideas?

James

{$mode objfpc}{$H+}
program ReOpenGraph.pas;
uses
  ptcgraph,ptccrt;
var
  gd,gm : smallint;

begin
  gd:=d8Bit;
  gm:=m800x600;
  Writeln('Opening Graphics Window');
  Initgraph(gd,gm,'');
  Writeln('Graphics Window Open');
  setcolor($4A);
  settextstyle(Defaultfont,HORIZDIR,2);
  outtextxy(30,30,'Graphics Window Open');
  readkey;
  //close graph window
  Closegraph;
  //manually terminate the ptcwrapper thread and free object
  PTCWrapperObject.Terminate;
  PTCWrapperObject.WaitFor;
  PTCWrapperObject.Free;
  Writeln('Closing Graphics Window');
  readln;
  Writeln('Create ptcwrapper thread');
  //manually create the ptcwrapper thread
  PTCWrapperObject := TPTCWrapperThread.Create; //compiler error 
  Writeln('Re-Opening Graphics Window');
  //init graph windows as usual
  Initgraph(gd,gm,''); // window opens then closes immediately with ptcgraph
  Writeln('Graphics Window Open Again'); // this never happens with ptcgraph
  setcolor($4A);
  settextstyle(Defaultfont,HORIZDIR,2);
  outtextxy(30,30,'Graphics Window Open Again');
  Readln;
  Closegraph;
end.




More information about the fpc-pascal mailing list