Troy,

I think your problem is in the expectation that this method:

        // This event does not register at all.
          public int onBeforeDisplayEvent(CSpDisplayEvent event)
            throws CSpSkipException , CSpStopException {

will be automagically fired.  To get onBeforeDisplayEvent(CSpDisplayEvent
event) fired by the framework you need to have a class that implements
ISpDisplayListener, place the method in that class, and then register with
the appropriate object by using addDisplayListener().  With your subclassed
object this shouldn't be very difficult to get running.

Another (less elegant IMO) approach would be to shortcut the entire scheme
by overriding the display() method and doing your own thing -- please be
aware that it is the button object that is responsible for firing ALL
listeners on the button+, including the display and html output listeners
which are more than likely done in the display() method making overriding
the display() method a matter for caution.

+ I haven't verified this, but I believe it to be true.

[EMAIL PROTECTED]
Team NetDynamics

> -----Original Message-----
> From: Troy Mckinnon [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, June 30, 1999 12:59 PM
> To:   'ND'
> Subject:      [ND] Overriding an event
> 
> 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]
_________________________________________________________________________

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]

Reply via email to