Never defocus the form in Delphi 7

  • Thread starter ddr
  • Start date
  • #1
ddr
I wonder how can can I lock the focus on a certain form in delphi 7. this should enable the form to behave as a MessageBox. When clicked outside the form it should flash, beep and retrive its focus. I'm only a beginner with delphi, so thanks.
 

Answers and Replies

  • #2
ddr
I somehow found a way to do it.here is how it looks:

type
object = TForm1(TForm)
...
private
...
public
OkLetGo:boolean;
end;

var
Form1:TForm1;

implementation

method Tform1.Btn1Click(Sender:TObject);
begin
if Condition1 then
OkLetGo:=true
else
OkLetGo:=false;
end;

procedure TForm1.OnDeactivate(Sender : TObject);
begin
if not OkLetGo then begin
Beep;
SetFocus;
end;
end;

Right:wink:?
 
  • #3
dduardo
Staff Emeritus
1,890
3
Dephi? Who uses Dephi?

Sorry to troll, but time to ugrade to Ada.

Ok, in all seriousness i don't think anyone else really uses dephi on this board. Try the delphi newsgroup or something. A physics forum is not the place to get an answer to an obscure language.
 

Related Threads on Never defocus the form in Delphi 7

  • Last Post
Replies
1
Views
4K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
2
Views
2K
Replies
5
Views
4K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
13
Views
2K
Replies
3
Views
760
  • Last Post
2
Replies
35
Views
6K
  • Last Post
Replies
6
Views
6K
  • Last Post
Replies
9
Views
4K
Top