Installing Packages lazarus / 10-Designer ---------------------------------------------------------------------- Degibbo · 2017-07-26 06:48 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 · 2017-07-26 12:47 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 · 2017-07-27 03:07 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 · 2017-07-27 08:15 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 · 2017-07-27 08:20 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. ---------------------------------------------------------------------- Degibbo · 2017-07-27 23:43 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 · 2017-07-28 00:05 Quote from: Degibbo on July 28, 2017, 01:43:02 amIn 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. Quote from: Degibbo on July 28, 2017, 01:43:02 amOne 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. ---------------------------------------------------------------------- Degibbo · 2017-07-28 01:58 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 · 2017-07-28 03:23 Quote from: Degibbo on July 28, 2017, 03:58:32 amOK, 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. ---------------------------------------------------------------------- howardpc · 2017-07-28 10:07 Quote from: Degibbo on July 28, 2017, 03:58:32 amWhen 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 · 2017-07-28 15:15 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 · 2017-08-09 03:45 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 · 2017-08-09 11:49 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 · 2017-08-09 23:40 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 · 2017-08-10 03:23 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 ---------------------------------------------------------------------- taazz · 2017-08-10 04:19 lazarus, in contrast with delphi, uses a dynamic "known path" system. Each project creates its own search and output path list by adding in the project the required packages. In your case open the package select "add\new requirement" and add the packages required by your component I think that you need at least lcl and lclbase. After that try to compile and see which units can not find. Find those units pacakges and add them to the required packages of your package. Now as for the duplicate compiled files, if its about your files then always answer yes, let the IDE clean up those duplicates for you, less headaches down the road. ---------------------------------------------------------------------- molly · 2017-08-10 04:22 @Degibbo: Unfortunately i'm not very good at holding hands but perhaps while waiting for someone that could , the following links could perhaps help you get a better understanding (in case you haven't read already). - Lazarus Packages - How to write a lazarus component - Porting Delphi components to Lazarus - Installing Packages ---------------------------------------------------------------------- balazsszekely · 2017-08-10 05:00 @Degibbo Here you go...