Solved

Component development in general

Posted on 2004-10-06
8
363 Views
Last Modified: 2013-11-23
This question is not about how to implement a TComponent descendant. I want to know more about the, err... philosophie of component development. The PME stuff (properties, methods, events), decoupling and so on. Any help or links apprechiated.
0
Comment
Question by:__alex
8 Comments
 
LVL 17

Assisted Solution

by:geobul
geobul earned 50 total points
ID: 12235479
Hi,

There is a help book in my D5 installation named 'Creating Custom Components'. Open it from Programs-Delphi-Help-'Creating Custom Components'.

Regards, Geo
0
 
LVL 6

Assisted Solution

by:pritaeas
pritaeas earned 50 total points
ID: 12235655
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12236531
from Delphi:
Component / New Component
1) Ancestor type   : TComponent
2) Class Name : TMyNewComponent
the rest stays default. If you want, you can put your Pallete Page something like your name.
Press OK after that.

Delphi generate some code for your. I will put some basic properties and paste the example... In published section are the properties, you seen in object inspector

unit MyNewComponent;

interface

uses
  SysUtils, Classes, Controls, Messages;

type
  TMyNewComponent = class(TComponent)
  private
    // variable for event
    OnLButton   : TMouseEvent;
    // set procedure
    procedure SetLButton (const Value : TMouseEvent);
  protected
    procedure OnLeftButton (var Msg : TMessage); message WM_LBUTTONDOWN;
  public

  published
    // this property is already know, no need to declare
    property Name;
    // declare new event
    property OnLeftMouseButton : TMouseEvent read OnLButton write SetLButton;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TMyNewComponent]);
end;

{ TMyNewComponent }

procedure TMyNewComponent.OnLeftButton(var Msg: TMessage);
begin
  // left mouse button is clicked
  if Assigned(OnLButton) then
    OnLButton(Self, mbLeft, [], 0, 0);
end;

procedure TMyNewComponent.SetLButton(const Value: TMouseEvent);
begin
  OnLButton := Value;
end;

end.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 12237575
The book that come with Delphi CD is a good start to understand the vcl development.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 11

Assisted Solution

by:robert_marquardt
robert_marquardt earned 50 total points
ID: 12237737
Have a look at the TLabel implementation. It is a good example on decoupling.
0
 
LVL 8

Accepted Solution

by:
BdLm earned 50 total points
ID: 12237956
components are an excellent way to reduce "double" coding, they help to keep the volume of your code small.
Its a very good way to ensure software quality.
before you write a program, think about the best way to define a object model for your data- and group
their functions and algorithms with components.
such programs will be easy to maintain and have the best options to enhance instead of re-writing from the scratch.
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12244144
components are very tied with OOP programming, here's all the concepts, etc of OOP

- Classes
- Design Patterns
- Owner and Parent
- Delphi OOP for beginners
- Run-Time Type Information (RTTI) In Delphi

among other things that you will find browsing through those links

http://delphi.about.com/od/oopindelphi/

and creating Delphi Components full tutorial:
http://delphi.about.com/library/bluc/text/uc061102a.htm
0
 
LVL 2

Author Comment

by:__alex
ID: 12246155
Thanks for the input!
0

Featured Post

Highfive Gives IT Their Time Back

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

21 Experts available now in Live!

Get 1:1 Help Now