DEFINE class GloablEvents as line PROCEDURE MailReceived(tcMailID as String) as boolean ENDPROC PROCEDURE ... ENDPROC ENDDEFINEThen I have a handlerclass (handlerobject) that sits on a form with a private datasession that
DEFINE class MailListHandler as custom PROCEDURE INIT BindEvent(goApp.oEvents, "MailReceived", This "OnMailReceived") ENDPROC PROCEDURE OnMailReceived(tcMailID as string) as boolean local lcAlias, lcWhere, lnRecords lcAlias = "SELECTION" lcWhere = "where ID = '"+ tcMailID +"' " lnRecords = This.GetData(lcWhere, lcAlias) if lnRecords > 0 and used(lcAlias) ... then do some stuff endif return .T. ENDPROC PROCEDURE GetData(tcWhere as String, tcAlias as String) as Integer ... select <Fields> from <table> &tcWhere ; into cursor (tcAlias) return _tally ENDPROC ENDDEFINEThe problem was, the code at "... then do some stuff" NEVER got executed although
DEFINE class MailListHandler as custom PROCEDURE INIT BindEvent(goApp.oEvents, "MailReceived", This "OnMailReceived") ENDPROC PROCEDURE OnMailReceived(tcMailID as string) as boolean Return This.ShowNewMail(tcMailID) ENDPROC PROCEDURE ShowNewMail(tcMailID as String) as Boolean local lcAlias, lcWhere, lnRecords lcAlias = "SELECTION" lcWhere = "where ID = '"+ tcMailID +"' " lnRecords = This.GetData(lcWhere, lcAlias) if lnRecords > 0 and used(lcAlias) ... then do some stuff endif ENDPROC PROCEDURE GetData(tcWhere as String, tcAlias as String) as Integer ... ENDPROC ENDDEFINEI thought this would be interesing as I was almost going up the wall