I ran into an unexpected issue with ptcgraph.  If I use closegraph, I cannot
re-open a new ptcgraph window with Initgraph.  It looks like it opens the
second graph window but then closes it immediately after.. my program is
then appears to be locked up after this happens.. no errors, just locked up.
test program is below.  If I comment out ptcgraph and ptccrt and uncomment
graph and wincrt, it works as expected.

 

James

 

 

program ReOpenGraph.pas;

 

{$mode objfpc}{$H+}

 

uses

  ptcgraph,ptccrt;

//  graph,wincrt;

 

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;

  Closegraph;

  Writeln('Closing Graphics Window');

  readln;

  Writeln('Re-Opening Graphics Window');

  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.

 

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to