Holas,
esto inicialmente funciona
Code: Select all
#include "fivewin.ch"
#xcommand @ <nRow>, <nCol> BUTTON [ <oBtn> PROMPT ] <cCaption> ;
[ SIZE <nWidth>, <nHeight> ] ;
[ ACTION <uAction> ] ;
[ <default: DEFAULT> ] ;
[ <of:OF, WINDOW, DIALOG> <oWnd> ] ;
[ <help:HELP, HELPID, HELP ID> <nHelpId> ] ;
[ FONT <oFont> ] ;
[ <pixel: PIXEL> ] ;
[ <design: DESIGN> ] ;
[ MESSAGE <cMsg> ] ;
[ <update: UPDATE> ] ;
[ WHEN <WhenFunc> ] ;
[ VALID <uValid> ] ;
[ <lCancel: CANCEL> ] ;
[ ON INIT <uInit> ] ;
=> ;
[ <oBtn> := ] TButton():New( <nRow>, <nCol>, <cCaption>, <oWnd>,;
<{uAction}>, <nWidth>, <nHeight>, <nHelpId>, <oFont>, <.default.>,;
<.pixel.>, <.design.>, <cMsg>, <.update.>, <{WhenFunc}>,;
<{uValid}>, <.lCancel.>, [{|Self|<uInit>}] )
#command @ <nRow>, <nCol> GET [ <oGet> VAR ] <uVar> ;
[ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
[ <pict: PICT, PICTURE> <cPict> ] ;
[ VALID <ValidFunc> ] ;
[ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ FONT <oFont> ] ;
[ <design: DESIGN> ] ;
[ CURSOR <oCursor> ] ;
[ <pixel: PIXEL> ] ;
[ MESSAGE <cMsg> ] ;
[ <update: UPDATE> ] ;
[ WHEN <uWhen> ] ;
[ <lCenter: CENTER, CENTERED> ] ;
[ <lRight: RIGHT> ] ;
[ ON CHANGE <uChange> ] ;
[ <readonly: READONLY, NO MODIFY> ] ;
[ <pass: PASSWORD> ] ;
[ <lNoBorder: NO BORDER, NOBORDER> ] ;
[ <help:HELPID, HELP ID> <nHelpId> ] ;
[ ACTION <uAction> ] ;
[ BITMAP <cBmpName> ] ;
[ CUEBANNER <cCueText> ] ;
[ ON INIT <uInit> ] ;
=> ;
[ <oGet> := ] TGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
[<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
<nClrFore>, <nClrBack>, <oFont>, <.design.>,;
<oCursor>, <.pixel.>, <cMsg>, <.update.>, <{uWhen}>,;
<.lCenter.>, <.lRight.>,;
[\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
<.pass.>, [<.lNoBorder.>], <nHelpId>,,,,,, [\{|self| <uAction> \}], <cBmpName>, <"uVar">,;
[<cCueText>], [{|Self|<uInit>}] )
//----------------------------------------------------------------------------//
function Main()
LOCAL oDlg, b, d := Date(), g
DEFINE DIALOG oDlg FROM 10,10 TO 30,30
@ 1,2 BUTTON "UNO" OF oDlg ACTION ( b:enable(), g:show() )
@ 3,2 BUTTON b PROMPT "DOS" OF oDlg ON INIT ::disable()
@ 6,2 GET g VAR d OF oDlg PICTURE '@d' ON INIT ::hide()
ACTIVATE DIALOG oDlg
return NIL
_ que se deben realizar son:
en los fuentes tget.prg y button.prg, en los metodos new, añadir un parametro al final binit, luego dentro el cuerpo de cada
metodo new añadir ::binit = binit
en la clase dialog en el metodo Initiate añadir la línea
Code: Select all
Aeval( ::aControls,{|o| IF( o:bInit != NIL , Eval( o:bInit, o ), NIL ) } )
antes del código
Code: Select all
if ::bInit != nil
lResult = Eval( ::bInit, Self )
if ValType( lResult ) == "L" .and. ! lResult
lFocus = .f.
endif
endif