Virtual Keyboard
Virtual Keyboard
Hi to all.
I am implementing a Virtual Keyboard in a routine using:
oGet:SetFocus(), oGet:KeyChar(nKey)
Character fields works well, even together with the regular keyboard.
With numeric field with a PICTURE, it only keeps the last number entered.
TIA for any sugestions.
Regards, Euclides
I am implementing a Virtual Keyboard in a routine using:
oGet:SetFocus(), oGet:KeyChar(nKey)
Character fields works well, even together with the regular keyboard.
With numeric field with a PICTURE, it only keeps the last number entered.
TIA for any sugestions.
Regards, Euclides
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Hi James,
Mainly i am doing the following:
cNr=space(10); nNr=0
REDEFINE GET oGet[1] VAR cNr ID 102 OF oDlg1
oGet[1]:bGotFocus:={|| nX:=1 }
REDEFINE GET oGet[2] VAR nNr ID 101 OF oDlg1 PICTURE "@E 999.99"
oGet[2]:bGotFocus:={|| nX:=2 }
REDEFINE BUTTON ID 10 OF oDlg1 ACTION ( oGet[nX]:SetFocus(), oGet[nX]:KeyChar(asc("0")))
REDEFINE BUTTON ID 11 OF oDlg1 ACTION ( oGet[nX]:SetFocus(), oGet[nX]:KeyChar(asc("1")))
The character field fills OK but the numeric field overwrites the whole field with the number typed
I planned to use the TGET class methods to build the numbers.
Thanks for jumping in, regards.
Euclides
Mainly i am doing the following:
cNr=space(10); nNr=0
REDEFINE GET oGet[1] VAR cNr ID 102 OF oDlg1
oGet[1]:bGotFocus:={|| nX:=1 }
REDEFINE GET oGet[2] VAR nNr ID 101 OF oDlg1 PICTURE "@E 999.99"
oGet[2]:bGotFocus:={|| nX:=2 }
REDEFINE BUTTON ID 10 OF oDlg1 ACTION ( oGet[nX]:SetFocus(), oGet[nX]:KeyChar(asc("0")))
REDEFINE BUTTON ID 11 OF oDlg1 ACTION ( oGet[nX]:SetFocus(), oGet[nX]:KeyChar(asc("1")))
The character field fills OK but the numeric field overwrites the whole field with the number typed
I planned to use the TGET class methods to build the numbers.
Thanks for jumping in, regards.
Euclides
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Euclides,
I'm not sure what you did. You only needed to change the intitialization of the numeric vars to character from 0, then convert them to numeric when you save the data. You only need one extra line of code for each numeric var, e.g.
nAmount := val( cAmount )
It is a little extra code, but you don't need a routine for each var.
Regards,
James
I'm not sure what you did. You only needed to change the intitialization of the numeric vars to character from 0, then convert them to numeric when you save the data. You only need one extra line of code for each numeric var, e.g.
nAmount := val( cAmount )
It is a little extra code, but you don't need a routine for each var.
Regards,
James
Euclides,
I found this sample in SAMPLES:
http://www.5volution.com/downloads/keybsim2.zip
I found this sample in SAMPLES:
Code: Select all
// A 'virtual' Keyboard sample
#include "Fivewin.ch"
static oWnd
Function Main()
local hDLL := LoadLibrary( "bwcc32.dll" ) // NUEVO!
SET RESOURCES TO "KBSIM_32.DLL"
BWCCRegister( GetResources() )
DEFINE WINDOW oWnd TITLE "Prueba de Gets"
ACTIVATE WINDOW oWnd MAXIMIZED ON INIT Dialogo1()
SET RESOURCES TO
#ifndef __CLIPPER__
FreeLibrary( hDLL )
#endif
return NIL
Function Dialogo1()
Local oBtn1, oBtn2, oGet1, cVar, oDlg
cVar := " - - "
DEFINE DIALOG oDlg NAME "KEYB"
REDEFINE GET oGet1 VAR cVar ID 143 OF oDlg PICTURE "AX-9999-AA"
REDEFINE BUTTON oBtn1 ID 101 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("1")))
REDEFINE BUTTON oBtn1 ID 102 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("2")))
REDEFINE BUTTON oBtn1 ID 103 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("3")))
REDEFINE BUTTON oBtn1 ID 104 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("4")))
REDEFINE BUTTON oBtn1 ID 105 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("5")))
REDEFINE BUTTON oBtn1 ID 106 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("6")))
REDEFINE BUTTON oBtn1 ID 107 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("7")))
REDEFINE BUTTON oBtn1 ID 108 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("8")))
REDEFINE BUTTON oBtn1 ID 109 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("9")))
REDEFINE BUTTON oBtn1 ID 110 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("0")))
REDEFINE BUTTON oBtn1 ID 111 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("Q")))
REDEFINE BUTTON oBtn1 ID 112 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("W")))
REDEFINE BUTTON oBtn1 ID 113 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("E")))
REDEFINE BUTTON oBtn1 ID 114 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("R")))
REDEFINE BUTTON oBtn1 ID 115 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("T")))
REDEFINE BUTTON oBtn1 ID 116 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("Y")))
REDEFINE BUTTON oBtn1 ID 117 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("U")))
REDEFINE BUTTON oBtn1 ID 118 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("I")))
REDEFINE BUTTON oBtn1 ID 119 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("O")))
REDEFINE BUTTON oBtn1 ID 120 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("P")))
REDEFINE BUTTON oBtn1 ID 121 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("A")))
REDEFINE BUTTON oBtn1 ID 122 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("S")))
REDEFINE BUTTON oBtn1 ID 123 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("D")))
REDEFINE BUTTON oBtn1 ID 124 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("F")))
REDEFINE BUTTON oBtn1 ID 125 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("G")))
REDEFINE BUTTON oBtn1 ID 126 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("H")))
REDEFINE BUTTON oBtn1 ID 127 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("J")))
REDEFINE BUTTON oBtn1 ID 128 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("K")))
REDEFINE BUTTON oBtn1 ID 129 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("L")))
REDEFINE BUTTON oBtn1 ID 130 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("Z")))
REDEFINE BUTTON oBtn1 ID 131 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("X")))
REDEFINE BUTTON oBtn1 ID 132 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("C")))
REDEFINE BUTTON oBtn1 ID 133 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("V")))
REDEFINE BUTTON oBtn1 ID 134 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("B")))
REDEFINE BUTTON oBtn1 ID 135 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("N")))
REDEFINE BUTTON oBtn1 ID 136 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC("M")))
REDEFINE BUTTON oBtn1 ID 137 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyDown(VK_UP))
REDEFINE BUTTON oBtn1 ID 138 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyDown(VK_DOWN))
REDEFINE BUTTON oBtn1 ID 139 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyDown(VK_LEFT))
REDEFINE BUTTON oBtn1 ID 140 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyDown(VK_RIGHT))
REDEFINE BUTTON oBtn1 ID 141 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(ASC(" ")))
REDEFINE BUTTON oBtn1 ID 142 OF oDlg ACTION (MsgBeep(),;
oGet1:SetFocus(.t.),;
oGet1:KeyChar(VK_BACK))
ACTIVATE DIALOG oDlg CENTERED
return NIL
#ifdef __XPP__
* 32 bits Alaska XPP source code here...
procedure AppSys
return
#else
* 16 bits Clipper source code here...
#endif
#ifndef __CLIPPER__
** 32 bits Alaska XPP source code here...
DLL32 FUNCTION BWCCRegister( hInst AS LONG ) AS LONG PASCAL LIB "BWCC32.DLL"
#else
** 16 bits Clipper source code here...
#endif
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Euclides,
>My problem was with numeric fields with decimal places so i built specific routines to treat character by character and some checkings. (do not let the user type twice a decimal point, etc)
You don't need all that if you simply use a numeric picture clause and define the default variable as character.
cVar := "000.00"
REDEFINE GET...PICTURE "E 999.99"
This will prevent two decimals, characters, etc.
Regards,
James
>My problem was with numeric fields with decimal places so i built specific routines to treat character by character and some checkings. (do not let the user type twice a decimal point, etc)
You don't need all that if you simply use a numeric picture clause and define the default variable as character.
cVar := "000.00"
REDEFINE GET...PICTURE "E 999.99"
This will prevent two decimals, characters, etc.
Regards,
James
Re: Virtual Keyboard
Euclides,
Can you share with us your experience and how you resolved the Virtual Keyboard NUMERIC problem?
Regards,
George
Can you share with us your experience and how you resolved the Virtual Keyboard NUMERIC problem?
Regards,
George
Re: Virtual Keyboard
I have the same problem.
Does anyone have a solution?
Thank you Mannfrerd
Does anyone have a solution?
Thank you Mannfrerd
Manfred Groß
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Virtual Keyboard
Manfred,
Could you please provide a small self contained example ? thanks
Could you please provide a small self contained example ? thanks
Re: Virtual Keyboard
Hi Antonio,
please test
Manfred
please test
Code: Select all
#INCLUDE "fivewin.CH"
#INCLUDE "HbClass.CH"
// ---------------------------------------------------------------------------------------------
function Main()
// ---------------------------------------------------------------------------------------------
LOCAL cNr := space(10)
LOCAL nNr := 0
LOCAL oDlg, nx
LOCAL oGet := {NIL,NIL}
SET EXACT OFF
SET DELETE ON
SET DATE GERMAN
SET CONFIRM OFF // ON
SET TYPEAHEAD TO 100
SET EXCLUSIV OFF
SET DECIMALS TO 2
SET EPOCH TO year( date() ) - 80
SET CENTURY ON
DEFINE DIALOG oDlg TITLE "Test Num Get" SIZE 300, 300 PIXEL TRUEPIXEL
@ 30, 8 SAY "Get 1" PIXEL OF oDlg
@ 30, 160 GET oGet[1] VAR cNr PIXEL OF oDlg SIZE 100, 25
oGet[1]:bGotFocus:={|| nX:=1 }
@ 60, 8 SAY "Get 2" PIXEL OF oDlg
@ 60, 160 GET oGet[2] VAR nNr PIXEL OF oDlg SIZE 100, 25 PICTURE "@E 999.99"
oGet[2]:bGotFocus:={|| nX:=2 }
@ 100, 50 BUTTON "Get 1" OF oDlg size 50,30 PIXEL ;
ACTION ( SetFocus(oGet[nX]:hWnd), oGet[nX]:KeyChar(asc("0")))
@ 100, 120 BUTTON "Get 2" OF oDlg size 50,30 PIXEL ;
ACTION ( SetFocus(oGet[nX]:hWnd), oGet[nX]:KeyChar(asc("1")))
ACTIVATE DIALOG oDlg CENTER
return NIL
Manfred Groß