Solved

Installing Component

Posted on 2002-07-07
6
533 Views
Last Modified: 2008-02-01
I'm trying to make my first component. I grabbed a simple example to test. (as below).  

I don't understand how I make this an available component on the pallette.  The steps I tried were as follows:
1) Copied the two files into the lib directory
2) component => install component
3)select the .pas file in the unitname box.
4) click the compile button on the DCL50 dialog

Everything appears to work but the component isn't added or visible.  

I must be missing out something really simple.

Any help would be appreciated
Thanks

code is:
{
Copyright © 1999 by Delphi 5 Developer's Guide - Xavier Pacheco and Steve Teixeira
}

unit PwDlg;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons;

type

  TPasswordDlg = class(TForm)
    Label1: TLabel;
    Password: TEdit;
    OKBtn: TButton;
    CancelBtn: TButton;
  end;

  { Now declare the wrapper component. }
  TddgPasswordDialog = class(TComponent)
  private
    PassWordDlg: TPasswordDlg; // TPassWordDlg instance
    FPassWord: String;         // Place holder for the password
  public
    function Execute: Boolean; // Function to launch the dialog
  published
    property PassWord: String read FPassword write FPassword;
  end;

implementation
{$R *.DFM}

function TddgPasswordDialog.Execute: Boolean;
begin
  { Create a TPasswordDlg instance }
  PasswordDlg := TPasswordDlg.Create(Application);
  try
    Result := False;  // Initialize the result to false
    { Show the dialog and return true if the password
      is correct. }
    if PasswordDlg.ShowModal = mrOk then
      Result := PasswordDlg.Password.Text = FPassword;
  finally
    PasswordDlg.Free;  // Free instance of PasswordDlg
  end;
end;

end.
0
Comment
Question by:winsor_andrew
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
ginsonic earned 20 total points
ID: 7136807
You forgot to add Register procedure.


..............
procedure Register;

implementation
{$R *.DFM}
...............
procedure Register;
begin
  RegisterComponents('MyWork', [TddgPasswordDialog]);
end;

0
 

Author Comment

by:winsor_andrew
ID: 7136839
Thanks, thought it would be something simple.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7137489
Whay a C grade?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:ComTech
ID: 7137566
Hello winsor_andrew, you thought it would be someting simple. thoes are your words.  And since the Expert took the difficulty of time to produce these results, I do not understand a C grade.  An answer is an answer whether or not it turns out the way you might like.

Since I believe this to be the case, I will change the grade.  This will help you both, it doesn't cost you any more points and most top Experts will look at your grading record, as they work hard to help, and are non-paid volunteers.  That is part of what makes the site so unique.

Regards,
ComTech
CS Admin @ EE
0
 

Expert Comment

by:ComTech
ID: 7137570
If you feel I am in error, please contact Community Support regarding this matter.

CT
0
 

Author Comment

by:winsor_andrew
ID: 7139124
Sorry, first time I've posted a question and not quite sure about the grading part.  Understand a bit better now thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Process Javascript errors with Delphi TWebBrowser 1 211
Correct Component for Shopping Cart. 2 121
Delphi...Split view - idea? 1 117
DBGrid or StringGrid ? 6 121
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question