 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
John Guest
|
Posted: Sun Jul 27, 2003 4:49 pm Post subject: Stay on top forms problem |
|
|
My app periodically needs to show a pop-up form, which needs to stay on top when the app is in the foreground. So the pop-up form has fsStayOnTop set and when my app wants to display the form it just Shows it. This works fine with my app in the foreground.
If my app is minimised, then the pop up pops up over the top of whatever app is in the foreground. This is definitely not what's wanted!
Any ideas how to stop the pop-up form from popping up on top of other apps?
Thanks, John.
|
|
| Back to top |
|
 |
Jari Kettunen Guest
|
Posted: Sun Jul 27, 2003 5:30 pm Post subject: Re: Stay on top forms problem |
|
|
How about this catch the min/max-event and set state-variable and look it
state before showing form.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure MinimizeApp(Sender: TObject);
procedure RestoreApp(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
AppState:TWindowState;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.MinimizeApp(Sender: TObject);
begin
AppState:=wsMinimized;
end;
procedure TForm1.RestoreApp(Sender: TObject);
begin
AppState:=wsNormal;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if AppState<>wsMinimized then ShowMessage('ok');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMinimize := MinimizeApp;
Application.OnRestore := RestoreApp;
end;
end.
"John" <john (AT) g3wgv (DOT) com> kirjoitti viestissä
news:3f240286$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
My app periodically needs to show a pop-up form, which needs to stay on
top when the app is in the foreground. So the pop-up form has fsStayOnTop |
set and when my app wants to display the form it just Shows it. This works
fine with my app in the foreground.
| Quote: |
If my app is minimised, then the pop up pops up over the top of whatever
app is in the foreground. This is definitely not what's wanted!
Any ideas how to stop the pop-up form from popping up on top of other
apps?
Thanks, John.
|
|
|
| Back to top |
|
 |
Achim Berg Guest
|
Posted: Sun Jul 27, 2003 9:59 pm Post subject: Re: Stay on top forms problem |
|
|
Wrong parent, I assume.
This works for me with Delphi 7:
create a new application (Form1)
add a Form (Form2), use unit2 in unit 1.
place a button on form1, which sets form2.style to fsStayOnTop and
Form2.visible:= True
Achim
John wrote:
| Quote: | My app periodically needs to show a pop-up form, which needs to stay
on top when the app is in the foreground. So the pop-up form has
fsStayOnTop set and when my app wants to display the form it just
Shows it. This works fine with my app in the foreground.
If my app is minimised, then the pop up pops up over the top of
whatever app is in the foreground. This is definitely not what's
wanted!
Any ideas how to stop the pop-up form from popping up on top of other
apps?
Thanks, John.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|