Solved

Installing Component

Posted on 2002-07-07
6
529 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now