Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Box not working

Status
Not open for further replies.

troyu

Programmer
Nov 21, 2000
185
CA
I have a form named AboutBox.
I have another form (my main form) named Form_Main.

I would like to use the ShowModal function to open my aboutbox when they click on the drop down menu.

This is the code I was using:
procedure TForm_Main.MenuItem_AboutClick(Sender: TObject);
begin
AboutBox.ShowModal;
end;

I get the error message: "Error 3-Invalid Identifier"
WHY???
 
Did you write the code your self or did you used the designer?

If you have a main menu, and click on the item, and write AboutBox.ShowModal; is the way it works.

the procedure should be TForm_Main.AboutClick(Sender: TObject);


this
procedure TForm_Main.MenuItem_AboutClick(Sender: TObject);
looks a little strange to me S. van Els
SAvanEls@cq-link.sr
 
Is your aboutbox Form in your 'Uses' list, normaly if have added the form with the project manager, and you write code that refernces that form, you will get a dialog asking if you want to add it to your uses list.
but not always.

e.g 'Aboutbox is not in your uses list do you want to add it', and Delphi will add it automaticly if you click 'Yes'

This is exactly the error you will get if it is not in your 'Uses' list.

If you wnt to avoid some of the mucking about with identifier scope that can happen.
make your own uses declaration in the implemenation section
and stick your own (non system) modules in here ,

But don't move things from the main uses clause.

e.g.

implementation

uses readme, Unit2, ProjectInfo, stringutils;

Hope this helps
Steve
 
I think you have forgotten to add AboutBox in your uses clause.

1. Add Aboutbox in your uses clause
2. Use the following "Aboutbox activator"
with TAboutBox.Create(self) do
try
ShowModal;
finally
Free;
end;


3. Remove Application.CreateForm(TAboutBox, AboutBox); from the .dpr file

If you do that with "all" of your forms, the application will be started faster, especially if you have database-queries, because the query will be run only when you create the form.

It don't have to be queries to slow the application down at the starting moment, it can be other thing such as filereading, socket connections and so on...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top