Enrico Maria Giordano wrote:Ugo wrote:This is a bug?
It seems not. Look inside tget.prg, method CreateButton() and you will see that the same technique is used there. I tried it under Harbour with the same result (the local variable is still required).
Ugo wrote:The other clauses (valid,spinner,when etc.) work well using directly the class variable
Dear Enrico,
Test it:
FUNCTION Main()
LOCAL o
Set century on
SET EPOCH TO 2000
o := MyClass():New()
RETURN Nil
CLASS MyClass
DATA dData
DATA lTest INIT .T.
METHOD New() CONSTRUCTOR
ENDCLASS
METHOD New() CLASS MyClass
LOCAL oGet4, lWhen := .T., oDlg, oSelf := Self, cTxt := Space( 10 ), oGet5
::dData := Date()
DEFINE DIALOG oDlg
@ 1, 1 GET oGet4 VAR ::dData OF oDlg PICTURE "@D"; // RESOURCE "B_Cld"
SIZE 50, 12 ;
WHEN ::lTest;
VALID IF( ::lTest,;
IF( MyTest( ::dData ),;
( MsgInfo( "Test OK", ::dData ), .T. ),;
( MsgInfo( "Test KO", ::dData ), .F. ) ),;
.T. );
ACTION (oSelf:dData:=Date()-10)
@ 3, 1 GET oGet5 VAR cTxt OF oDlg
ACTIVATE DIALOG oDlg
RETURN Self
STATIC FUNCTION MyTest( dData )
MsgInfo( "Test in corso" + CRLF + ;
DToS( dData ) + " < " + DToS( Date() ) + CRLF + ;
cValToChar( dData < Date() ) , dData )
RETURN dData < Date()
as you can see, both the variable ::lTest that the same ::dData work well in the When and Valid clauses, only Action required oSelf.