Re: Why use custom component for class?

From: Raptor (bogus_at_none.com)
Date: 02/14/05


Date: Mon, 14 Feb 2005 12:54:53 -0800


Bruce Roberts <ber@bounceitattcanada.xnet> wrote in message
news:uE4Qd.1870$dZ.133592@news20.bellglobal.com...
>
> "Raptor" <bogus@none.com> wrote in message
> news:cujm1f1oo4@news2.newsguy.com...
>
> > I didn't want to go to the trouble of making a full-blown visual
component
> > (which I gather would be done by deriving from TRichEdit), not did I
want
> to
> > have to create a TRichEdit dynamically and place it via code and set all
> the
> > stuff in code. I was looking for a middle ground, where I could place a
> > TRichEdit on a form but modify its behavior.
>
> In the IDE, Component | New Component.
>
> Ancestor Type : tRichEdit (or tCustomRichEdit)
> Class Name : tScriptEdit
> Palette Page : { your choice, just type to create new }
> Unit File name : { your choice }
> Search Path : { your choice }
>
> Once you've saved the new unit, Component | Install Component. I'd suggest
> that you use the New Package tab and create a package for your own
controls.
> Once you've added the control to the new package, build the package and
> install it. Its that simple to create a new visual component that you can
> drop onto a form at design time.

Sorry I wasn't clear--that process I understand well enough. Going through
it has regularly been a pain in the ass for me, though, because Delphi
thinks often the thing I'm making-and-modifying already exists but won't
let me remove it because it doesn't exist).

> IIRC the help has a chapter the works through an example of modifying an
> existing visual component. Check Creating Custom Components in the table
of
> contents.

Yes, that's probably the strongest and best-written part of the
documentation. In actual practice it has proved messy and erratic for me,
however, and thus the appeal of using a component as-is, but nevertheless
getting it to do other things.

> > Didn't know how, though. A couple of simple downloads from Torry's had
the
> > general form I was looking for: use a RichEdit as a property of the
class.
> > Cool.
>
> There are times when this approach makes sense but its actually more
> difficult to manage at design time than descending directly from the edit.

Someday when I have more time I'll try the regular component-creation (as
descendant) thing yet again and yelp for group help when Delphi does its
frustrating weirdness. I've done it, but modification-uninstall-reinstall
has been troublesome.

In the meantime this worked OK. I was was just wondering why the TCustomXXX
form would be used, other than property exposure, of which I was aware.

Raptor



Relevant Pages

  • Re: Delphi 2007 and InfoPower 3000
    ... Open it in Delphi 2007 and let it create a bdsproj file, or whatever it's using now, and henceforth open that new file, not the original dpk file. ... It you don't have a project file provided, then create a new package project and add all the source and form files to it. ... You're likely supposed to have two packages, one for run time and one for design time. ...
    (comp.lang.pascal.delphi.misc)
  • Re: Borland kills another developer tool
    ... and that is that Borland have stopped innovating. ... the Delphi team are buulding great new things all the time but I can't ... If the public interface of a package ...
    (borland.public.delphi.non-technical)
  • Sigh...Delphi is good enough to write crap
    ... how my own apps scored. ... Maybe it is my familiarity with the Delphi language that makes me want ... All of my apps depend on a package which is in itself a package loader ...
    (borland.public.delphi.non-technical)
  • Making RTPkgs trivial plug-ins in delphi.
    ... Package system is in Delphi. ... receiverHandle: THandle; ...
    (borland.public.delphi.non-technical)
  • Re: Using the delphi command line compiler and its options...
    ... I have finally figured out how to tell delphi where the other packages are. ... CodeGear Delphi for Win32 compiler version 18.5 ... Fatal: E2202 Required package ... It's also really annoying I can't open the batch file with textpad editor... ...
    (alt.comp.lang.borland-delphi)