You need to add a listener. Below is an example of this from a superclass I
created by extending CSpDataObject.
public int init()
{
int rc = super.init();
addDataObjectListener(this);
return rc;
}
Hope this helps.
Fred
Troy Mckinnon wrote:
> Hey all,
>
> I have a question regarding event overriding:
>
> I am trying to add some functionality to the onBeforeDisplayEvent of a
> button.
>
> Fin code below:
>
> public class testButton extends CSpButton
>
> {
> public int init()
> {
> enableEvents (CSpEvent.DISPLAY_EVENT_MASK);
> return super.init();
> }
>
> protected void processDisplayEvent(CSpDisplayEvent event) throws
> CSpSkipException , CSpStopException
> {
> int command=PROCEED;
>
> if (event.getId () == CSpDisplayEvent.ON_BEFORE_DISPLAY_EVENT ) {
> // I would rather do this with the setVisible(false) method but it won't
> work here.
> if(dontShowMe)
> throw new CSpSkipException ();
> }
> super.processDisplayEvent(event);
> }
>
> // Why can't I add actions to the event by including it here in the
> superclass??
> // This event does not register at all.
> public int onBeforeDisplayEvent(CSpDisplayEvent event)
> throws CSpSkipException , CSpStopException {
> CSpHtml.sendMessage("<br>---onBeforeDisplayEvent-----");
> Object src = event.getSource();
> return myMethod((CSpButton)src);
> }
>
> protected int myMethod(CSpButton bt) throws CSpSkipException
> if(doIt)
> {
> CSpHtml.sendMessage("<br>Security Event<br>");
> throw new CSpSkipException();
> }
> return PROCEED;
> }
>
> }
>
> --------------------
>
> I would really appreciate any comments or advice...
>
> Thanks
>
> Troy
>
> Troy McKinnon
> Technical Team Leader
> Integrated Quality Management System
> Nortel Networks - GHCT (Dept. 1J11)
> (613) 765-7685 or ESN (395) 7685
>
> _________________________________________________________________________
>
> For help in using, subscribing, and unsubscribing to the discussion
> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>
> For dire need help, email: [EMAIL PROTECTED]
--
Fred Bruegmann
Lead Electronic Commerce Analyst
Whirlpool Corporation
Phone: (616) 923-3751
Fax: (616) 923-4667
Email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]