>Hi Everybody
>
>I want to exit from method of a class once a property has something inside by using _assign method.What is the practice from getting out of current method and return the error message ?
>
>Any help is highly appreciated. Thanks
>
>MM = CREATEOBJECT("CAR_PARK")
>? MM.TEST_DRIVE()
>Sorry.Full ! <---- Returned message
>
>DEFINE CLASS CAR_PARK AS SESSION OLEPUBLIC
> ERROR_MESSAGE = ""
>
> PROCEDURE ERROR_MESSAGE_ASSIGN
> LPARAMETERS vNewVal
> THIS.ERROR_MESSAGE = m.vNewVal
> IF .NOT.EMPTY(THIS.ERROR_MESSAGE)
> RETURN THIS.ERROR_MESSAGE TO MASTER <- ???????????? Pls enlighting me
> ENDIF
> ENDPROC
>
> PROCEDURE TEST_DRIVE
> THIS.ERROR_MESSAGE = "Sorry.Full !"
>
> Execution terminated
> Blah...Blah...Blah...
> ENDPROC
>ENDDEFINE
Arnold,
Caller should decide what to do when a result returns to it, not the class method itself. Otherwise you wouldn't be encapsulating and decrease the reusability of class.
ie:
MM = CREATEOBJECT("CAR_PARK")
lnResult = MM.TEST_DRIVE()
if lnResult < 0
messagebox(mm.Error_Message)
PROCEDURE TEST_DRIVE
THIS.ERROR_MESSAGE = "Sorry.Full !"
return -1
ENDPROC
Cetin