Hi,
      We are experiencing a problem with the onBeforeDisplay/Htmlevent
of visual objects. Suppose we are calling methods which throw an
exception, in these events, we handle them using a try-catch block. Just
in case an exception is thrown the statements in the catch block get
executed. We will display an error page and then STOP the processing by
using return STOP; as the last statement in the catch block. We also use
CSpHtml.reset() before displaying the error page.
    But there seems to be a flaw , in the way we are using , i guess.
The processing for that visual object is stopped , but the objects that
follow the one ,for which an exception occured, are displayed! This
leads to the error page being displayed with the othere visual objects
coming below it! Is there a work around to this problem. I'm including
the sample code with this mail.

 public int cbAttribute_onBeforeDisplayEvent(CSpDisplayEvent event)
 {
  try
  {
   CSpVisual visualObject = (CSpVisual)event.getSource();

   visualObject.removeAllChildren(true);
   if (rtbMajorAttribute.getNumOfRows () > 0)
   {
    String lblcbPA  = "";
    for (int i=0; i< rtbMajorAttribute.getNumOfRows () ;i++)
    {
     if (rtbMajorAttribute.getRowData(i, 3).stringValue().length() < 40)

      lblcbPA = rtbMajorAttribute.getRowData(i, 2).stringValue() + " | "
+ rtbMajorAttribute.getRowData(i, 3).stringValue(); //.substring(0,40);
     else
      lblcbPA = rtbMajorAttribute.getRowData(i, 2).stringValue() + " | "
+ rtbMajorAttribute.getRowData(i, 3).stringValue().substring(0,40) +
"..";

     ((CSpSelectableGroup) visualObject).addSelectable( lblcbPA  ,new
CSpInteger(rtbMajorAttribute.getRowData(i, 1).intValue()));
    }

    ((CSpSelectableGroup) visualObject).addSelectable("*.0 | Report for
All Attributes ",new CSpInteger(-1));
    ((CSpSelectableGroup) visualObject).unselectAll();

    String   ls_Selected  =  "";
    if (MajorAttribute.equals(""))
     ls_Selected   = "-1";
    else
     ls_Selected   = MajorAttribute;

     ((CSpSelectableGroup) visualObject).select(new
CSpString(ls_Selected));
     //log("ls_Selected is " + ls_Selected);
   }
   else
   {
    _errorCode = ERROR;
    _errorDesc = "There are no Attributes currently defined in the
Application";
    throw new Exception();
   }
  }
     catch (Exception ex)
     {
   if (_errorDesc.equals(""))
    _errorDesc = ex.getMessage();
   displayErrorPage();

   return (STOP);

     }//catch

  return (PROCEED);
 }
 //]]SPIDER_EVENT<cbAttribute_onBeforeDisplayEvent>

Thanks for your time.
regds
swaroop

_________________________________________________________________________

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