- Code: Select all Expand view
- #include "fivewin.ch"
function main()
local oDlg, oChk, oGet1, oGet2
local bNew, bEdit, bSave, bCancel
local lChk1, lChk2, lChk3
local lEdit := .f.
local cJob := ''
local cRevCode := Spac( 10 )
local cDesc := Spac( 30 )
bnew := {|| lEdit := .T., cJob := 'NEW', oDlg:update(), ;
oDlg:aEvalWhen(), oGet1:setFocus() }
bEdit := {|| lEdit := .T., cJob := 'EDIT', ;
oDlg:update(), oDlg:aEvalWhen(), ;
oGet2:setFocus() }
bSave := {|| oDlg:update(), lEdit := .F., cJob := '', oDlg:aEvalWhen() }
bCancel := {|| lEdit := .F., cJob := '', oDlg:aEvalWhen(), oDlg:update(), .F. }
DEFINE DIALOG oDlg RESOURCE "RevCode" TRANSPARENT COLOR CLR_BLUE, RGB(240,240,240)
REDEFINE BUTTONBMP ID 127 OF oDlg ACTION EVAL( bNew ) WHEN ! lEdit
REDEFINE BUTTONBMP ID 128 OF oDlg ACTION Eval( bEdit ) WHEN ! lEdit
REDEFINE BUTTONBMP ID 129 OF oDlg WHEN ! lEdit
REDEFINE BUTTONBMP ID 132 OF oDlg ACTION Eval( bSave ) WHEN lEdit
REDEFINE BUTTONBMP ID 133 OF oDlg ACTION Eval( bCancel ) WHEN lEdit
REDEFINE GET oGet1 VAR cRevCode ID 101 OF oDlg UPDATE WHEN lEdit .AND. cJob = 'NEW'
REDEFINE GET oGet2 VAR cDesc ID 102 OF oDlg UPDATE WHEN lEdit
REDEFINE CHECKBOX oChk VAR lchk1 ID 106 OF oDlg UPDATE ;
WHEN lEdit
oChk:bChange := { || oDlg:Update() }
REDEFINE CHECKBOX lChk2 ID 107 OF oDlg UPDATE ;
WHEN lEdit .and. lChk1
REDEFINE CHECKBOX lChk3 ID 108 OF oDlg UPDATE ;
WHEN lEdit .and. lChk1
REDEFINE BUTTONBMP ID 126 OF oDlg ACTION oDlg:END() WHEN ! lEdit
ACTIVATE DIALOG oDlg ;
VALID IF( GetKeyState(VK_ESCAPE) .AND. lEdit, ;
EVAL( bCancel ), .t. )
RETURN NIL
And the .rc file:
- Code: Select all Expand view
- REVCODE DIALOG 30, 21, 405, 101
STYLE DS_3DLOOK |DS_SETFONT |DS_MODALFRAME |WS_POPUP |WS_VISIBLE |WS_SYSMENU |WS_CAPTION
CAPTION "Centros de Costo"
FONT 8, "MS Sans Serif"
LANGUAGE LANG_NEUTRAL, 0
BEGIN
CONTROL "",1001,"BUTTON",BS_GROUPBOX |WS_CHILD |WS_VISIBLE ,9,20,392,53
CONTROL "",101,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,100,28,92,12
CONTROL "",102,"EDIT",ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,100,42,169,12
CONTROL " Nuevo",127,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,6,7,50,14
CONTROL " Modificar",128,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,60,7,50,14
CONTROL " Grabar",132,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,167,7,50,14
CONTROL " Cancelar",133,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,221,7,50,14
CONTROL " Salir",126,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,348,78,50,14
CONTROL "Centro De Costo",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,10,31,75,8
CONTROL "Descripción",65535,"STATIC",SS_RIGHT |WS_CHILD |WS_GROUP |WS_VISIBLE ,10,44,75,8
CONTROL " Eliminar",0,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,73,289,50,14
CONTROL " Eliminar",129,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,113,7,50,14
CONTROL "Crear Orden",106,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,305,31,70,10
CONTROL "Imprimir Orden",107,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,305,42,70,10
CONTROL "Imprimir Etiqueta",108,"BUTTON",BS_CHECKBOX |BS_LEFT |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,305,54,70,10
END