I'm trying to move a program from Delphi to Lazarus to compile on a macbook pro. I'm not using the Delphi to Lazarus converters. I'm rewriting everything from scratch. The Delphi version of the program I want to convert is WMa2.exe at
www.casconorwich.org/pages/math.html. The program includes about 15 procedures for drawing different figures on a paintbox,over 7,000 lines of code. The drawings are simple, lines and polygons, graphs of math functions. I have 2 questions:
1) In Delphi, I can draw figures on the paintbox within each procedure. For example, a simple procedure might look like:
Procedure DrawFig;
begin
With Screen1.Paintbox1.Canvas do
begin
//Draw something on paintbox1.canvas...
end;
end;
But this doesn't work in Lazarus unless I call the procedure from the OnPaint
procedure? This is what I've been reading from all the forum messages and examples. Is there a way, maybe using the Sender or some handle, to draw on the paintbox directly from a procedure without calling it from the Paintbox1Paint procedure? I've run out of ideas.
2) I also want to copy the paintbox.canvas to a bitmap after each change to the paintbox canvas. In Delphi, I use
Bitmap.Canvas.CopyRect(DRect,Screen1.Paintbox1.Canvas,DRect);
But I can't get CopyRect to work in carbon. If I also draw on the bitmap.canvas every time I draw on the Paintbox1.canvas, then that works fine, but that adds an awful lot more code. Is there an easier way that I'm missing? Is it possible to move a paintbox canvas to a bitmap canvas?
Lazarus v1.2.6 carbon widgetset
FPC-2.6.4.intel-macosx
Macbook pro version 10.7.5 Intel Core i7