Board index » delphi » Help - Can't compile this component in D5 Std

Help - Can't compile this component in D5 Std

Ok Folks,

     I need your help in getting this freeware "3dlabel" component to
compile in Delphi 5.0 Standard. It _works_fine_ for D3 Std,
however, "dsgnintf" unit is *not* supported in D5, so I don't get
a "TPropertyEditor" type... and it won't compile.

     Anyone got any ideas. Please note that although "dsgnintf.pas"
*is* supplied on D5 Pro CD-ROM, I *don't* have it because I only have
D5 Std (and it doesn't come with D5 Std). Apparently Inprise are
phasing out this unit, but I've no idea what is supposed to replace it.
E.g. I don't know what to use instead of TPropertyEditor.

     I regret to say that I've gone back to using D3 Std until I can
get this problem resolved.

     Any help appreciated.

Regards,
       Peter Williams  :))))

{-----------------------------------------------------------------------
*  TLabel3D v1.0                                                       *
*                                                                      *
*    Copyright ? 1996 InforTech, Inc.  All Rights Reserved.            *
*    By: Steven Costa Martins                                          *
*    E-MAIL: ste...@mail.telepac.pt                                    *
*    Home Page:                                                        *
*    http://www.geocities.com/SiliconValley/Park/7619/                 *
*                                                                      *
*    Last Modification: 18 Set 1996, 17:41 PM                          *
------------------------------------------------------------------------
*  You are not allowed to redistribute this                            *
*  code or any part of it                                              *
------------------------------------------------------------------------

Quote
}

unit Label3D;

interface

{$A+} { Word align data }
{$B-} { Complete Boolean Evaluation Directive }
{$D-} { Debug Information Directive }
{$L-} { Local Symbol Information Directive }
{$R-} { Range checking off }
{$S-} { Stack checking off }
{$T-} { We don't need (nor want) this type checking! }

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, DsgnIntf;

type
  TAboutLabel3DProperty = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
  end;
{-----------------------------------------------------------------------
-}
  TCaptionStyle = (csNone, csRaised, csHeavyRaised, csRecessed,
csHeavyRecessed);
  TLabel3D = class(TLabel)
  private
    FAbout: TAboutLabel3DProperty;
    FCaptionStyle: TCaptionStyle;
    procedure DoDrawText(var Rect: TRect; Flags: Word);
  protected
    procedure Paint; override;
    procedure SetCaptionStyle(Value: TCaptionStyle);
  public
    constructor Create(AOwner: TComponent); override;
  published
    property About: TAboutLabel3DProperty read FAbout write FAbout;
    property CaptionStyle: TCaptionStyle read FCaptionStyle write
SetCaptionStyle default csRecessed;
  end;
{-----------------------------------------------------------------------
-}

procedure Register;

implementation

constructor TLabel3D.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FCaptionStyle := csRecessed;
  Height := 16;
  Width := 62;
end;

procedure TLabel3D.SetCaptionStyle(Value: TCaptionStyle);
begin
  if Value <> FCaptionStyle then
  begin
    FCaptionStyle := Value;
    Invalidate;
  end;
end; { TLabel3D.SetCaptionStyle }

procedure TLabel3D.DoDrawText(var Rect: TRect; Flags: Word);
var
  Text       : array[ 0..255 ] of Char;
  TmpRect    : TRect;
  UpperColor : TColor;
  LowerColor : TColor;
begin
  GetTextBuf(Text, SizeOf(Text));
  if (Flags and DT_CALCRECT <> 0) and ((Text[0] = #0) or ShowAccelChar
      and (Text[0] = '&') and (Text[1] = #0)) then
    StrCopy(Text, ' ');

  if not ShowAccelChar then
    Flags := Flags or DT_NOPREFIX;

  Canvas.Font := Font;

  UpperColor := clBtnHighlight;
  LowerColor := clBtnShadow;

  if (FCaptionStyle = csRecessed) or (FCaptionStyle = csHeavyRecessed)
then
  begin
    UpperColor := clBtnShadow;
    LowerColor := clBtnHighlight;
  end;

  if FCaptionStyle in [csRaised, csHeavyRaised, csRecessed,
csHeavyRecessed] then
  begin
    If FCaptionStyle in [csRecessed, csHeavyRecessed, csHeavyRaised]
then Begin
      TmpRect := Rect;
      OffsetRect( TmpRect, 1, 1 );
      Canvas.Font.Color := LowerColor;
      DrawText(Canvas.Handle, Text, StrLen(Text), TmpRect, Flags);
    End;
    If FCaptionStyle in [csRaised, csHeavyRecessed, csHeavyRaised] then
Begin
      TmpRect := Rect;
      OffsetRect( TmpRect, -1, -1 );
      Canvas.Font.Color := UpperColor;
      DrawText(Canvas.Handle, Text, StrLen(Text), TmpRect, Flags);
    End;
  end;

  Canvas.Font.Color := Font.Color;
  if not Enabled then
    Canvas.Font.Color := clGrayText;
  DrawText(Canvas.Handle, Text, StrLen(Text), Rect, Flags);
end; { TLabel3D.DoDrawText }

procedure TLabel3D.Paint;
const
  Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT,
DT_CENTER);
var
  Rect: TRect;
begin
  with Canvas do
  begin
    if not Transparent then
    begin
      Brush.Color := Self.Color;
      Brush.Style := bsSolid;
      FillRect(ClientRect);
    end;
    Brush.Style := bsClear;
    Rect := ClientRect;
    DoDrawText( Rect, ( DT_EXPANDTABS or DT_WORDBREAK ) or
                Alignments[ Alignment ] );
  end;
end; { TLabel3D.Paint }

{-----------------------------------------------------------------------
-}

(*
 * About property
 *)

procedure TAboutLabel3DProperty.Edit;
var
  msg: string;
const
  carriage_return = chr(13);
begin
  msg := 'Label3D Component v1.0';
  AppendStr(msg, carriage_return);
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'Copyright ? 1996 InforTech, Inc.  All Rights
Reserved.');
  AppendStr(msg, carriage_return);
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'Developed by:');
  AppendStr(msg, carriage_return);
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'Steven Costa Martins');
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'E-Mail: ste...@mail.telepac.pt');
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'Home Page:');
  AppendStr(msg, carriage_return);
  AppendStr(msg, 'http://www.geocities.com/SiliconValley/Park/7619/');
  AppendStr(msg, carriage_return);
  ShowMessage(msg);
end;

function TAboutLabel3DProperty.GetAttributes: TPropertyAttributes;
begin
        Result := [paMultiSelect, paDialog, paReadOnly];
end;

function TAboutLabel3DProperty.GetValue: string;
begin
        Result := 'Click on...for About box';
end;

{-----------------------------------------------------------------------
-}
procedure Register;
begin
  RegisterComponents( 'InforTech', [TLabel3D] );
  {Register the about box property editor}
  RegisterPropertyEditor(TypeInfo(TAboutLabel3DProperty),
      TLabel3D, 'ABOUT', TAboutLabel3DProperty);
end;
{-----------------------------------------------------------------------
-}

end.

Sent via Deja.com http://www.deja.com/
Before you buy.

 

Re:Help - Can't compile this component in D5 Std


On Wed, 22 Mar 2000 08:34:33 GMT, Peter Williams

Quote
<Peter_willi...@nmr.defence.gov.au> wrote:
>Ok Folks,

>     I need your help in getting this freeware "3dlabel" component to
>compile in Delphi 5.0 Standard. It _works_fine_ for D3 Std,
>however, "dsgnintf" unit is *not* supported in D5, so I don't get
>a "TPropertyEditor" type... and it won't compile.

G'day Peter, point your library path to the "C:\Program
Files\Borland\Delphi5\Source\Toolsapi"  or add it in the environment
options and all should be well.
The Dsgnintf.pas file resides in there and your component just needs
to know the path to it.
cheers

Re:Help - Can't compile this component in D5 Std


Hi,

   I seem to not be explaining the problem well enough. Inprise have
ceased shipping the Dsgnintf unit with D5 Std. It comes as a .pas file
in the D5 Pro (and Enterprise) versions only - not in the Std version.
It is *not* supplied anywhere on the D5 Std cd-rom. (although you will
find a "dsgnintf.int" file).

   Please read the following "README.TXT" file from Inprise (which a
friend emailed me). The readme file clearly indicates that Inprise
don't want users using the dsgnintf unit anymore. So my question is
simply: What replaces it????

Regards,
       Peter Williams   :)))

Quote
> ===== README.TXT
> DSGNINTF and deployment
> -----------------------------------------------

> DSGNINTF.DCU is no longer shipped with Delphi.
> Thus, component developers should consider
> segregating design-time code into separate units
> from runtime code. Runtime code should not refer
> to those units.

> If this approach is not feasible, you do have the
> option of compiling DSGNINTF.PAS (located in
> your \source\toolsapi\ directory). This should be
> considered a stopgap measure, however, and may
> not be available as an option in future releases.

> You are also reminded that under the terms of
> your license agreement, you are not permitted to
> distribute DCUs based on source code owned by
> Inprise Corporation, no matter how that code
> might be made available to you. For complete
> details on licensing restrictions, see the
> LICENSE.TXT and DEPLOY.TXT files that accompany
> this release.
> =====

In article <38d9a9bc.17010...@news.southwest.com.au>,

- Show quoted text -

Quote
awh...@southwest.com.au (Al) wrote:
> On Wed, 22 Mar 2000 08:34:33 GMT, Peter Williams
> <Peter_willi...@nmr.defence.gov.au> wrote:

> >Ok Folks,

> > I need your help in getting this freeware "3dlabel" component to
> >compile in Delphi 5.0 Standard. It _works_fine_ for D3 Std,
> >however, "dsgnintf" unit is *not* supported in D5, so I don't get
> >a "TPropertyEditor" type... and it won't compile.

> G'day Peter, point your library path to the "C:\Program
> Files\Borland\Delphi5\Source\Toolsapi" or add it in the environment
> options and all should be well.
> The Dsgnintf.pas file resides in there and your component just needs
> to know the path to it.
> cheers

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:Help - Can't compile this component in D5 Std


On Wed, 22 Mar 2000 17:57:03 GMT, Peter Williams

Quote
<Peter_willi...@nmr.defence.gov.au> wrote:
>Hi,

>   I seem to not be explaining the problem well enough. Inprise have
>ceased shipping the Dsgnintf unit with D5 Std. It comes as a .pas file
>in the D5 Pro (and Enterprise) versions only - not in the Std version.

My humble apologies.
 :\

Re:Help - Can't compile this component in D5 Std


Quote
"Peter Williams" <Peter_willi...@nmr.defence.gov.au> wrote in message

news:8bb1h6$bvm$1@nnrp1.deja.com...

Quote
>    I seem to not be explaining the problem well enough. Inprise have
> ceased shipping the Dsgnintf unit with D5 Std. It comes as a .pas file
> in the D5 Pro (and Enterprise) versions only - not in the Std version.
> It is *not* supplied anywhere on the D5 Std cd-rom. (although you will
> find a "dsgnintf.int" file).

DsgnIntf is only relevant to the Delphi IDE at design-time, when it is
available in all editions of D5, including Std. In theory, it shouldn't ever
be compiled into an executable. This is entirely logical - property editors
are design-time only features, so compiling in DsgnIntf simply results in
dead code.

In D5 Std, you *can't* compile it in because DsgnIntf.pas is not provided.
In a properly written component, code should be segregated into design-time
and run-time packages. The design-time package incorporates the Register
procedure and property editors, and 'uses' the run-time package. It is the
design-time package that is installed into the component pallette, while the
run-time is compiled into the application.

Borland has continued to include DsgnIntf.pas in the Pro and Ent editions so
as not to break existing, improperly segregated, code; but it's said that
the unit will not be provided in any versions from D6 on.

I think your first step should be to find out whether there is a more recent
version of the component that has been re-written to separate out the
design-time and run-time packages. If you have no joy there, it would not be
too difficult to do it yourself.

--
Stephen Brown

Other Threads