Never defocus the form in Delphi 7

  • Thread starter ddr
  • Start date

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.
 

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:?
 

dduardo

Staff Emeritus
1,894
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 for: Never defocus the form in Delphi 7

  • Posted
Replies
1
Views
4K
  • Posted
Replies
3
Views
2K
  • Posted
Replies
2
Views
2K
Replies
5
Views
4K
  • Posted
Replies
4
Views
2K
  • Posted
Replies
13
Views
2K
Replies
3
Views
636
  • Posted
2
Replies
35
Views
6K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top