Results 1 to 2 of 2

Thread: Custom Component definitie

  1. #1

    Lightbulb Custom Component definitie

    Wat mij is opgevallen bij de components van Embarcadero/Codegear/Borland zelf en ook bij veel 3rd party components dat ze voor een nieuwe component een Customcomponent maken en daarna deze definieren als het component.

    Voorbeeld:
    Delphi Code:
    1. type
    2.   TCustomEdit = class(TWinControl)
    3.   private
    4.     ...
    5.   public
    6.     ...
    7.   published
    8.     ...
    9.   end;
    10.  
    11.   TEdit = class(TCustomEdit)
    12.   published
    13.     ...
    14.   end:

    Is dit om het makkelijker te maken om een afgeleide te maken van bijvoorbeeld een TEdit? Of zit daar meer achter? Ik vraag dit vooral omdat ik zelf ook eigen components maak, maar meestal gewoon de eerste definitie (TCustomEdit) registreer (wel genoemd als TEdit ipv TCustomEdit).
    Ik ben namelijk bezig om een aantal components wat op te schonen en deze te bundelen (nu staan veel component register functies in de component unit zelf), en denk dat dit ook het goede moment is om dit toe te passen als dit een "goede gewoonte" is.

  2. #2
    Uit het handboek "Delphi Developer's Guide" hoofdstuk "Writing Delphi Custom Components":

    TCustomClassName - The VCL contains several classes that do not publish all their properties; they leave it up to descendant classes to do. This allows component developers to create “custom” components from the same base class and to publish only the predefined properties required for each customized class

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •