Recent

Author Topic: porting yearplan component  (Read 7294 times)

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
porting yearplan component
« on: March 18, 2010, 02:40:34 am »
I am trying to port the yearplan component from Delphi code, I have run into a stumbling block at this point, which is part of a DrawGridLines procedure, I can't find an equivalent fro the WinProcs declaration.
Code: [Select]
{$IFDEF WIN32}
      Windows.MoveToEx(DrawDC, X, Y, nil);
      Windows.LineTo(DrawDC, X, Y + LineHeight);
      {$ELSE}
      WinProcs.MoveToEx(DrawDC, X, Y, nil);
      WinProcs.LineTo(DrawDC, X, Y + LineHeight);
      {$ENDIF}   
can anyone point me in the right direction?

Regards
Dave
All things considered insanity seems the best option

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: porting yearplan component
« Reply #1 on: March 18, 2010, 05:56:28 am »
You can use both functions from LCLIntf. There's no need to do a conditional define.

uses
  LCLIntf;

  MoveToEx(DrawDC, X, Y, nil);
  LineTo(DrawDC, X, Y + LineHeight);

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: porting yearplan component
« Reply #2 on: March 18, 2010, 11:30:03 am »
Note that this is simply an artefact. Under Delphi, the "win32" directive signals windows 95 or higher.

Before Kylix introduced Linux, the only one that didn't define win32 was Delphi 1, which was for windows 3.1x.  Delphi 1 also had no "windows" unit (introduced in Delphi 2), but a "winprocs, wintypes" etc unit.

Since we can declare win 3.11 dead, the ifdef and the winprocs side of things should be simply removed. Also on Delphi.

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
Re: porting yearplan component
« Reply #3 on: March 18, 2010, 12:47:10 pm »
Thanks to both of you, the LineTo(DrawDC, X, Y + LineHeight); has the wrong parameters, should be a TPoint is there anther function that I can use?

Regards
Dave
All things considered insanity seems the best option

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: porting yearplan component
« Reply #4 on: March 18, 2010, 09:51:26 pm »
The LCLIntf has this same declaration

Try: LCLIntf.LineTo(DrawDC, X, Y + LineHeight);

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
Re: porting yearplan component
« Reply #5 on: March 19, 2010, 11:44:30 pm »
Thanks Luiz, that worked.

Regards
Dave
All things considered insanity seems the best option

Silvio Clécio

  • Guest
Re: porting yearplan component
« Reply #6 on: March 19, 2010, 11:55:30 pm »
Congratulations to your work and its link friend - http://www.users.on.net/~dave.stewart/index.html  :)

Very good.

 

TinyPortal © 2005-2018