Page 5 of 5

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Tue Nov 27, 2018 11:24 am
by digitsoft
rdonnay wrote:Here is how I solved the problem with showing the cursor in BLUE.

First, I create a DCSAY object in the target screen:

Code: Select all

@ 1,0 DCSAY '|' SAYSIZE 0 OBJECT ::getCursor ;
   FONT '14.Lucida Console Bold' COLOR BD_BLUE, BD_BLUE
hello Roger
I do not place these methods :: getCursor, :: TouchHandler


Then I make the OSK:getCursor point to the target screen ::getCursor:

Code: Select all

DCREAD GUI FIT TITLE 'New Driver Application' ;
   MODAL TO lStatus OPTIONS GetOptions SETAPPWINDOW ;
   HANDLER ::TouchHandler REFERENCE oOsk ;
   EVAL {|o|DC_CenterObject(o,AppDeskTop()),;
            o:setPos({o:currentPos()[1],o:currentPos()[2]-30}), ;
            o:show(), ;
            oOsk:targetXbp := oGet1, ;
            oOsk:getCursor := ::getCursor, ;  <<<<<<<<<<<<<<
            SetAppFocus(oGet1)}
Then I added 3 lines of code to the Accum method of TouchKeyboard:

Code: Select all

 METHOD TouchKeyboard:Accum( cKey, cCapsKey )

LOCAL cBuffer, i, nPos

IF ::isCapsLock .AND. !Empty(cCapsKey)
  cKey := cCapsKey
ENDIF

::targetXbp:updated := .T.
FOR i := 1 TO Len(cKey)
  ::targetXbp:keyboard(Asc(cKey[i]))
NEXT

IF ::targetXbp:isDerivedFrom('DC_XbpGet')
   cBuffer := Transform ( ::targetXbp:Get:Buffer, IIf(::targetXbp:Picture==NIL, "", ::targetXbp:picture) )
   ::targetXbp:Get:_assign( )
   ::targetXbp:SetEditBuffer( cBuffer )
ENDIF

<<<<<<<<<<<<<
::getCursor:show()
::getCursor:setParent(::targetXbp)
::getCursor:setPos({((::targetXbp:get:pos-1)*16)+2,0})
>>>>>>>>>>>>>

IF Asc(cKey) == xbeK_ENTER
  SetAppFocus(::targetXbp)
  PostAppEvent(xbeP_Keyboard,xbeK_ENTER,,::targetXbp)
ENDIF

Sleep(1)

RETURN nil
You will need to calculate the positioning of ::getCursor in your DCGET object based on the font used for your gets.

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Tue Nov 27, 2018 11:33 am
by digitsoft
I already understood how he did the trick as you did, thank you

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Wed Nov 28, 2018 12:18 pm
by digitsoft
hello Roger
Add this to your code to solve a problem with the numeric fields.


if cKey == xbeK_ENTER &&&.OR. cKey == xbeK_DOWN
if ::isNunber()
PostAppEvent(xbeP_Keyboard, ASC("."),,::oGet)
END if

SetAppFocus(::oGet)
PostAppEvent(xbeP_Keyboard, xbeK_ENTER,,::oGet)
sleep(0.1)
END if

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Wed Nov 28, 2018 2:32 pm
by rdonnay
Thanks for the numeric fix.

Here is some additional code to make the blue cursor show the character under the cursor:

Part of target screen code:

Code: Select all

@ 1,0 DCSAY ' ' SAYSIZE 0 OBJECT ::getCursor ;
   FONT '20.Lucida Console' COLOR BD_WHITE, BD_BLUE
Part of TouchKeyboard:accum() code:

Code: Select all

::getCursor:show()
::getCursor:setParent(::targetXbp)
::getCursor:setPos({((::targetXbp:get:pos-1)*16)+2,0})
::getCursor:setCaption(::targetXbp:get:buffer[::targetXbp:get:pos]) <<<<<<<<<<

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Wed Nov 28, 2018 2:59 pm
by digitsoft
hello Roger
The position x, and do not match the character in the GET, attached send you an image


rdonnay wrote:Thanks for the numeric fix.

Here is some additional code to make the blue cursor show the character under the cursor:

Part of target screen code:

Code: Select all

@ 1,0 DCSAY ' ' SAYSIZE 0 OBJECT ::getCursor ;
   FONT '20.Lucida Console' COLOR BD_WHITE, BD_BLUE
Part of TouchKeyboard:accum() code:

Code: Select all

::getCursor:show()
::getCursor:setParent(::targetXbp)
::getCursor:setPos({((::targetXbp:get:pos-1)*16)+2,0})
::getCursor:setCaption(::targetXbp:get:buffer[::targetXbp:get:pos]) <<<<<<<<<<

Re: How to activate the Windows Virtual Keyboard from eXpres

Posted: Wed Nov 28, 2018 4:04 pm
by rdonnay
do not match the character in the GET
You need to make sure that the font of the DCSAY is exactly the same as the font of the DCGETs.

In your case, it is probably the following:
@ 1,0 DCSAY ' ' SAYSIZE 0 OBJECT ::getCursor ;
FONT '10.Courier New' COLOR BD_WHITE, BD_BLUE