Main form is always shown behind other forms
An application from Delphi 1 (16 bit) has been transferd into Delphi 2007. The main form is always shown behind all other forms, whatever I do.
How can I get the normal action from the form, so it is shown on top when it is active.
Thanks in advance
Related Article: How to change the main form
is a Pascal and Delphi discussion thread by Fireprufe15 that has 5 replies and was last updated 1 year ago.
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
there have been a huge number of changes.. since then.. when you say it shows behind the other forms, is it forms within the app, or forms within your desktop?
While it would be a hack you could tell it to bringtofront, but, Im thinking theres some form props or something that has changed its not picking up correctly.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0
there have been a huge number of changes.. since then.. when you say it shows behind the other forms, is it forms within the app, or forms within your desktop?
While it would be a hack you could tell it to bringtofront, but, Im thinking theres some form props or something that has changed its not picking up correctly.
It will show on top of forms, belonging to other applications, but behind all forms belonging to its own application.
"Bring to front" is not available for a form at design time at least. Can it be done in runtime?
I have compared all properties to other forms in this application without finding any differences.
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Even if I set FormStyle to fsStayOnTop my main form will stay behind all the rest forms in this application, but on top of other applications.
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Well question:
How are you opening the other forms?
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0
I open the other forms like:
FrmNotes.show;
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
if it only then applies to the mainform, check the dpr file on how its created
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0
I tried to set an other form to be my main form, but then that other form got the same property.
My dpr file looks like:
program NotEdit;
uses
Forms,
NOTEDI1 in 'NOTEDI1.PAS' {Form1},
BLOCK in 'BLOCK.PAS' {FrmBlock},
Convert in 'Convert.pas' {FrmConvert};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TFrmConvert, FrmConvert);
Application.Run;
end.
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Does it happen if you make a new form and have that as your main form (and no you didnt set the new thing as your main form you just made it visible at startup)
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0
Then my new main form will inherit the strange behaviour and my old main form will act normally!
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
That doesnt sound normal.
I would expect if you made a new form with a button saying "click me" and it opened the original main form that the issue would be gone.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0
I think the problem was solved. There was a line:
Application.MainFormOnTaskbar := True;
in the .DPR file. I have no idea about how it got there. Don't know what it is supposed to do but when I removed it the form is fine.
Thanks for taking your time.
AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 4 Years Ago by
LizR Thats required usually in D2007 otherwise you end up with ghosted forms and lack of form on the task bar
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Skill Endorsements: 0