1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Never defocus the form in Delphi 7

  1. Sep 20, 2003 #1

    ddr

    User Avatar

    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.
     
  2. jcsd
  3. Sep 25, 2003 #2

    ddr

    User Avatar

    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:?
     
  4. Sep 25, 2003 #3

    dduardo

    User Avatar
    Staff Emeritus

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Never defocus the form in Delphi 7
  1. Borland Delphi? (Replies: 3)

  2. Uploading by Delphi (Replies: 2)

  3. Windows 7 (Replies: 15)

Loading...