Recent

Author Topic: Using graph unit  (Read 16672 times)

p.barton@twgs.qld.edu.au

  • Newbie
  • Posts: 4
Using graph unit
« on: August 28, 2012, 01:27:34 am »
Hi,
Trying to get Lazarus to run the "graph" unit in Pascal - uses graph;

Works just fine when installed on my laptop but when installing onto our school network get this message:
C:\Users\bartp\AppData\Local\Temp\project1.lpr(1,1) Fatal: Can't find unit Graph used by UsingGraphics

I'm guessing it is something to do with the path of the graph unit.  Any suggestions?

Sample code I'm running to check if graphics will work below:

Program UsingGraphics;
Uses Crt,Graph;
Var GraphicsDriver, GraphicsMode:smallint;

procedure OpenGraphics;
Begin
 Writeln('Graphics Initialised.');
 GraphicsDriver := Detect;
 InitGraph(GraphicsDriver, GraphicsMode,'');
end;

procedure CloseGraphics;
begin
     CloseGraph;
     Writeln('Graphics Closed.');
End;

procedure DrawCircle;
begin
     circle(320,240,100);
end;

{MISSION CONTROL}
begin
     OpenGraphics;
     repeat
   DrawCircle
     until keypressed;
     CloseGraphics;
     readln;
end.

Blaazen

  • Hero Member
  • *****
  • Posts: 2782
  • POKE 54296,15
    • Eye-Candy Controls
Re: Using graph unit
« Reply #1 on: August 28, 2012, 01:48:32 am »
There were some discussions about this unit, I don't if it is somewhere in FPC sources.
Try unit "ptcgraph" instead.
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

p.barton@twgs.qld.edu.au

  • Newbie
  • Posts: 4
Re: Using graph unit
« Reply #2 on: August 28, 2012, 01:57:38 am »
No good, thanks for your suggestion.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Using graph unit
« Reply #3 on: August 28, 2012, 02:00:08 am »
On my system it is at C:\Lazarus\Fpc\2.6.1\Source\Packages\Graph\Src\Win32
But it depends on the OS.  Check in C:\Lazarus\Fpc\2.6.1\Source\Packages\Graph\Src for your OS.
Lazarus Trunk / fpc 2.6.2 / Win32

p.barton@twgs.qld.edu.au

  • Newbie
  • Posts: 4
Re: Using graph unit
« Reply #4 on: August 28, 2012, 02:08:12 am »
Thanks for your help.  Have it working fine on my laptop but when I try to run using machines on our school network it can't find the graph.pp file.  I have tried adding the path in the InitGraph section but without success.
Will keep trying. Thanks.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Using graph unit
« Reply #5 on: August 28, 2012, 02:16:55 am »
If you Open the Project Inspector from  Menu "Project/Project Inspector" click on the "Add" button, it will add it to the Path.

Edit: Then go to "Project/Project Options" and check the box for "Use these compiler Options as Default for new projects".
« Last Edit: August 28, 2012, 02:23:26 am by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7639
Re: Using graph unit
« Reply #6 on: August 28, 2012, 10:17:12 am »
Windows is a special case, it is called "wingraph" there, just like in Windows versions of Turbo Pascal.
The "win" alludes to the integration with Windows GDI system.

See the games in the FPC demos/examples (fpctris/samegame) for examples of graph.

I don't know if Lazarus packages those though.