Results 1 to 3 of 3

Thread: Lazarus component nightmare

  1. #1

    Lazarus component nightmare

    I'm trying to port a project from Delphi to Lazarus. Unfortunately, my project uses a handful of custom VCL components, and trying to get them to work is a mess. Once I've gone through the source code and commented out all the properties that Lazarus doesn't support yet, the package will finally compile and install, prompting me to recompile Lazarus to make the components available on the palette. But once I've done the recompile...
    ...there's nothing new on the component palette, and there are blank spots on my forms where the components are supposed to be. Any idea what's wrong and how to fix it?

    Mason

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Lazarus component nightmare

    Hey Mason, you should know that LCL is not fully VCL/.DFM compatible. Though code-wise it usually is.

    Lazarus is designed to be an alternative to Delphi, not specifically a 100% compatible clone of it. Usually when one uses VCL in Delphi and wants to convert to LCL in Lazarus, they would be better off redoing the visual components portion and simply copy-paste-ing the code inside each form/component's method over to the new Lazarus version.

    This can be a bit of a pain, but it's 100% effective, so long as LCL has what the VCL you used had and used.

    There are some conversion tools out there somewhere, but unfortunately I have not worked with them at all. Others might be able to tell you more about them. But I find the above method to work best for me.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Lazarus component nightmare

    You can get it done by using the proper registration methods. See some other (simple) Lazarus components for what calls need to be made and what resources need to be prepared.

    In short, you need to:
    1. make xpm icons for a lazarus resource for the package and name them as the components (eg: TMyComponent.xpm)
    2. use "lazres" from Lazarus/tools to "compile" a lazarus resource file for the components, like eg: "lazres file.lrs *.xpm" (not sure if * works in windows, it does in linux)
    3. use proper register procedure for your components, as per Lazarus wiki (sorry, am in a hurry here, would look up the URL otherwise)

    That should get it going if everything else compiled, it should work (of course some things can still break because of bugs etc. but you're on a good track by this point)
    Feel the power of Open Source.
    <br />Feel the power of Free Pascal.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •