Can't resolve error message "Instance Variable (File1) Inaccessable Here" in Delphi TFrame1 application?

Hi,

I'm creating a TFrame form using  Delphi 7, SP4.

For the Menu1 control, I am getting "Instance Variable (zzzzz) Inaccessable Here" for all top level menu items  For example, all the code in the Code Section below fails with the error message above.

What have I done wrong?

In the Code Section is the Project file and the top part of the unit file where TFrame1 is declared.

Thanks.
 

===============  Procedure to open top level Menu1 items.
procedure mnuOpen;
begin
  with TFrame1 do    
  begin
    File1.Visible    := true;
    Edit1.Visible    := true;
    Image1.Visible   := true;
    Colors1.Visible  := true;
    Rotate1.Visible  := true;
    Page1.Visible    := true;
    View1.Visible    := true;
    Zoom1.Visible    := true;
    Magnify1.Visible := true;
  end;
end;
======================  Project File (dpr)
program ImageDisplayFrame1;
uses
  Forms,
  uF1ImageDisplay in 'uF1ImageDisplay.pas' {Frame1: TFrame};

{$R *.res}

begin
  Application.Initialize;
  Application.Run;
end.
========================= Beginning of unit below.
unit uF1ImageDisplay;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzTabs, RzPanel, RzButton, ExtCtrls, StdCtrls, AxCtrls,
  OleCtrls, ImvbLib_TLB, DB, mySQLDbTables, mySQLDirectQuery, ImgList,
  RzBHints, Menus, Mask, RzEdit, RzStatus, Grids, DBGrids, RzDBGrid,
  RzLabel;

type
  TFrame1 = class(TFrame)

Open in new window

LVL 1
IT79637Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

systanCommented:
Review or Open your *.dfm then check the name that is inaccessible, remove it or change it to your new name(in ?unit?.pas)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyberkiwiCommented:
The procedure should be

procedure TFrame1.mnuOpen;

to make it a member of TFrame1 and so that it can access the fields in TFrame1

Then anywhere inside that procedure, press Ctrl-Shift-C to have Delphi IDE add it into the TFrame1 class for you.
Or you can just put this manually in the private or protected section of TFrame1

TFrame1 = class(TFrame)
   Edit1: TEdit;
protected
   procedure mnuOpen;
0
Emmanuel PASQUIERFreelance Project ManagerCommented:
in your mnuOpen procedure , you can't do : With TFrame1 <== The CLASS
The correct use is : With aFrame1 <== an INSTANCE

Where is declared this procedure ??? By what is it called ???
As cyberwiki said, it's rightful place is within TFrame1 (where I suppose all your menus objects are defined). But to decide if it has to be protected or public, we have to know by what is it used.
Is it not just an event of something in your frame ?
procedure TFrame1.mnuOpen;
begin
  File1.Visible    := true;
  Edit1.Visible    := true;
  Image1.Visible   := true;
  Colors1.Visible  := true;
  Rotate1.Visible  := true;
  Page1.Visible    := true;
  View1.Visible    := true;
  Zoom1.Visible    := true;
  Magnify1.Visible := true;
end;

Open in new window

0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Geert GOracle dbaCommented:
create your frame
save it
in the designer, right click and add to palette

then in your form designer you can add the newly created frame descendant
by click in the frame icon on the palette and then in your form

runtime creation of your frame inside a form:

procedure TForm1.ButtonAddFrame(Sender: TObject);
var aFrame: TFrame;
begin
  aFrame := TFrame.Create(Self);
  aFrame.Parent := Self;
end;
0
TheRealLokiSenior DeveloperCommented:
> in your mnuOpen procedure , you can't do : With TFrame1 <== The CLASS> The  correct use is : With aFrame1 <== an INSTANCE

epasquier is spot on, this is the main problem imho. (don't accept my answer for any points btw)
0
Emmanuel PASQUIERFreelance Project ManagerCommented:
Excellent closing. We can only assume at least one of us solves your issue.
0
TheRealLokiSenior DeveloperCommented:
lol, crazy. 100 points for saying "don't accept my answer"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.