Problem refreshing drop down lists

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem refreshing drop down lists

Keith  Lander
I have a dialog containing 2 drop down lists with the contents of one list
dependent on the selection in the other list. If the user selects an item in
one list the app has to change the contents of the other list. The method
that responds to the selectionChanged event on the controlling list changes
the ListModel in the other list. This has the effect of triggering a
selection changed event on the other list. Unfortunately the method that
handles the event fails when it retrieves the selection index because it is
set to zero (i.e. no selection).

I have used a kludge to get round the problem. I'm sure there is a better
way of dealing with this, but I can't find one.

Cheers
Keith


Reply | Threaded
Open this post in threaded view
|

Re: Problem refreshing drop down lists

Bill Schwab
Keith,

> I have a dialog containing 2 drop down lists with the contents of one list
> dependent on the selection in the other list. If the user selects an item
in
> one list the app has to change the contents of the other list. The method
> that responds to the selectionChanged event on the controlling list
changes
> the ListModel in the other list. This has the effect of triggering a
> selection changed event on the other list. Unfortunately the method that
> handles the event fails when it retrieves the selection index because it
is
> set to zero (i.e. no selection).
>
> I have used a kludge to get round the problem. I'm sure there is a better
> way of dealing with this, but I can't find one.

Is not having no selection a condition that should be anticipated?  There
are methods like #selectionIfNone: that you can use to early out of a
handler that would otherwise get upset.  Is that the kludge?  If so, I'm not
sure I consider it one.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]