Hi Nimmi,

Here it is:
=======================================================
package myProject;

import <whatever>

public class myCSpComboBox extends CSpComboBox {

public void select(String selection) {
    Enumeration enum = getChildren().elements();
    int count = 0;
    boolean found = false
    while (enum.hasMoreElements()) {
        CSpSelectable sel = (CSpSelectable) enum.nextElement();
          if(sel.getValue().toString().equals(selection)) {
                found = true;
              break;
          }
          else  
              count++;
   }
   if (found) 
        select(count);
}
}
========================================================
1. Put the above file in your project directory, add to the project as a
user module and compile (I didn't try to compile it. There might be one
or two errors)

2.Go to the studio, select the concerned comboBoxes and change the
'SuperClass' property to
"myProject.myCSpComboBox"

You are pretty much done except for clearing the Server cache and stuff
like that.

I think the non-empty constructors of CSpComboBox will lose their
availability unless you copy them here and call super(). But I have
never had any problem. Makes me wonder if ND ever uses those
constructors.

Remember to typecast to (myCSpCombobox) in order to call this version of
'select'.


Regards,

Aby

-----Original Message-----
From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 10, 1999 2:05 PM
To: 'Aby Mathew'
Subject: RE: [ND] FW: [ND] Trying to use setValue for a Combobox with
the concatena tion of d atafields


Aby,

Its me again. I have never subclassed in ND. Could you please do me a
favor
and tell me how do I go about doing it. I could definitely use some help
at
this point.

-Nimmi

-----Original Message-----
From: Aby Mathew [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 10, 1999 3:57 PM
To: 'Shamdasani Nimmi-ANS004'; 'Curt Springer'; 'NetDynamics'
Subject: RE: [ND] FW: [ND] Trying to use setValue for a Combobox with
the concatena tion of d atafields



Forgot to mention that if you have a couple of places where you have the
same problem, it might be good idea to subclass CSpComboBox and add a
method 
select(java.lang.String) which will do what the code below does.

Aby

-----Original Message-----
From: Aby Mathew [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 10, 1999 1:47 PM
To: 'Curt Springer'; Shamdasani Nimmi-ANS004; 'NetDynamics'
Subject: Re: [ND] FW: [ND] Trying to use setValue for a Combobox with
the concatena tion of d atafields


I got curious about what was going on and did some research. I am pretty
convinced that there is a bug (may be two) in ND.

My conclusions:

1. If you have selected Emp Name and Emp id as the value for the combo,
the value is constructed as "John, 1234". While
combo.getSelected().getValue() correctly gives "John, 1234",
combo.getValue() returns "John,1234" (takes out the space after ,)

2. combo.select(CSpValue) fails even after the above glitch is taken
care of. I guess the culprit is none but the implementation of
select(CSpValue).

I could get going with the following piece of code.
======================================================================
                Enumeration enum = combo.getChildren().elements();
                int count = 0;
                while (enum.hasMoreElements()) {
                        CSpSelectable sel = (CSpSelectable)
enum.nextElement();
                        if
(sel.getValue().toString().equals(myDesiredString))
                                break;
                        else  {
                        CSpHtml.sendMessage("Val :
|"+sel.getValue()+"|<BR>");
                        count++;
                        }                       
                }
                combo.select(count);
======================================================================

Well, I was driven by curiosity. Otherwise I would have used a computed
column in the DataObject where Oracle would have neatly concatenated the
fields and given one field to ND.


Aby

_________________________________________________________________________

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