Javier,
I created a keyboard using the following approach.
There is a custom form action named KeyPress.
In the form action is this code.
SET VAR vlast TEXT
SET VAR vnext TEXT = .%1
SWITCH (.vnext)
CASE 'Enter'
SET VAR vlast = 'enter'
BREAK
CASE 'space'
SET VAR vlast = 'space'
BREAK
CASE 'bksp'
IF (SLEN(.vAddResult)) > 0 THEN
SET VAR vAddResult = (SGET(.vAddResult,((SLEN(.vAddResult)) - 1),1))
ENDIF
SET VAR vlast = 'bksp'
BREAK
DEFAULT
IF vlast = 'space' THEN
SET VAR vAddResult = (CTXT(.vAddResult)&CTXT(.vnext))
ELSE
SET VAR vAddResult = (CTXT(.vAddResult)+CTXT(.vnext))
ENDIF
SET VAR vlast = ' '
BREAK
ENDSW
RECALC VARIABLES
RETURN
Show each keypress calls the form action.
An 'E' has the OnClick EEP
PROPERTY RBASE_FORM_ACTION KeyPress 'Using E'
RETURN
and so on.
This snippet of code was borrowed from Emmitt awhile back.
I only used Upper case and my keyboard does not have a DELETE.
Jan
-----Original Message-----
From: "Javier Valencia" <[email protected]>
To: [email protected] (RBASE-L Mailing List)
Date: Fri, 2 Mar 2012 15:18:20 -0600
Subject: [RBASE-L] - On screen keyboard
Hello List,
I have an application where the user can access the screen only via the
mouse (no keyboard, no touchscreen).
I can use the Windows on screen keyboard (osc.exe) and works correctly;
however, I want to restrict the keys the user can use to alpha-numeric,
shift, space, backspace and delete.
I have created a form with a nice looking keyboard using bit buttons and I
have most of the features working. I simply initialize the variable and
anytime a "key" is pressed (mouse click on bit button) the corresponding
character is added to the string. When the backspace key is pressed the last
character is deleted from the variable. Fairly straight forward
I have two questions that I need to resolve.
How do I add a blank character at the end of the variable? I have tried
different characters with no luck; it seems that the variable is not able to
store a "blank" character as the last character. I have two workaround but I
am not crazy about either.
The first involves adding CHAR(255) and using the Terminal Font. The space
is displayed correctly with that font (and the R:BASE OEM r> prompt font)
but with other fonts I displays " ΓΏ" instead of spaces. I do a string
replace to change the CHAR(255) back to blank.
The second involves counting the blank spaces pressed and when the next
non-blank character is pressed on the screen keyboard, the blank spaces are
inserted before the last non-blank character and the count reset to 0.
Both solutions work, but I feel like there should be a more elegant/straight
forward solution.
The second question is how do I duplicate the "Delete" key on the keyboard
with a bit button? Using the mouse I can select a portion of the text and I
would like to delete it by clicking on a button on the screen keyboard. Any
Ideas?
Next on the list is determine relative cursor position in the screen to
allow inserting and deleting characters at positions other than the end. I
don't have clue on how to do that but this feature is not critical at this
time
I can do all these thing with the Windows On Screen Keyboard; I just prefer
the look and the flexibility of an all R:Base solution.
Javier,
Javier Valencia, PE
O: 913-829-0888
H: 913-397-9605
C: 913-915-3137