Hi,
In a window with some controls (without any control gets the focus), I would like to detect when the user presses keys (A. .. Z and 0 ... 9), to detect those keys and then "show" a textbox control (previously hidden) and set the value property of the textbox with the contents of the user keys pressed.
I hope I've explained well.
Please any advice for this implementation.
Best Regards
Javier
Detecting pressed keys
Moderator: Rathinagiri
Re: Detecting pressed keys
Helo Javier!
You can find fine example about iplementation of this idea in Calculator (placed some days ago by Vanguarda and changed by me).
Best regards, Marek
You can find fine example about iplementation of this idea in Calculator (placed some days ago by Vanguarda and changed by me).
Best regards, Marek
Re: Detecting pressed keys
Hi Marek,
Please let me take a look.
Thanks.
Best Regards
Javier
Please let me take a look.
Thanks.
Best Regards
Javier
Re: Detecting pressed keys
Please, download:
download/file.php?id=820
and analyze it.
You will find lines:
download/file.php?id=820
and analyze it.
You will find lines:
Code: Select all
@ 040,121 TEXTBOX ReadHide VALUE " " WIDTH 15 HEIGHT 25 NOTABSTOP ON CHANGE EvalKeys() ON ENTER Operator_Click("=") INVISIBLE
Calc.ReadHide.SetFocus()
*-------------------
Static Function EvalKeys()
Local c_Keys
if !Empty(Calc.ReadHide.Value)
c_Keys := Alltrim(Calc.ReadHide.Value)
do case
case c_Keys == "0" .or.;
c_Keys == "1" .or.;
c_Keys == "2" .or.;
c_Keys == "3" .or.;
c_Keys == "4" .or.;
c_Keys == "5" .or.;
c_Keys == "6" .or.;
c_Keys == "7" .or.;
c_Keys == "8" .or.;
c_Keys == "9"
Number_Click(Val(Alltrim(c_Keys)))
case c_Keys == "/"
Operator_Click("/")
case c_Keys == "*"
Operator_Click("X")
case c_Keys == "-"
Operator_Click("-")
case c_Keys == "+"
Operator_Click("+")
case c_Keys == "."
Decimal_Click()
case c_Keys == "C" .or. c_Keys == "c"
CancelEntry_Click()
case c_Keys == "R" .or. c_Keys == "r"
Cancel_Click()
case c_Keys == "W" .or. c_Keys == "w"
CancelMemo_Click()
case c_Keys == "S" .or. c_Keys == "s"
ReadMemo_Click()
case c_Keys == "M" .or. c_Keys == "m"
SMemo_Click()
case c_Keys == "A" .or. c_Keys == "a"
AddMemo_Click()
end case
Calc.ReadHide.Value := ""
endif
Return Nil
- srvet_claudio
- Posts: 2224
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: Detecting pressed keys
Hola Javier,
en:
viewtopic.php?f=15&t=1331&start=0&bookm ... 160c6be6ea
postee algunas funciones que leen la entrada del teclado, espero que te sean de alguna utilidad.
Un saludo cordial,
Claudio Soto.
en:
viewtopic.php?f=15&t=1331&start=0&bookm ... 160c6be6ea
postee algunas funciones que leen la entrada del teclado, espero que te sean de alguna utilidad.
Un saludo cordial,
Claudio Soto.