?
Solved

Installing Component

Posted on 2002-07-07
6
Medium Priority
?
541 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
ginsonic earned 80 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 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