Question

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).

Was it helpful?

Solution

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.

OTHER TIPS

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.

As far as I know, you have to have both the form and the frame open in the editor when you edit the frame. Else there can be update problems. Although I haven't seen this one.

But I gave up on frames a long time ago because I did not find them very reliable.

Right now I only use them for prototyping, creating a custom component (derived of a panel with the apropriate controls on it).

You may have to register custom module to the IDE But your additional properties won't work well unless they are in ancestor class.

I have encounter a lot of problems with TFrame and finally came to such workaround that solves all my problems: I create and design frames visually, but use them only by hand-coding.

As a side effect my applications became smaller, because of less dfm-s.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top