Loren
- Code: Select all Expand view RUN
FUNCTION KeyBoardVirtual( cStringTexto )
LOCAL oDlgVirtual, oFontDlg, oFontGet, oGetTexto, cTexto, aBtnsKeys, lSalida
aBtnsKeys:= ARRAY(49)
lSalida := FALSE
cTexto := Space(78)
IF cStringTexto != NIL
cTexto:= PADR( ALLTRIM( cStringTexto ), 78 )
ENDIF
DEFINE FONT oFontDlg NAME "Arial" SIZE 0, -13 BOLD
DEFINE FONT oFontGet NAME "Arial" SIZE 0, -16 BOLD
DEFINE DIALOG oDlgVirtual RESOURCE "DLG_TECLADO";
TITLE "Teclado Virtual de Oregano Gourmet..."
REDEFINE GROUP ID 300 COLOR GetSysColor( COLOR_ACTIVECAPTION ) TRANSPARENT OF oDlgVirtual
REDEFINE GROUP ID 350 COLOR GetSysColor( COLOR_ACTIVECAPTION ) TRANSPARENT OF oDlgVirtual
REDEFINE GET oGetTexto VAR cTexto ID 550 FONT oFontGet OF oDlgVirtual
REDEFINE BUTTON aBtnsKeys[ 1] ID 500 OF oDlgVirtual PROMPT "Q" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("Q")) )
REDEFINE BUTTON aBtnsKeys[ 2] ID 501 OF oDlgVirtual PROMPT "W" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("W")) )
REDEFINE BUTTON aBtnsKeys[ 3] ID 502 OF oDlgVirtual PROMPT "E" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("E")) )
REDEFINE BUTTON aBtnsKeys[ 4] ID 503 OF oDlgVirtual PROMPT "R" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("R")) )
REDEFINE BUTTON aBtnsKeys[ 5] ID 504 OF oDlgVirtual PROMPT "T" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("T")) )
REDEFINE BUTTON aBtnsKeys[ 6] ID 505 OF oDlgVirtual PROMPT "Y" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("Y")) )
REDEFINE BUTTON aBtnsKeys[ 7] ID 506 OF oDlgVirtual PROMPT "U" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("U")) )
REDEFINE BUTTON aBtnsKeys[ 8] ID 507 OF oDlgVirtual PROMPT "I" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("I")) )
REDEFINE BUTTON aBtnsKeys[ 9] ID 508 OF oDlgVirtual PROMPT "O" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("O")) )
REDEFINE BUTTON aBtnsKeys[10] ID 509 OF oDlgVirtual PROMPT "P" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("P")) )
REDEFINE BUTTON aBtnsKeys[11] ID 510 OF oDlgVirtual PROMPT "A" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("A")) )
REDEFINE BUTTON aBtnsKeys[12] ID 511 OF oDlgVirtual PROMPT "S" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("S")) )
REDEFINE BUTTON aBtnsKeys[13] ID 512 OF oDlgVirtual PROMPT "D" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("D")) )
REDEFINE BUTTON aBtnsKeys[14] ID 513 OF oDlgVirtual PROMPT "F" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("F")) )
REDEFINE BUTTON aBtnsKeys[15] ID 514 OF oDlgVirtual PROMPT "G" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("G")) )
REDEFINE BUTTON aBtnsKeys[16] ID 515 OF oDlgVirtual PROMPT "H" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("H")) )
REDEFINE BUTTON aBtnsKeys[17] ID 516 OF oDlgVirtual PROMPT "J" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("J")) )
REDEFINE BUTTON aBtnsKeys[18] ID 517 OF oDlgVirtual PROMPT "K" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("K")) )
REDEFINE BUTTON aBtnsKeys[19] ID 518 OF oDlgVirtual PROMPT "L" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("L")) )
REDEFINE BUTTON aBtnsKeys[20] ID 519 OF oDlgVirtual PROMPT "Ñ" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("Ñ")) )
REDEFINE BUTTON aBtnsKeys[21] ID 520 OF oDlgVirtual PROMPT "Z" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("Z")) )
REDEFINE BUTTON aBtnsKeys[22] ID 521 OF oDlgVirtual PROMPT "X" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("X")) )
REDEFINE BUTTON aBtnsKeys[23] ID 522 OF oDlgVirtual PROMPT "C" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("C")) )
REDEFINE BUTTON aBtnsKeys[24] ID 523 OF oDlgVirtual PROMPT "V" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("V")) )
REDEFINE BUTTON aBtnsKeys[25] ID 524 OF oDlgVirtual PROMPT "B" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("B")) )
REDEFINE BUTTON aBtnsKeys[26] ID 525 OF oDlgVirtual PROMPT "N" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("N")) )
REDEFINE BUTTON aBtnsKeys[27] ID 526 OF oDlgVirtual PROMPT "M" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("M")) )
REDEFINE BUTTON aBtnsKeys[28] ID 527 OF oDlgVirtual PROMPT "(,)" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC(",")) )
REDEFINE BUTTON aBtnsKeys[29] ID 528 OF oDlgVirtual PROMPT "(.)" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC(".")) )
REDEFINE BUTTON aBtnsKeys[30] ID 529 OF oDlgVirtual PROMPT "(-)" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("-")) )
REDEFINE BUTTON aBtnsKeys[31] ID 551 OF oDlgVirtual PROMPT "7" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("7")) )
REDEFINE BUTTON aBtnsKeys[32] ID 552 OF oDlgVirtual PROMPT "8" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("8")) )
REDEFINE BUTTON aBtnsKeys[33] ID 553 OF oDlgVirtual PROMPT "9" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("9")) )
REDEFINE BUTTON aBtnsKeys[34] ID 554 OF oDlgVirtual PROMPT "4" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("4")) )
REDEFINE BUTTON aBtnsKeys[35] ID 555 OF oDlgVirtual PROMPT "5" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("5")) )
REDEFINE BUTTON aBtnsKeys[36] ID 556 OF oDlgVirtual PROMPT "6" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("6")) )
REDEFINE BUTTON aBtnsKeys[37] ID 557 OF oDlgVirtual PROMPT "1" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("1")) )
REDEFINE BUTTON aBtnsKeys[38] ID 558 OF oDlgVirtual PROMPT "2" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("2")) )
REDEFINE BUTTON aBtnsKeys[39] ID 559 OF oDlgVirtual PROMPT "3" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("3")) )
REDEFINE BUTTON aBtnsKeys[40] ID 560 OF oDlgVirtual PROMPT "0" ;
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("0")) )
REDEFINE BUTTON aBtnsKeys[41] ID 561 OF oDlgVirtual PROMPT "Supr";
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyDown(VK_DELETE) )
REDEFINE BUTTON aBtnsKeys[42] ID 531 OF oDlgVirtual PROMPT "Barra espaciadora";
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC(" ")) )
REDEFINE BUTTON aBtnsKeys[43] ID 530 OF oDlgVirtual PROMPT "(";
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC("(")) )
REDEFINE BUTTON aBtnsKeys[44] ID 532 OF oDlgVirtual PROMPT ")";
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyChar(ASC(")")) )
REDEFINE BUTTON aBtnsKeys[45] ID 563 OF oDlgVirtual PROMPT "<- Retroceso";
ACTION ( oGetTexto:SetFocus(), oGetTexto:KeyDown(VK_BACK) )
REDEFINE BUTTON aBtnsKeys[46] ID 533 OF oDlgVirtual PROMPT "<-";
ACTION ( , oGetTexto:SetFocus(), oGetTexto:KeyDown(VK_LEFT))
REDEFINE BUTTON aBtnsKeys[47] ID 535 OF oDlgVirtual PROMPT "->";
ACTION ( , oGetTexto:SetFocus() ,oGetTexto:KeyDown(VK_RIGHT) )
REDEFINE BUTTON aBtnsKeys[48] ID 534 OF oDlgVirtual;
PROMPT "Enter"
REDEFINE BUTTON aBtnsKeys[49] ID 562 OF oDlgVirtual;
PROMPT "E" + CRLF + "n" + CRLF + "t" + CRLF + "e" + CRLF + "r";
ACTION ( lSalida:= TRUE, oDlgVirtual:End() )
AEVAL( aBtnsKeys, {| oBtn | oBtn:oFont:= oFontDlg } )
oDlgVirtual:lHelpIcon:= .F.
ACTIVATE DIALOG oDlgVirtual ;
ON PAINT oGetTexto:SetFocus();
VALID lSalida
IF lSalida
AEVAL( aBtnsKeys, {| oBtn | oBtn:End() } )
aBtnsKeys:= NIL
ENDIF
RETURN cTexto
El archivo de recursos
DLG_TECLADO DIALOGEX DISCARDABLE 35, 30, 596, 207
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
BEGIN
CONTROL "Q", 500, "Button", WS_TABSTOP, 9, 43, 42, 34
CONTROL "", 550, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 10, 14, 427, 24
CONTROL "", 300, "Button", BS_GROUPBOX, 4, 3, 440, 187
CONTROL "W", 501, "Button", WS_TABSTOP, 52, 43, 42, 34
CONTROL "E", 502, "Button", WS_TABSTOP, 95, 43, 42, 34
CONTROL "R", 503, "Button", WS_TABSTOP, 138, 43, 42, 34
CONTROL "7", 551, "Button", WS_TABSTOP, 454, 12, 42, 34
CONTROL "8", 552, "Button", WS_TABSTOP, 497, 12, 42, 34
CONTROL "9", 553, "Button", WS_TABSTOP, 540, 12, 42, 34
CONTROL "4", 554, "Button", WS_TABSTOP, 454, 47, 42, 34
CONTROL "5", 555, "Button", WS_TABSTOP, 497, 47, 42, 34
CONTROL "6", 556, "Button", WS_TABSTOP, 540, 47, 42, 34
CONTROL "1", 557, "Button", WS_TABSTOP, 454, 82, 42, 34
CONTROL "2", 558, "Button", WS_TABSTOP, 497, 82, 42, 34
CONTROL "3", 559, "Button", WS_TABSTOP, 540, 82, 42, 34
CONTROL "0", 560, "Button", WS_TABSTOP, 454, 117, 42, 34
CONTROL "Supr", 561, "Button", WS_TABSTOP, 497, 117, 42, 34
CONTROL "Y", 505, "Button", WS_TABSTOP, 224, 43, 42, 34
CONTROL "T", 504, "Button", WS_TABSTOP, 181, 43, 42, 34
CONTROL "U", 506, "Button", WS_TABSTOP, 267, 43, 42, 34
CONTROL "I", 507, "Button", WS_TABSTOP, 310, 43, 42, 34
CONTROL "O", 508, "Button", WS_TABSTOP, 353, 43, 42, 34
CONTROL "A", 510, "Button", WS_TABSTOP, 9, 78, 42, 34
CONTROL "S", 511, "Button", WS_TABSTOP, 52, 78, 42, 34
CONTROL "D", 512, "Button", WS_TABSTOP, 95, 78, 42, 34
CONTROL "F", 513, "Button", WS_TABSTOP, 138, 78, 42, 34
CONTROL "H", 515, "Button", WS_TABSTOP, 224, 78, 42, 34
CONTROL "G", 514, "Button", WS_TABSTOP, 181, 78, 42, 34
CONTROL "J", 516, "Button", WS_TABSTOP, 267, 78, 42, 34
CONTROL "K", 517, "Button", WS_TABSTOP, 310, 78, 42, 34
CONTROL "L", 518, "Button", WS_TABSTOP, 353, 78, 42, 34
CONTROL "Z", 520, "Button", WS_TABSTOP, 9, 113, 42, 34
CONTROL "X", 521, "Button", WS_TABSTOP, 52, 113, 42, 34
CONTROL "C", 522, "Button", WS_TABSTOP, 95, 113, 42, 34
CONTROL "V", 523, "Button", WS_TABSTOP, 138, 113, 42, 34
CONTROL "N", 525, "Button", WS_TABSTOP, 224, 113, 42, 34
CONTROL "B", 524, "Button", WS_TABSTOP, 181, 113, 42, 34
CONTROL "M", 526, "Button", WS_TABSTOP, 267, 113, 42, 34
CONTROL "coma (,)", 527, "Button", WS_TABSTOP, 310, 113, 42, 34
CONTROL "punto (.)", 528, "Button", WS_TABSTOP, 353, 113, 42, 34
CONTROL "P", 509, "Button", WS_TABSTOP, 396, 43, 42, 34
CONTROL "Ñ", 519, "Button", WS_TABSTOP, 397, 78, 42, 34
CONTROL "guion (-)", 529, "Button", WS_TABSTOP, 397, 113, 42, 34
CONTROL "<-", 533, "Button", WS_TABSTOP, 267, 148, 42, 34
CONTROL "ENTER", 534, "Button", WS_TABSTOP, 353, 148, 85, 34
CONTROL "(", 530, "Button", WS_TABSTOP, 9, 148, 41, 34
CONTROL ")", 532, "Button", WS_TABSTOP, 52, 148, 42, 34
CONTROL "Enter", 562, "Button", BS_MULTILINE|WS_TABSTOP, 540, 117, 42, 69
CONTROL "<- Retroceso", 563, "Button", WS_TABSTOP, 454, 152, 85, 34
CONTROL "", 350, "Button", BS_GROUPBOX, 449, 3, 140, 187
CONTROL "Barra espaciadora", 531, "Button", WS_TABSTOP, 95, 148, 170, 34
CONTROL "->", 535, "Button", WS_TABSTOP, 310, 148, 42, 34
END
Saludos