Recent

Author Topic: Installing Packages  (Read 9970 times)

Degibbo

  • New Member
  • *
  • Posts: 46
Installing Packages
« on: July 26, 2017, 08:48:18 am »
G'day all,
For the record: V 1.6.4 FPC 3.0.2
Not everything goes as planned, and examples do not always help, but:
I am having trouble installing a package, which I will call "gaugecontrol".
Lazarus created a second package called "gauge". 

The first package installation complains that gaugecontrol.ppu was found
in the source directory and looks like a compiled unit and that it must be in
the output directory (what ever that is) & option to delete the ambiguous file.

Should I?

I tried to install the gauge package (auto created) but the error is no "register".

All very confusing to a newby.

Can anyone please talk me through how to install the component?

Gaugecontrol is a component that draws a complex gauge on a canvas, that I
use in other units (well I would like to), but even when shown as "installed" the
TGaugeControl can't be found, something about class(?).

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Installing Packages
« Reply #1 on: July 26, 2017, 02:47:30 pm »
Hard to say what goes wrong. By "a package" and "second package" do you mean you have two .lpk files?
Perhaps your best bet is to save the source of the component somewhere safe, noting which class it descends from. Then uninstall the component from the IDE (if it is installed).
Then delete all files and directories related to the failed component.
Make sure you have a stable working Lazarus.
Then use the Package > New component... wizard to create a new package which you name and save in a new location, with just the ancestor class and new component name filled in.
This will give you a new package with a unit containing skeleton code for the new component.
Compile this empty skeleton.
If all goes well, you can then fill out the skeleton component from your saved source.
If not, then perhaps you need to reinstall Lazarus clean?

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #2 on: July 27, 2017, 05:07:37 am »
G'day HowardPC,
Thanks for the instructions, which made complete sense.

However, I am still in trouble.  The dialog box that shows the package tree
has the cursor in an edit box as if waiting for something like a file name.
clicking compile does something but no confirmation message is returned.

Clicking on use and following the prompts to rebuild Lazarus results in a file
dialog box.  What is supposed to go in there?  I pointed it to where Lazarus
resides - is this correct?

Anyway, something appears to happen (but no prompts to say what).  Closing
and restarting the "new" Lazarus exe results in the file dialog box again, but
still no prompts to say what it is looking for, so I directed it to where it resides
(again).

The package group does not appear on the tool bar, so I am obviously still doing
something wrong

Sorry to be such a pain, but the help file was no help at all.

Cheers & thanks for your kindly support,
DG

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Installing Packages
« Reply #3 on: July 27, 2017, 10:15:04 am »
Are you trying to install a ready-made package from a third party (.lpk and associated files) or trying to create a new gauge control, installed on the component palette, which you are writing yourself? My earlier suggestions were related to the latter option.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Installing Packages
« Reply #4 on: July 27, 2017, 10:20:37 am »
I think the confusion is this:
For Lazarus to work at design time it needs some code to design.
For your Lazarus application to run it does not need that code.
So often there are 2 packages: one to design, one just for your application.

A well written component will separate the two.
« Last Edit: July 27, 2017, 10:23:25 am by Thaddy »
Specialize a type, not a var.

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #5 on: July 28, 2017, 01:43:02 am »
G'day all,
Thanks for the responses.  I am sure that it is just something that I am doing wrong due to my own ignorance.
The component is one that I wrote in Delphi 2010 many years ago, and it worked in Delphi (that I no longer have access to).  The component is design time and run time, and I am installing it into a new package.

In the package designer under install / remove, the package shows as installed, but when creating a form that refers to the component it can't be found, and the package (although"installed") does not appear on the component package tabs.

One thing that I need to clarify is that after re-compiling Lazarus, and restarting, what is the popup file dialog looking for?  Is it the working directory for project files?

Cheers & thanks,
DG

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Installing Packages
« Reply #6 on: July 28, 2017, 02:05:03 am »
In the package designer under install / remove, the package shows as installed, but when creating a form that refers to the component it can't be found, and the package (although"installed") does not appear on the component package tabs.

Assuming that you have a correct register procedure for your component, check your package that it has at least one register unit(the icon of a play button in a page), see attached image for an example of what a register unit. If not then open any package to and study how they register their controls.

One thing that I need to clarify is that after re-compiling Lazarus, and restarting, what is the popup file dialog looking for?  Is it the working directory for project files?
I never heard of it before, you have to upload a screen shot for us to see what you are talking about.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #7 on: July 28, 2017, 03:58:32 am »
OK, lets take this one step at a time:
When I start Lazarus.exe, I get the pop-up screen
(hopefully) in the attached file:

What is it looking for?

Thanks,
DG

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Installing Packages
« Reply #8 on: July 28, 2017, 05:23:13 am »
OK, lets take this one step at a time:
When I start Lazarus.exe, I get the pop-up screen
(hopefully) in the attached file:

What is it looking for?

Thanks,
DG
I have no idea. try pressing ignore/cancel and select tools\options and click on the files on the tree and see if any path is empty. Most notable are make, compiler, fpc source, debugger executable path. everything else I think is non critical.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Installing Packages
« Reply #9 on: July 28, 2017, 12:07:17 pm »
When I start Lazarus.exe, I get the pop-up screen
(hopefully) in the attached file:

I would say you have a faulty or corrupted Lazarus install, probably to do with package management.
Simplest would be to uninstall Lazarus, uninstall FPC, delete all Lazarus configuration-related files (such as in .../Users/username/AppData/Local/Lazarus) and start again with a freshly downloaded installer.

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Installing Packages
« Reply #10 on: July 28, 2017, 05:15:53 pm »
You say that this is a component that you wrote yourself in Delphi 2010 days. A lot can go wrong when converting to Lazarus. Maybe you should upload your component here along with all package-related units and a short demo to show its usage. Helping you would be much easier if we could see what exactly you have. Pack all required files (but not binaries or compiler-generated files, please) into a common zip which you can upload under "Attachments and other options".

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #11 on: August 09, 2017, 05:45:02 am »
G'day,
I am still having trouble installing components!
If someone could look over the attached file and see what is wrong (if anything) that would be appreciated.

I also need to clarify which directory the component file(s) should reside in.
That is not at all clear from the "help" instructions.

Cheers & thanks,
DG

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Installing Packages
« Reply #12 on: August 09, 2017, 01:49:07 pm »
You should create a package for the component.
Best to save this in a new directory, probably a subdirectory of the project it relates to.
The
  Package > New Component...
wizard helps you set this up.

Is your goal to create a gauge that you can click on to drag a pointer up and down to set its value?
Or are you simply after a display component that shows the pointer at varying values but does not need to have user interaction to set values?

There are various shortcomings in your code. The biggest being that you cannot use the Paint method to set any width or height or location values. This sets up a recursive loop.
Repositioning and resizing code has to live outside the Paint event.

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #13 on: August 10, 2017, 01:40:56 am »
G'day HowardPC,
Thanks for looking at my code and your comments, I still have a lot of learning to do!

The control does not interface directly on screen.  All the parameters are always and
only modified programatically, but the instances and positions of the controls are
established at design-time.

Would it be wiser for me to move some of the gauge construction stuff to, say, the
create procedure, and maybe use an "update" procedure to set the things that change?

Your helpful advice is always welcome,
thanks,
DG

Degibbo

  • New Member
  • *
  • Posts: 46
Re: Installing Packages
« Reply #14 on: August 10, 2017, 05:23:54 am »
Nope, I still need hand holding:

I created a sub directory for my control, but upon compiling,
none of the Uses units are found.  I guess I have to tell Lazarus
something about where I am (I would have thought that it would
be taken care of automatically).

Also, the compiler mumbles something about files in the wrong
directories (input vs output) and do I want to delete the offending
file?

I really have no understanding as to what is going on and need to
be taken through this step by step.

Can anyone find the time to help please?  No doubt what is straight
forward to you is a black fog for me.

Cheers & thanks,
DG

 

TinyPortal © 2005-2018