Forum > Beginners

[Solved]Package does not install Component

(1/5) > >>

Birger52:
Created  a package and two components.
Both are derived from TPanel - one with an added scrollbar, the other width an added label.

Mostly to learn, but also for later serious use.

Created 2 24x24 .png's, converted to .lrs
Created a page (Tools/Options/Environtment/Component Palette) for my components.

It all compiles just fine.
Without errors that is.
In the package editor, in registered plugins section, when the .pas file is selected, one of the components has a wrong icon (the default one), but is on the right page, the other has the designated icon, but is not set to any page.

Installing and (re)compiling the IDE, only the one with the wrong icon shows up on the designated page - the other one, is nowhere to be found.

Hope someone can help me with this...



Apart from the additional componenets, both files are identical (And basically generated by Lazarus itself):


--------------
unit LabelListContainer;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, StdCtrls, ExtCtrls, Graphics;

type
  TLabelListContainer = class(TPanel)
  private
     FScroller : TScrollBar;
     FscrTop : integer;

  protected

  public
     property scrTop : integer read FScrTop write FScrTop default 16;
     constructor Create(TheOwner: TComponent); override;

  published
     property Scroller : TScrollBar read FScroller;

  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Mine',[TLabelListContainer]);
end;

constructor TLabelListContainer.Create(TheOwner: TComponent);
begin
  inherited Create(TheOwner);
  FScroller := TScrollBar.Create(Self);
  FScroller.Parent := Self;
  FScroller.Kind := TScrollBarKind.sbVertical;
  FScroller.Name := 'Scroller';
  FScroller.Align := TAlign.alRight;
  FScroller.BorderSpacing.Top := scrTop;
  FScroller.SetSubComponent(true);
  FScroller.ControlStyle := FScroller.ControlStyle - [csNoDesignSelectable];
  FScroller.Enabled := false;
end;

initialization
  {$I TLabelListContainer.lrs}

end.
--------------
unit LabelList;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, StdCtrls, ExtCtrls, Graphics;

type
  TLabelList = class(Tpanel)
  private
    FHeadLabel : TLabel;
    function GetHeader : string;
    procedure SetHeader(head : string);

  protected

  public
    property HeadText : string read GetHeader write SetHeader;
   constructor Create(TheOwner: TComponent); override;

  published

  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Mine',[TLabelList]);
end;

constructor TLabelList.Create(TheOwner: TComponent);
begin
  inherited Create(TheOwner);
  FHeadLabel := TLabel.Create(Self);
  FHeadLabel.Parent := Self;
  FHeadLabel.Align := TAlign.alTop;
  FHeadLabel.Font.Style := [fsBold];
  FHeadLabel.Name := 'HeadLabel';
  FHeadLabel.Caption := 'Header';
  FHeadLabel.SetSubComponent(true);
  FHeadLabel.ControlStyle := FHeadLabel.ControlStyle - [csNoDesignSelectable];
end;

function TLabelList.GetHeader : string;
begin
  GetHeader := FHeadLabel.Caption;
end;

procedure TLabelList.SetHeader(head : string);
begin
  FHeadLabel.Caption := head;
end;

initialization
  {$I labellist.lrs}

end.

Birger52:
212 people has been by.
Not one comment.

Used 3 days by now on Lazarus - getting nowhere.

To at least do something I uninstalled, reinstalled - same problem.
So uninstalled and moved file (.pas and .lrs) to a new folder, and created a new packet, and 2 new components from files, installed - exactly same problem.

Created a new packet, a new component (TPanel), and only one. Lazurus does it all. Create folder, give the component a name, and points to one of my .png's for an icon, and my own palette page. Compile. Install.

Used the icon for the component, that previously showed up right - the icon is correct, but the component not installed.
And this gives the same result. Correct icon, and component not installed. And so the whole package is not installed, as there is only one component or unit in it.

As a final resort, also removed the ikon.
Now I get the default icon - surprise, something is doing as expected - the package, unit and/or component is still not installed.

Finally tried creating a package, with one component (from TPanel), with nothing but default, except on LazControls Palette.
No luck. Lazarus can not install components/Units/packages that it creates all on its own.

No errors, no messages, no explanation.


How does one make this thing function to anything but wasting time?


Handoko:
Hello Birger52.
I'm sorry if you feel being ignored.

I read your first post yesterday. I really wanted to inspect your issue but you didn't provide the compilable source code. To do it:

Create a new folder and copy all the necessaries files into it expect: *.bak, the binary and lib folder. Compress the folder and send the zip file to the forum.

Birger52:
Thx for taking the time.

Soner:
You forgot T in labellistcontainer.lrs for TLabelListContainer name.
Open labellistcontainer.lrs in any texteditor and change 'LabelListContainer' to 'TLabelListContainer'.
and recompile your project and lazarus.
And put the register procudures and images in an extra unit like
minekomp_reg.pas, because when you put images in original units then they are included later in application. And the images are not needed in Application only in lazarus.

--- 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";}};} ---unit minekomp_reg;interface uses  Classes, LResources,  LabelList, LabelListContainer;  procedure Register; implementation procedure Register;begin  RegisterComponents('Mine',[TLabelList]);  RegisterComponents('Mine',[TLabelListContainer]);end; initialization  {$I labellist.lrs}  {$I labellistcontainer.lrs}end.   

Navigation

[0] Message Index

[#] Next page

Go to full version