Sign in Join

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

Mailing lists / lazarus / 2010-10

Font.Handle

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Juha Manninen gmail

Hi

How to get rid of "Font.Handle" in the following code? "Font.Handle" is deprecated;.

  Font := TFont.Create;
  Font.Name := '';
  Font.CharSet := CS;
  DC := GetDC(0);
  try
    Save := SelectObject(DC, HGDIOBJ(Font.Handle));
    GetTextMetrics(DC, tm);
    ... do something ...
    SelectObject(DC, Save);
  Finally
    ReleaseDC(0, DC);
    Font.Free;
  end;

I haven't done much with graphics or fonts and this may be a stupid question.

Juha

Reply by email

Felipe Monteiro de Carvalho
to Juha Manninen gmail

Is it really deprecated? I don't think it is a good idea to deprecate it, too many programs use it to get the Windows handles, so it should keep doing what it does on Windows.

For other platforms a new method can be created. In fact I am in need of solving this issue at the moment. Do we already have a reliable and simple way to get the X-window handle of a control?

Felipe Monteiro de Carvalho

Reply by email