Matthew Comb asked:
>I have about 800 applications which I have to set the main form to be
fsstayontop and >keypreview to true. Is therea way I can automate this?
This problem highlights why you should always use your own versions of
everything, rather than the default Borland classes.
If, rather than using TForm as your ancestor, you had used TNumberWorksForm
(where TNumberWorksForm = class(TForm) ) then you would just have to
override .Loaded and make whatever changes you need.
That said, here's a simple example to solve your problem:
1. Create a new project, with a blank form (called Form1).
2. Put a button on the form.
This application represents your 800 applications.
3. Create a new form (called Form2).
4. Add the following protected method:
procedure TForm2.Loaded;
begin
inherited;
Color := clBlue;
end;
This form represents your default form's behaviour.
5. Remove 'Application.CreateForm(TForm2, Form2);' from the .DPR
6. Add 'Unit2' to the interface's 'uses' clause of Unit1.
7. Change the 'TForm1 = class(TForm)' line in Unit1 to read
'TForm1 = class(TForm2)'
This changes the ancestry of your form.
8. Press F9, and you should end up with a blue form.
Now put components on Form2 (like maybe a TMainMenu, with a 'File|Exit'
TMenuItem), and rerun the application.
Ain't inheritance wonderful?
If you want to do it all visually, rather than setting values in the
'.Loaded' method, you could
1. Convert all your binary .DFMs to text.
2. Change the first line from 'object Form1: TForm1' to 'inherited Form1:
TForm1'
3. Convert all your text .DFMs back to binary (use 'convert.exe')
4. And then any properties you define in Form2 will appear on Form1 in the
IDE.
(personally, I prefer to set such things in code, so I can *see* them,
rather than hiding them in DFM files, but I acknowledge I'm in the minority)
Of course, you'll have to write something to parse and mangle your existing
800 forms, but that's your problem :-)
Removing the "background component reference" will require hacking the
textual .DFM too, and patient ignoring of warnings from Delphi when you
recompile.
Cheers,
Kerry "Glad to find an excuse to stop staring at hung CORBA servers" S
----- Original Message -----
From: Matthew Comb <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Monday, 21 June 1999 16:09
Subject: [DUG]: command line compiling / macros.
I have about 800 applications which I have to set the main form to be
fsstayontop and keypreview to true. Is therea way I can automate this? In
the past I have been able to rig batch files to compile the applications but
don't know how to alter these properties.
Currently I am having to alter the applications by hand. I also need to
remove a background component reference.
Any help would be appreciated.
Cheers,
Matt.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz