Board index » jbuilder » JdbComboBox and Action Events

JdbComboBox and Action Events


2004-01-02 08:43:02 AM
jbuilder1
A JdbComboBox that has its DataSet and ColumnName set (the normal case) no
longer fires any ActionListeners that have been registered with the
component. Anyone know why this is, if it's intended behavior and if there
is a workaround? TIA.
-Steve
 
 

Re:JdbComboBox and Action Events

"Steve" wrote:
Quote
A JdbComboBox that has its DataSet and ColumnName set (the normal case) no
longer fires any ActionListeners that have been registered with the
component. Anyone know why this is, if it's intended behavior and if there
is a workaround? TIA.

-Steve

My JdbComboBox fires.
But I have JB9 and I read in JB X libraries had some change.
 

Re:JdbComboBox and Action Events

Steve wrote:
Quote
A JdbComboBox that has its DataSet and ColumnName set (the normal case) no
longer fires any ActionListeners that have been registered with the
component. Anyone know why this is, if it's intended behavior and if there
is a workaround? TIA.
A quick look at the related dbSwing code doesn't
reveal anything, but I seem to remember that
in some cases, listeners are removed. Whether
this applies to action listeners, I have no
idea, but the problem rings a bell ... faintly.
I don't have time to personally test this
hypothesis but here's what I'd do as an
initial phase of investigating the problem:
If you are assigning the action listeners
prior to setting the dataset or column names,
try this:
// assume jbdcombobox name cbox
// add action listener; then
System.out.println(
"before count: " + cbox.getActionListeners().length);
cbox.setDataset(aDataset);
System.out.println(
"after count: " + cbox.getActionListeners().length);
If there's a disparity in count, you may
have to adopt a protocol whereby you always
reset your listeners _after_ setting the
dataset and/or column names.
--
Paul Furbacher (TeamB)
Save time, search the archives:
www.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

{smallsort}

Re:JdbComboBox and Action Events

"Paul Furbacher" < XXXX@XXXXX.COM >wrote in message
Quote
Steve wrote:

>A JdbComboBox that has its DataSet and ColumnName set (the normal case)
no
>longer fires any ActionListeners that have been registered with the
>component. Anyone know why this is, if it's intended behavior and if
there
>is a workaround? TIA.

A quick look at the related dbSwing code doesn't
reveal anything, but I seem to remember that
in some cases, listeners are removed. Whether
this applies to action listeners, I have no
idea, but the problem rings a bell ... faintly.

I don't have time to personally test this
hypothesis but here's what I'd do as an
initial phase of investigating the problem:


If you are assigning the action listeners
prior to setting the dataset or column names,
try this:

// assume jbdcombobox name cbox

// add action listener; then

System.out.println(
"before count: " + cbox.getActionListeners().length);

cbox.setDataset(aDataset);

System.out.println(
"after count: " + cbox.getActionListeners().length);

If there's a disparity in count, you may
have to adopt a protocol whereby you always
reset your listeners _after_ setting the
dataset and/or column names.
Yep, that was the only remotely suspicious piece of code I could find.
However, it doesn't affect ActionListeners anyway. I tried your suggested
test anyway just for giggles and it worked fine. I had already moved the
addActionListener() call to after setDataSet() anyway, so that can't be the
problem. If I can't figure it out I'll post it on QC, FWIW. I ended up using
a ColumnChange listener as workaround, and this turned out to be the way I
should have done it in the first place. Thanks for the tip.
-Steve
 

Re:JdbComboBox and Action Events

"Plinio Conti" < XXXX@XXXXX.COM >wrote in message
Quote


"Steve" wrote:

>A JdbComboBox that has its DataSet and ColumnName set (the normal case)
no
>longer fires any ActionListeners that have been registered with the
>component. Anyone know why this is, if it's intended behavior and if
there
>is a workaround? TIA.

My JdbComboBox fires.
But I have JB9 and I read in JB X libraries had some change.
Interesting. I'm running JB9 as well. At the risk of a dumb question, are
you sure that you set a dataset and column for the combobox? I went back and
did this same test on one of the Borland samples (PickLists) and got the
same problem, so I'm pretty sure there isn't anything particular that I'm
doing (which by the way uses JDK 1.4.1, whereas my original sample uses .2,
so I know _that's_ not the problem this time). Thanks for any feedback you
have.
-Steve
 

Re:JdbComboBox and Action Events

Hello,
A too late reply maybe to be useful for you, but still:
We had the same problem with JdbNavComboBox component: The actionlistener
fired OK with JDK 1.3, but not with 1.4. Happened with several JBuilder
versions (4, 9, X).
We contacted Borland, and they eventually confirmed it was a JDK 1.4 bug
also causing problems for JBuilder components. However, they sent a patch
that fixed the problem. If you contact Borland and refer to the support case
542245, I guess they can provide you with the same patch.
This will probably be a part of later distributions (but is is NOT fixed in
JBuilder X).
Regards,
Knut
"Steve" < XXXX@XXXXX.COM >wrote in message
Quote

"Paul Furbacher" < XXXX@XXXXX.COM >wrote in message
news:3ff5b49a$ XXXX@XXXXX.COM ...
>Steve wrote:
>
>>A JdbComboBox that has its DataSet and ColumnName set (the normal
case)
no
>>longer fires any ActionListeners that have been registered with the
>>component. Anyone know why this is, if it's intended behavior and if
there
>>is a workaround? TIA.
>
>A quick look at the related dbSwing code doesn't
>reveal anything, but I seem to remember that
>in some cases, listeners are removed. Whether
>this applies to action listeners, I have no
>idea, but the problem rings a bell ... faintly.
>
>I don't have time to personally test this
>hypothesis but here's what I'd do as an
>initial phase of investigating the problem:
>
>
>If you are assigning the action listeners
>prior to setting the dataset or column names,
>try this:
>
>// assume jbdcombobox name cbox
>
>// add action listener; then
>
>System.out.println(
>"before count: " + cbox.getActionListeners().length);
>
>cbox.setDataset(aDataset);
>
>System.out.println(
>"after count: " + cbox.getActionListeners().length);
>
>If there's a disparity in count, you may
>have to adopt a protocol whereby you always
>reset your listeners _after_ setting the
>dataset and/or column names.

Yep, that was the only remotely suspicious piece of code I could find.
However, it doesn't affect ActionListeners anyway. I tried your suggested
test anyway just for giggles and it worked fine. I had already moved the
addActionListener() call to after setDataSet() anyway, so that can't be
the
problem. If I can't figure it out I'll post it on QC, FWIW. I ended up
using
a ColumnChange listener as workaround, and this turned out to be the way I
should have done it in the first place. Thanks for the tip.

-Steve


 

Re:JdbComboBox and Action Events

Hello,
This is a known issue, due to a JDK 1.4 bug. (We had it with the
JdbNavComboBox component, it did not fire any actionlistener event in JDK
1.4.)
Contact Borland support, refer to support case 542245, and they will
hopefully provide you with the same DBSwing patch as they sent us (we
received it Jan 13th 2004.)
Regards,
Knut
"Steve" < XXXX@XXXXX.COM >wrote in message
Quote

"Paul Furbacher" < XXXX@XXXXX.COM >wrote in message
news:3ff5b49a$ XXXX@XXXXX.COM ...
>Steve wrote:
>
>>A JdbComboBox that has its DataSet and ColumnName set (the normal
case)
no
>>longer fires any ActionListeners that have been registered with the
>>component. Anyone know why this is, if it's intended behavior and if
there
>>is a workaround? TIA.
>
>A quick look at the related dbSwing code doesn't
>reveal anything, but I seem to remember that
>in some cases, listeners are removed. Whether
>this applies to action listeners, I have no
>idea, but the problem rings a bell ... faintly.
>
>I don't have time to personally test this
>hypothesis but here's what I'd do as an
>initial phase of investigating the problem:
>
>
>If you are assigning the action listeners
>prior to setting the dataset or column names,
>try this:
>
>// assume jbdcombobox name cbox
>
>// add action listener; then
>
>System.out.println(
>"before count: " + cbox.getActionListeners().length);
>
>cbox.setDataset(aDataset);
>
>System.out.println(
>"after count: " + cbox.getActionListeners().length);
>
>If there's a disparity in count, you may
>have to adopt a protocol whereby you always
>reset your listeners _after_ setting the
>dataset and/or column names.

Yep, that was the only remotely suspicious piece of code I could find.
However, it doesn't affect ActionListeners anyway. I tried your suggested
test anyway just for giggles and it worked fine. I had already moved the
addActionListener() call to after setDataSet() anyway, so that can't be
the
problem. If I can't figure it out I'll post it on QC, FWIW. I ended up
using
a ColumnChange listener as workaround, and this turned out to be the way I
should have done it in the first place. Thanks for the tip.

-Steve


 

Re:JdbComboBox and Action Events

Knut Hovda wrote:
Quote
Hello,

This is a known issue, due to a JDK 1.4 bug. (We had it with the
JdbNavComboBox component, it did not fire any actionlistener event in JDK
1.4.)

Contact Borland support, refer to support case 542245, and they will
hopefully provide you with the same DBSwing patch as they sent us (we
received it Jan 13th 2004.)

Regards,

Knut

Thanks a lot for posting this information, Knut. Very useful.
--
Regards,
Lori Olson (TeamB)
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html