visual-foxprofoxpro

Increasing ACCEPT command entry font size


Visual FoxPro barcode scanner application uses accept command for barcode collection via RDP:

_screen.FontSize=20
_screen.FontName='Arial'
DO WHILE .T.
accept 'Barcode' to cBarCode
if empty(cBarCode)
  exit
  endif
insert into barcodes value (cBarCode)
ENDDO

Scanned barcode font size is too small:

enter image description here

How to increase displayed scanned barcode 123456 font size?

Only ACCEPT prompt font size can changed. Re-writing application using @ GET commands or Forms is huge work. Answer in https://social.msdn.microsoft.com/Forums/en-US/c3f9e89a-8917-4236-bc2c-474592f1af4c/increase-font-size-on-accept-input-and-wait?forum=visualfoxprogeneral

recommends to use INPUTBOX() but this hides whole mobile screen.

Maybe there is FoxPro code for command line data entry which uses INKEY() or something other to mimics this command? Or can some Windows api function or external dll called for this?


Solution

  • You may replace the accept command by the following code

        LOCAL M.Lastkey
        M.Lastkey = 0
        cBarCode = ""
        ? 'Barcode'
        DO WHILE .T.
            M.Lastkey = INKEY(0)
            ?? CHR(M.Lastkey)
            IF M.Lastkey != 13
                cBarCode = cBarCode + CHR(M.Lastkey)
            ELSE
                EXIT
            ENDIF
        ENDDO
    

    So the complete code will look link:

        _screen.FontSize=20
        _screen.FontName='Arial'
        DO WHILE .T.
            LOCAL M.Lastkey
            M.Lastkey = 0
            cBarCode = ""
            ? 'Barcode'
            DO WHILE .T.
                M.Lastkey = INKEY(0)
                ?? CHR(M.Lastkey)
                IF M.Lastkey != 13
                    cBarCode = cBarCode + CHR(M.Lastkey)
                ELSE
                    EXIT
                ENDIF
            ENDDO
            if empty(cBarCode)
              exit
              endif
            insert into barcodes value (cBarCode)
        ENDDO