Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 23rd, 2009, 09:03 AM
vanHauser vanHauser is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Posts: 1 vanHauser User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 37 m 23 sec
Reputation Power: 0
TFrame descendant strange behavior

I need to create a TFrame descendant frame class, that will be the base for some other frame descendants. I called this class TFrameGeneric:
Code:
unit UnitFrameGeneric;
interface
uses
  UnitObjects,
  Forms, ComCtrls;
type
  TFrameGeneric = class (TFrame)
  public
    OwnerTreeNode: TTreeNode;
    OwnerEntity: TEntity;
  end;
implementation
end.


One descendant of this generic class looks like this:
Code:
unit UnitFrameDevice;
interface
uses
  UnitFrameGeneric, UnitObjects,
  StdCtrls, ExtCtrls, ComCtrls, Classes, Controls;
type
  TFrameDevice = class(TFrameGeneric)
    GroupBoxDevice: TGroupBox;
    EditAddress: TLabeledEdit;
    UpDownAddress: TUpDown;
    EditDevName: TLabeledEdit;
    procedure EditAddressChange(Sender: TObject);
  private
  public
  end;
implementation
{$R *.dfm}

procedure TFrameDevice.EditAddressChange(Sender: TObject);
begin
  OwnerEntity.UpdateTitles;
end;

end.


The problem I encouuntered is that the design view for TFrameDevice does not look like a frame designer anymore, but like a form designer! Also, it inherits properties from TForm, like ClientWidth, ClientHeight, and others. The code compiles ok, but when the application dynamically creates a TFrameDevice, it pops up an exception saying that "Project XYZ has raised an exception class EReadError with message 'property ClientHeight does not exist'".

Why does TFrameDevice class have properties from TForm? How can I avoid this?

I am using CodeGear Delphi for Win32 2007 Professional with latest updates (I hope... I have December 2007 installed).

Reply With Quote
  #2  
Old March 5th, 2009, 12:19 AM
Javakka Javakka is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2009
Posts: 1 Javakka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 49 sec
Reputation Power: 0
Looks like you've hardcoded the TFrame subclass which is a bad way of subclassing frames in Delphi. You should have used the standard Delphi way of dealing with frames. Here's how I do this in Delphi 2006:

File -> New -> Other, then in the "Item Categories" box select Delphi Projects -> Delphi Files, and in the righthand box select Frame.

A new unit with a new TFrame subclass will be created, here you can rename it and add generic properties and procedures you need.

When you're finished, save the file and go to File -> New -> Other, and select the Delphi Projects -> Inheritable Items category. You should see your generic frame there. Double-click on it, and a new subclass of your generic frame will be created.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > TFrame descendant strange behavior


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap