Code: Select all
DEFINE DIALOG oDlgLogin RESOURCE "DLG_ACCESO" TITLE "Acceso al sistema..." ICON oIcoLogin
REDEFINE GET oGetPasswo VAR cPassword ID 550 UPDATE FONT oFontGet OF oDlgLogin
oGetPasswo:bKeyChar:= {|nKey| IIF( nKey == VK_RETURN, ;
( lAccesar:= CheckPassword( aUsuarios[ oBrwUsers:nArrayAt ][01], ;
oGetPasswo, cPassword, oDbfUsers ), ;
IF( lAccesar, oDlgLogin:End(), lAccesar:= .F. ) ), .T. ) }
REDEFINE BUTTON aBtnsKeys[ 1] ID 500 OF oDlgLogin PROMPT "Q" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("Q")) )
REDEFINE BUTTON aBtnsKeys[ 2] ID 501 OF oDlgLogin PROMPT "W" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("W")) )
REDEFINE BUTTON aBtnsKeys[ 3] ID 502 OF oDlgLogin PROMPT "E" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("E")) )
REDEFINE BUTTON aBtnsKeys[ 4] ID 503 OF oDlgLogin PROMPT "R" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("R")) )
REDEFINE BUTTON aBtnsKeys[ 5] ID 504 OF oDlgLogin PROMPT "T" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("T")) )
REDEFINE BUTTON aBtnsKeys[ 6] ID 505 OF oDlgLogin PROMPT "Y" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("Y")) )
REDEFINE BUTTON aBtnsKeys[ 7] ID 506 OF oDlgLogin PROMPT "U" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("U")) )
REDEFINE BUTTON aBtnsKeys[ 8] ID 507 OF oDlgLogin PROMPT "I" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("I")) )
REDEFINE BUTTON aBtnsKeys[ 9] ID 508 OF oDlgLogin PROMPT "O" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("O")) )
REDEFINE BUTTON aBtnsKeys[10] ID 509 OF oDlgLogin PROMPT "P" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("P")) )
REDEFINE BUTTON aBtnsKeys[11] ID 510 OF oDlgLogin PROMPT "A" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("A")) )
REDEFINE BUTTON aBtnsKeys[12] ID 511 OF oDlgLogin PROMPT "S" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("S")) )
REDEFINE BUTTON aBtnsKeys[13] ID 512 OF oDlgLogin PROMPT "D" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("D")) )
REDEFINE BUTTON aBtnsKeys[14] ID 513 OF oDlgLogin PROMPT "F" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("F")) )
REDEFINE BUTTON aBtnsKeys[15] ID 514 OF oDlgLogin PROMPT "G" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("G")) )
REDEFINE BUTTON aBtnsKeys[16] ID 515 OF oDlgLogin PROMPT "H" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("H")) )
REDEFINE BUTTON aBtnsKeys[17] ID 516 OF oDlgLogin PROMPT "J" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("J")) )
REDEFINE BUTTON aBtnsKeys[18] ID 517 OF oDlgLogin PROMPT "K" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("K")) )
REDEFINE BUTTON aBtnsKeys[19] ID 518 OF oDlgLogin PROMPT "L" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("L")) )
REDEFINE BUTTON aBtnsKeys[20] ID 519 OF oDlgLogin PROMPT "Ñ" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("Ñ")) )
REDEFINE BUTTON aBtnsKeys[21] ID 520 OF oDlgLogin PROMPT "Z" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("Z")) )
REDEFINE BUTTON aBtnsKeys[22] ID 521 OF oDlgLogin PROMPT "X" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("X")) )
REDEFINE BUTTON aBtnsKeys[23] ID 522 OF oDlgLogin PROMPT "C" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("C")) )
REDEFINE BUTTON aBtnsKeys[24] ID 523 OF oDlgLogin PROMPT "V" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("V")) )
REDEFINE BUTTON aBtnsKeys[25] ID 524 OF oDlgLogin PROMPT "B" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("B")) )
REDEFINE BUTTON aBtnsKeys[26] ID 525 OF oDlgLogin PROMPT "N" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("N")) )
REDEFINE BUTTON aBtnsKeys[27] ID 526 OF oDlgLogin PROMPT "M" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("M")) )
REDEFINE BUTTON aBtnsKeys[28] ID 527 OF oDlgLogin PROMPT "," ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC(",")) )
REDEFINE BUTTON aBtnsKeys[29] ID 528 OF oDlgLogin PROMPT "." ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC(".")) )
REDEFINE BUTTON aBtnsKeys[30] ID 529 OF oDlgLogin PROMPT "-" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("-")) )
REDEFINE BUTTON aBtnsKeys[31] ID 530 OF oDlgLogin PROMPT "(" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("(")) )
REDEFINE BUTTON aBtnsKeys[32] ID 531 OF oDlgLogin PROMPT "Barra Espaciadora" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_SPACE) )
REDEFINE BUTTON aBtnsKeys[33] ID 532 OF oDlgLogin PROMPT ")" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC(")")) )
REDEFINE BUTTON aBtnsKeys[34] ID 533 OF oDlgLogin PROMPT "<-" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_LEFT) )
REDEFINE BUTTON aBtnsKeys[35] ID 534 OF oDlgLogin PROMPT "Enter";
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_RETURN) )
REDEFINE BUTTON aBtnsKeys[36] ID 535 OF oDlgLogin PROMPT "->" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_RIGHT) )
REDEFINE BUTTON aBtnsKeys[37] ID 551 OF oDlgLogin PROMPT "7" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("7")) )
REDEFINE BUTTON aBtnsKeys[38] ID 552 OF oDlgLogin PROMPT "8" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("8")) )
REDEFINE BUTTON aBtnsKeys[39] ID 553 OF oDlgLogin PROMPT "9" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("9")) )
REDEFINE BUTTON aBtnsKeys[40] ID 554 OF oDlgLogin PROMPT "4" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("4")) )
REDEFINE BUTTON aBtnsKeys[41] ID 555 OF oDlgLogin PROMPT "5" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("5")) )
REDEFINE BUTTON aBtnsKeys[42] ID 556 OF oDlgLogin PROMPT "6" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("6")) )
REDEFINE BUTTON aBtnsKeys[43] ID 557 OF oDlgLogin PROMPT "1" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("1")) )
REDEFINE BUTTON aBtnsKeys[44] ID 558 OF oDlgLogin PROMPT "2" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("2")) )
REDEFINE BUTTON aBtnsKeys[45] ID 559 OF oDlgLogin PROMPT "3" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("3")) )
REDEFINE BUTTON aBtnsKeys[46] ID 560 OF oDlgLogin PROMPT "0" ;
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyChar(ASC("0")) )
REDEFINE BUTTON aBtnsKeys[47] ID 561 OF oDlgLogin PROMPT "Supr";
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_DELETE) )
REDEFINE BUTTON aBtnsKeys[48] ID 562 OF oDlgLogin;
PROMPT "E" + CRLF + "n" + CRLF + "t" + CRLF + "e" + CRLF + "r";
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_RETURN) )
REDEFINE BUTTON aBtnsKeys[49] ID 563 OF oDlgLogin PROMPT "<- Retroceso";
ACTION ( oGetPasswo:SetFocus(), oGetPasswo:KeyDown(VK_BACK) )
AEVAL( aBtnsKeys, {| oBtn | oBtn:oFont:= oFontDlg } )
REDEFINE STSAY oSay ID 750 OF oDlgLogin ;
COLORS RGB(86,102,45), RGB(252, 252, 236 ), RGB( 224, 231, 184 );
FONT oFontBrow BASS
REDEFINE IMAGE oFoto ID 705 FILE "bitmaps\fotousuarios.bmp" OF oDlgLogin ADJUST
oFoto:Progress( .f. )
REDEFINE IMAGE oLogo ID 720 FILE "bitmaps\logoacceso.bmp" OF oDlgLogin
oLogo:lTransparent:= .T.
WITH OBJECT oBrwUsers:= TXBrowse():New( oDlgLogin )
:SetArray( aUsuarios )
:nHeaderHeight := 25
:nRowHeight := 35
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:lColDividerComplete := .T.
:lHScroll := .T.
:bClrStd := {|| IF( ( oBrwUsers:nArrayAt % 2 ) == 0, ;
{ CLR_BLACK, RGB(250,240,188)},{CLR_BLACK,RGB(254,252,237)} ) }
/*
:bChange:= {|| IF ( !EMPTY(ALLTRIM( aUsuarios[ oBrwUsers:nArrayAt ][04] )), ;
oFoto:LoadBMP( ALLTRIM( aUsuarios[ oBrwUsers:nArrayAt ][04] ) ), "" ), ;
oFoto:refresh() }
*/
WITH OBJECT :aCols[1]
:cHeader := "Usuario"
:nWidth := 80
:oHeaderFont:= oFontHead
:oDataFont := oFontBrow
END
WITH OBJECT :aCols[2]
:cHeader := "Nombre completo del usuario"
:nWidth := 250
:oHeaderFont:= oFontHead
:oDataFont := oFontBrow
END
WITH OBJECT :aCols[3]
:bStrData := { || IF( aUsuarios[ oBrwUsers:nArrayAt ][03]== "S", "Supervisor", ;
IF( aUsuarios[ oBrwUsers:nArrayAt ][03]=="J", "Cajero(a)", ;
IF( aUsuarios[ oBrwUsers:nArrayAt ][03]=="I", "Inventarios",;
IF( aUsuarios[ oBrwUsers:nArrayAt ][03]=="V", "Vendedor", "Indefinido") ) ) ) }
:cHeader := "Tipo"
:nWidth := 90
:oHeaderFont:= oFontHead
:oDataFont := oFontBrow
END
:CreateFromResource(700)
END
REDEFINE BUTTONBMP aBtnArrow[1] ID 710 OF oDlgLogin BITMAP "BMP_BOTTOM" ;
ACTION ( oBrwUsers:GoDown(), oBrwUsers:SetFocus() )
REDEFINE BUTTONBMP aBtnArrow[2] ID 715 OF oDlgLogin BITMAP "BMP_TOP";
ACTION ( oBrwUsers:GoUp(), oBrwUsers:SetFocus() )
oDlgLogin:lHelpIcon:= .F.
oDlgLogin:bPainted := { || oLogo:LoadBmp( "bitmaps\logoacceso.bmp" ), oLogo:Refresh(), oBrwUsers:SetFocus() }
oDlgLogin:SetBrush( oBrush )
ACTIVATE DIALOG oDlgLogin ;
VALID ( oFontHead:End(),oFontBrow:End(),oFontDlg:End(),oFontGet:End(), ;
oDbfUsers:Close(), oIcoLogin:End(), oBrush:End(), .T. )
Code: Select all
DLG_ACCESO DIALOGEX DISCARDABLE 40, 30, 596, 321
STYLE WS_POPUP|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE
CAPTION "Dialog"
FONT 8, "MS Sans Serif", 0, 0, 1
{
CONTROL "", 700, "TxBrowse", WS_TABSTOP, 10, 13, 363, 107
CONTROL "", 710, "Button", WS_TABSTOP, 375, 70, 31, 50
CONTROL "", 715, "Button", WS_TABSTOP, 407, 70, 31, 50
CONTROL "", 550, "Edit", ES_AUTOHSCROLL|ES_PASSWORD|ES_WANTRETURN|WS_BORDER|WS_TABSTOP, 71, 137, 366, 24
CONTROL "Q", 500, "Button", WS_TABSTOP, 9, 166, 42, 34
CONTROL "W", 501, "Button", WS_TABSTOP, 52, 166, 42, 34
CONTROL "E", 502, "Button", WS_TABSTOP, 95, 166, 42, 34
CONTROL "R", 503, "Button", WS_TABSTOP, 138, 166, 42, 34
CONTROL "T", 504, "Button", WS_TABSTOP, 181, 166, 42, 34
CONTROL "Y", 505, "Button", WS_TABSTOP, 224, 166, 42, 34
CONTROL "U", 506, "Button", WS_TABSTOP, 267, 166, 42, 34
CONTROL "I", 507, "Button", WS_TABSTOP, 310, 166, 42, 34
CONTROL "O", 508, "Button", WS_TABSTOP, 353, 166, 42, 34
CONTROL "P", 509, "Button", WS_TABSTOP, 396, 166, 42, 34
CONTROL "A", 510, "Button", WS_TABSTOP, 9, 201, 42, 34
CONTROL "S", 511, "Button", WS_TABSTOP, 52, 201, 42, 34
CONTROL "D", 512, "Button", WS_TABSTOP, 95, 201, 42, 34
CONTROL "F", 513, "Button", WS_TABSTOP, 138, 201, 42, 34
CONTROL "G", 514, "Button", WS_TABSTOP, 181, 201, 42, 34
CONTROL "H", 515, "Button", WS_TABSTOP, 224, 201, 42, 34
CONTROL "J", 516, "Button", WS_TABSTOP, 267, 201, 42, 34
CONTROL "K", 517, "Button", WS_TABSTOP, 310, 201, 42, 34
CONTROL "L", 518, "Button", WS_TABSTOP, 353, 201, 42, 34
CONTROL "Ñ", 519, "Button", WS_TABSTOP, 397, 201, 42, 34
CONTROL "Z", 520, "Button", WS_TABSTOP, 9, 236, 42, 34
CONTROL "X", 521, "Button", WS_TABSTOP, 52, 236, 42, 34
CONTROL "C", 522, "Button", WS_TABSTOP, 95, 236, 42, 34
CONTROL "V", 523, "Button", WS_TABSTOP, 138, 236, 42, 34
CONTROL "B", 524, "Button", WS_TABSTOP, 181, 236, 42, 34
CONTROL "N", 525, "Button", WS_TABSTOP, 224, 236, 42, 34
CONTROL "M", 526, "Button", WS_TABSTOP, 267, 236, 42, 34
CONTROL "coma (,)", 527, "Button", WS_TABSTOP, 310, 236, 42, 34
CONTROL "punto (.)", 528, "Button", WS_TABSTOP, 353, 236, 42, 34
CONTROL "guion (-)", 529, "Button", WS_TABSTOP, 397, 236, 42, 34
CONTROL "(", 530, "Button", WS_TABSTOP, 9, 271, 41, 34
CONTROL ")", 532, "Button", WS_TABSTOP, 52, 271, 42, 34
CONTROL "Barra espaciadora", 531, "Button", WS_TABSTOP, 95, 271, 170, 34
CONTROL "<-", 533, "Button", WS_TABSTOP, 267, 271, 42, 34
CONTROL "->", 535, "Button", WS_TABSTOP, 310, 271, 42, 34
CONTROL "ENTER", 534, "Button", WS_TABSTOP, 353, 271, 85, 34
CONTROL "7", 551, "Button", WS_TABSTOP, 454, 135, 42, 34
CONTROL "8", 552, "Button", WS_TABSTOP, 497, 135, 42, 34
CONTROL "9", 553, "Button", WS_TABSTOP, 540, 135, 42, 34
CONTROL "4", 554, "Button", WS_TABSTOP, 454, 170, 42, 34
CONTROL "5", 555, "Button", WS_TABSTOP, 497, 170, 42, 34
CONTROL "6", 556, "Button", WS_TABSTOP, 540, 170, 42, 34
CONTROL "1", 557, "Button", WS_TABSTOP, 454, 205, 42, 34
CONTROL "2", 558, "Button", WS_TABSTOP, 497, 205, 42, 34
CONTROL "3", 559, "Button", WS_TABSTOP, 540, 205, 42, 34
CONTROL "0", 560, "Button", WS_TABSTOP, 454, 240, 42, 34
CONTROL "Supr", 561, "Button", WS_TABSTOP, 497, 240, 42, 34
CONTROL "Enter", 562, "Button", BS_MULTILINE|WS_TABSTOP, 540, 240, 42, 69
CONTROL "<- Retroceso", 563, "Button", WS_TABSTOP, 454, 275, 85, 34
CONTROL "", 300, "Button", BS_GROUPBOX, 4, 126, 440, 187
CONTROL "", 350, "Button", BS_GROUPBOX, 449, 126, 140, 187
CONTROL "", 4002, "Button", BS_GROUPBOX, 4, 3, 440, 123
CONTROL "TIMage", 705, "TImage", 0x00000000, 377, 13, 60, 55
CONTROL "TImage", 720, "TImage", 0x00000000, 448, 6, 142, 119
CONTROL "Contraseña", 750, "Static", SS_CENTERIMAGE|WS_GROUP, 12, 144, 58, 10
}