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

James Richters james at productionautomation.net
Fri Jun 23 17:20:07 CEST 2017


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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170623/0545f29e/attachment.html>


More information about the fpc-pascal mailing list