Never defocus the form in Delphi 7

  • Thread starter Thread starter ddr
  • Start date Start date
  • Tags Tags
    Form
Click For Summary
SUMMARY

This discussion focuses on maintaining form focus in Delphi 7, specifically how to make a form behave like a MessageBox. The user implemented a solution using the TForm class, where the form flashes and beeps when it loses focus, retrieving it back if a certain condition is not met. Key methods discussed include OnDeactivate and Btn1Click, which manage the focus behavior based on the boolean variable OkLetGo.

PREREQUISITES
  • Understanding of Delphi 7 programming
  • Familiarity with TForm class and its methods
  • Basic knowledge of event handling in Delphi
  • Experience with boolean logic in programming
NEXT STEPS
  • Explore advanced event handling in Delphi 7
  • Learn about custom message handling in Delphi forms
  • Research Delphi 7 GUI design best practices
  • Investigate alternatives to Delphi for modern application development
USEFUL FOR

Delphi developers, particularly those working with Delphi 7, and programmers interested in GUI focus management techniques.

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.
 
Computer science news on Phys.org
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:?
 
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.
 

Similar threads

  • · Replies 37 ·
2
Replies
37
Views
7K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
8
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
Replies
25
Views
5K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 226 ·
8
Replies
226
Views
18K
Replies
3
Views
4K