How to activate the Windows Virtual Keyboard from eXpress

This forum is for eXpress++ general support.
Message
Author
User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#41 Post 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.
Nolberto Paulino
Regards

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#42 Post by digitsoft »

I already understood how he did the trick as you did, thank you
Nolberto Paulino
Regards

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#43 Post 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
Nolberto Paulino
Regards

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#44 Post 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]) <<<<<<<<<<
The eXpress train is coming - and it has more cars.

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#45 Post 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]) <<<<<<<<<<
Attachments
Captura.JPG
Captura.JPG (81.34 KiB) Viewed 8756 times
Nolberto Paulino
Regards

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How to activate the Windows Virtual Keyboard from eXpres

#46 Post 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
The eXpress train is coming - and it has more cars.

Post Reply