How can I change the text of a TextBox with the space bar? (VFP)

0

I have a question that I hope you can help me with.

I'm doing a basic program with VFP 9.0 and I want to change the text of a TextBox with the spacebar , I mean:

In a job I had we used a system that by pressing the space bar in a field, changed from DOLLARS to PESOS (attached images):

Field "PESOS"

Field "DOLLARS"

Specifying more details, I must clarify that in this field you can not use any other key , that is, only respond with the space bar.

    
asked by DevNX 04.09.2018 в 21:57
source

1 answer

2

try this (Event: KeyPress from the textbox):

Local lc_LaTecla, lc_Divisa
lc_Divisa = alltrim(this.value)
lc_LaTecla = chr(nKeyCode)  
if inlist(LASTKEY(), 7)
do case
    case lc_Divisa = "PESOS"
    this.value = "DOLARES"
    case lc_Divisa = "DOLARES"
    this.value = "PESOS"
    endcase
return
endif

if !lc_LaTecla $ "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ abcdefghijklmnñopqrstuvwxyz " 
nodefault
endif

return

See you later, I hope it's functional!

    
answered by 04.09.2018 / 22:27
source