Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Clicky!

KASKAS Member Posts: 21
How do you detect if the mouse is clicked out side the form? eg. the user click on the desktop or somewhere

Comments

  • Let_me_beLet_me_be Member Posts: 36
    Thats realy hard stuff.
    You have to hook into the windows message chain.
  • injektiloinjektilo Member Posts: 113
    [b][red]This message was edited by injektilo at 2002-10-5 13:17:45[/red][/b][hr]
    [code]Application.HookMainWindow(MyHook);

    function MyHook(var Msg: TMessage): Boolean;
    begin
    Result := False;
    case Msg.Msg of
    . //check your messages
    .
    .
    end;
    end;
    [/code]
  • kurvlakurvla Member Posts: 20
    : How do you detect if the mouse is clicked out side the form? eg. the user click on the desktop or somewhere
    :
    if your form was the last active then catch the WM_KILLFOCUS event. The message should have an flag set indicating the focus was removed because of a click, if it's so simply read the properties of the Mouse object to get the mouse coords.
    if your form wasn't the last active you could call SetCapture() (win32 api function) but I don't know if this helps, because you the capture will be automaticaly removed from your form (or ani other winControl's handle you specify) if a click occurs, but I hope there will be some notification about the remove. Try to search MSD or Win32 api help for "setcapture".

  • Shawn CarterShawn Carter Member Posts: 0

    ____ < http://forcoder.org /> free ebooks and video tutorials about || Visual Basic .NET C C# Assembly Perl C++ PHP Swift Go JavaScript Delphi R Java MATLAB Objective-C Ruby Visual Basic Python Scratch PL/SQL Bash Clojure Fortran Lua Scala Apex Prolog Rust Erlang SAS Transact-SQL Ada D Awk Crystal Logo Lisp Hack Julia ABAP FoxPro COBOL VBScript Alice Kotlin Dart Scheme F# LabVIEW ML || _____

Sign In or Register to comment.