Howdy, Stranger!

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

Categories

Keypress event without using a control

smtaglsmtagl Member Posts: 1
Hello,
Please let me know that is it possible to trap a key without using any control's keypress event.
I mean, let the focus be on to any control but for a particular key there must be a single code to execute.

smtagl

Comments

  • BarkeeperBarkeeper Member Posts: 335
    : Hello,
    : Please let me know that is it possible to trap a key without using any control's keypress event.
    : I mean, let the focus be on to any control but for a particular key there must be a single code to execute.
    :
    : smtagl
    :

    wohooooo. If you're not an expierenced programmer, then it could be difficult for you. The goal is to subclass your form.
    The KeyPress-Event is nothing else than a wrapped code around the WM_KEYDOWN, WM_KEYUP-Messages, so you have to write your own Window-Procedure, trap the messages, and give back control to windows.
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : : Hello,
    : : Please let me know that is it possible to trap a key without using any control's keypress event.
    : : I mean, let the focus be on to any control but for a particular key there must be a single code to execute.
    : :
    : : smtagl
    : :
    :
    : wohooooo. If you're not an expierenced programmer, then it could be difficult for you. The goal is to subclass your form.
    : The KeyPress-Event is nothing else than a wrapped code around the WM_KEYDOWN, WM_KEYUP-Messages, so you have to write your own Window-Procedure, trap the messages, and give back control to windows.
    : ------------------------------------------
    : Only stupidity of mankind and the universe
    : are infinite, but i'm not sure concerning
    : the universe. A. Einstein
    :
    :

    Nah, set the form's KeyPreview property to True and then use the form's KeyPress event.
  • BarkeeperBarkeeper Member Posts: 335
    *snipp*
    : Nah, set the form's KeyPreview property to True and then use the form's KeyPress event.
    :

    Baaahh, i didn't wanted to provide a solution easy like that. People, who are too lazy or dumb to check out the properties of their objects have to be shocked in a way.
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • Shawn CarterShawn Carter Member Posts: 0

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

Sign In or Register to comment.