Forum > Ported from Delphi/Kylix

Adding a Delphi visual package to IDE

(1/2) > >>

Rog:
I have started to play with Lazarus after several years away from Delphi (D7), as I have an old program that needs some updates.

The program uses a specific component, which I need to imprort into Lazarus.

1) I have run the pas file through the Lazarus Tools/Delphi Conversion/Convert Delphi Unit Into Lazarus Unit module and it seems to have converted ok: it Replaced unit "Windows" with "LCLIntf, LCLType, LMessages" in uses section.

2) I have used lazres to create the IDE icon from the png icon I extracted from the .dcu file.

This gave me 2 files: YP.pas and YP.lrs

3) Added a reference to LResources to the  Uses clause of the YP.pas.

4) Added:
initialization
  {$I YP.lrs}
just before the final .end of the .pas file.

I am a bit confused by the various instructions %), so can someone confirm what has to be done to add the component to the IDE?

Many thanks



howardpc:
It may be a good idea, before you add the component to the IDE palette to write a very simple test program that exercises the converted component to check that the conversion does not need further tweaking. Could be as simple as adapting this:



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  test: TMyComponent=nil;  TForm1.OnCreate(Sender: TObject);begin  test:=TMyComponent.Create(Self);  test.Left:=xx;  test.Top:=yy; // test.OtherProperty:=... etc.  test.Parent:=Self;end;

Rog:
Happy New Year everyone!

Sorry for delay - but been away over Xmas!

Have tested as suggested and it works fine, have tried but have not been able to add it to the IDE, so can you let me know exactly what needs to be done to add it as a visual component to the IDE

Thanks for help

x2nie:
yes, it sometime happened on me too: fail on converting delphi DPK into lazarus LPK (package).


Usually, it was resolved by manually add files into package dialog via clicking 'Add>>'.
and sometime I need to remove and then add back files needed.


If you can open the package created (*.lpk), please compile the package.
if it okay, please checkmark the "register unit". see attachment:


(I assumed you already know that : your package is for designtime, not runtime-only)

x2nie:
if everything is okay, on your package dialog, click USE >> INSTALL.
and then wait. it will restart lazarus if success.
after lazarus restart, your component will be in component palette.

Navigation

[0] Message Index

[#] Next page

Go to full version