Never defocus the form in Delphi 7

  • Thread starter Thread starter ddr
  • Start date Start date
  • Tags Tags
    Form
AI Thread Summary
To lock focus on a form in Delphi 7, enabling it to behave like a MessageBox, the implementation involves creating a boolean variable to manage focus retention. The example code defines a form with a method that sets the boolean based on a condition when a button is clicked. Additionally, an OnDeactivate event handler checks the boolean; if the condition to release focus is not met, it beeps and retrieves focus back to the form. Discussions also highlight a perceived decline in Delphi's popularity, suggesting users seek help in more specialized forums rather than general ones.
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.
 
I came across a video regarding the use of AI/ML to work through complex datasets to determine complicated protein structures. It is a promising and beneficial use of AI/ML. AlphaFold - The Most Useful Thing AI Has Ever Done https://www.ebi.ac.uk/training/online/courses/alphafold/an-introductory-guide-to-its-strengths-and-limitations/what-is-alphafold/ https://en.wikipedia.org/wiki/AlphaFold https://deepmind.google/about/ Edit/update: The AlphaFold article in Nature John Jumper...
Thread 'Urgent: Physically repair - or bypass - power button on Asus laptop'
Asus Vivobook S14 flip. The power button is wrecked. Unable to turn it on AT ALL. We can get into how and why it got wrecked later, but suffice to say a kitchen knife was involved: These buttons do want to NOT come off, not like other lappies, where they can snap in and out. And they sure don't go back on. So, in the absence of a longer-term solution that might involve a replacement, is there any way I can activate the power button, like with a paperclip or wire or something? It looks...

Similar threads

Replies
37
Views
6K
Replies
10
Views
3K
Replies
1
Views
149
Replies
14
Views
3K
Replies
13
Views
4K
Replies
226
Views
15K
Replies
3
Views
658
Back
Top