Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi IDE treating TFrame as if it were a Form

Every once in a while when I am tweaking my TFrame classes (adding properties, methods, etc), the IDE gets confused and acts as if it thinks the frame is a form, complete with header/caption, borders, etc. Yet, clearly the class is declared as a TFrame descendent. Any ideas as to what causes this, how to prevent, and how to fix?

I'm using Delphi 2007 Pro. Also note (if it matters), the TFrame descendents are typically registered with the IDE (i.e. on the palette) via a design-time package.


Later: Additional "specifics": The frame that I'm having this problem with at the moment is, visually, a VERY basic TFrame (only change from brand new TFrame is size, and background color).

Here's its class declaration:

TBasePanel = class(TFrame)
  private
    FPanelManager: TPanelManager;
    procedure SetPanelManager(const Value: TPanelManager);
  protected
    procedure Connect; virtual; abstract;
    procedure Disconnect; virtual; abstract;
    procedure Refresh; virtual;
    procedure Requery; virtual; abstract;
  published
    property PanelManager: TPanelManager read FPanelManager write
        SetPanelManager;

This frame is used as a base class for a number of others. I am usually editing it directly from the BPL project it belongs to (because all of these frames install to the palette), rather than as part of an EXE project, with related Forms open etc.

Also, "Embedded designer" is checked in Tools -> Options.

I am saving all DFM files as text rather than binary as well (if that matters at all).

like image 299
Jamo Avatar asked Feb 26 '09 07:02

Jamo


2 Answers

I have encountered the same problem. The following steps solved the problem for us, it might also work for you:

  1. in the IDE: close all forms that use the frame
  2. open the frame, view as text (*.dfm)
  3. the dfm probably begins with object MyFrame: TMyFrameClass
  4. change this to inherited MyFrame: TMyFrameClass

I don't know what caused the problem.

like image 145
Birger Avatar answered Oct 01 '22 11:10

Birger


Perhaps you had unchecked the 'Embedded designer' check box? (Tools | Options | Environment Options | VCL Designer). Then, indeed, your frame is shown at design time as a form (with caption, border etc.). Also a concrete code of your problematic TFrame descendant or more details about your case would help.

like image 43
John Thomas Avatar answered Oct 01 '22 12:10

John Thomas