Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-09

Drawing on MAC using GetDC

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Torsten Bonde Christiansen

Hi List

I am currently trying to improve on the ported version of jvRuntimeDesigner component (available at SF here
<http://sourceforge.net/projects/jvruntimedesign/>), but I am having a hard time getting it working correctly on a MAC with the Carbon widgetset.

More specifically the component uses a GetDC(..) (GetDesignerDC(..) on linux/windows) to retrieve a device
context to draw to, using regular canvas. But where on GTK2 (linux) and Windows the drawing goes well and
is fully visible, nothing happens on MAC.

My research have lead me so far, that I think the problem is that component has not system DC, but instead
is assigned an empty DC.

I have practically no experience in programming directly to MAC and I have no clue what to look for, so any
help would be appriciated.

Kind regards,
Torsten Bonde Christiansen.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120907/5d2b533f/attachment.html>

Reply by email

Mattias Gaertner
to Torsten Bonde Christiansen

Torsten Bonde Christiansen hat am 7. September 2012 um 11:00 geschrieben:

Show quoted text 22 lines
Hi List I am currently trying to improve on the ported version of jvRuntimeDesigner component (available at SF here <http://sourceforge.net/projects/jvruntimedesign/> ), but I am having a hard time getting it working correctly on a MAC with the Carbon widgetset. More specifically the component uses a GetDC(..) (GetDesignerDC(..) on linux/windows) to retrieve a device context to draw to, using regular canvas. But where on GTK2 (linux) and Windows the drawing goes well and is fully visible, nothing happens on MAC. My research have lead me so far, that I think the problem is that component has not system DC, but instead is assigned an empty DC. I have practically no experience in programming directly to MAC and I have no clue what to look for, so any help would be appriciated.

You can paint *only* during the OnPaint event on Mac.

For the designer paint in the Paint event of the form:

  DesignerDC := GetDesignerDC(Form.Handle);
 ...draw...
  ReleaseDesignerDC(Form.Handle, DesignerDC);

Mattias

Reply by email