Never defocus the form in Delphi 7

  • Thread starter ddr
  • Start date
  • #1
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
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,901
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.
 

Suggested for: Never defocus the form in Delphi 7

Replies
15
Views
856
Replies
7
Views
607
Replies
3
Views
1K
Replies
37
Views
4K
Replies
8
Views
445
  • Last Post
Replies
6
Views
1K
Replies
1
Views
412
Replies
20
Views
547
Top