[fpc-pascal] how to make a type private to the unit but not defining it in the implementation section?

Darius Blaszyk dhkblaszyk at gmail.com
Thu Mar 7 09:53:27 CET 2019


Make stringgrid1 a pointer and put TMyStringGrid in the implementation
section?

Op do 7 mrt. 2019 om 09:11 schreef Dennis <dec12 at avidsoft.com.hk>

> unit frproxyserver;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
>    Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, Grids,
>    frBase;
>
> type
>
>    TMyStringGrid=class(TStringGrid) //how to I make this class visible
> only to this unit?
>    public
>    end;
>
>    { TProxyServerFrame }
>
>    TProxyServerFrame = class(TBaseFrame)
>      Panel_Top: TPanel;
>      StringGrid1: TMyStringGrid;
>    private
>
>    public
>
>    end;
>
> implementation
>
> {$R *.lfm}
>
> end.
>
> =============
> My reason is I don't want to pollute the name space but if I put the
> declaration of TMyStringGrid in the implementation section, it cannot be
> used by the field in the class declaration of TProxyServerFrame.
>
> if there a compiler directive that I can put around
> TMyStringGrid to make it only visible to the unit frproxyserver?
>
> Dennis
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190307/d67d403e/attachment.html>


More information about the fpc-pascal mailing list