Re: Combobox / Droplist index problem [message #40261] |
Fri, 30 July 2004 07:53  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <8f9f5929.0407300202.20215269@posting.google.com>, "Jacques
Basson" <basson@cyclops.nu.ac.za> wrote:
> I have stumbled across a problem with retrieving the index in a combobox
> if you have some items with identical text.
I think the point of combobox is that you don't need to rely on the index
number, you get the value returned in the event (ev.str). Comboboxes also
allow the user to write their option in (if you allow it :) in which case
a -1 is returned for the index.
I suspect the combobox is returning the first result from a naive WHERE
command, hence the -1 when the selection isn't found in the original
list.
Also, what's the difference between the first '2', and the second '2'? How
does the user differentiate between them if they have the same labels?
Chris.
|
|
|
|
|
Re: Combobox / Droplist index problem [message #40349 is a reply to message #40261] |
Sun, 01 August 2004 23:50  |
basson
Messages: 4 Registered: June 2003
|
Junior Member |
|
|
"Christopher Lee" <cl@127.0.0.1> wrote in message news:<20040730.155357.1186452551.29225@buckley.atm.ox.ac.uk>...
> In article <8f9f5929.0407300202.20215269@posting.google.com>, "Jacques
> Basson" <basson@cyclops.nu.ac.za> wrote:
>
>
>> I have stumbled across a problem with retrieving the index in a combobox
>> if you have some items with identical text.
>
> I think the point of combobox is that you don't need to rely on the index
> number, you get the value returned in the event (ev.str). Comboboxes also
> allow the user to write their option in (if you allow it :) in which case
> a -1 is returned for the index.
>
> I suspect the combobox is returning the first result from a naive WHERE
> command, hence the -1 when the selection isn't found in the original
> list.
>
> Also, what's the difference between the first '2', and the second '2'? How
> does the user differentiate between them if they have the same labels?
>
> Chris.
I suspect that you're right about the WHERE - possibly some limitation
of the motif toolkit (which is why it works on Windows).
As for the difference, obviously this is a contrived example (so that
I don't post reams of irrelevant code), but the user (who may not
think too hard) is providing the values that eventually appear in the
combobox. Selecting a value will fill in another combobox with dates,
and this allows the distinction to be made. Yes, it is bad practice on
the user's side and may never occur, but I'd prefer to cater for it if
possible.
Jacques
|
|
|
Re: Combobox / Droplist index problem [message #40350 is a reply to message #40263] |
Sun, 01 August 2004 23:40  |
basson
Messages: 4 Registered: June 2003
|
Junior Member |
|
|
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b73ed87127571379897f3@news.frii.com>...
> Jacques Basson writes:
>
>> I have stumbled across a problem with retrieving the index in a
>> combobox if you have some items with identical text. The "old"
>> droplist returns the correct index, but the combobox widget returns
>> the 1st index that matches the currently selected text (an example is
>> included below). Am I retrieving the index incorrectly? Is there some
>> other way to get the combobox to work (I am only using it instead of
>> the droplist because of RSI's recommendation in the manual)?
>
> What version of IDL are you using? As far as I can tell,
> your test program works perfectly on my Windows machine
> in IDL 6.03.
>
> Cheers,
>
> David
Well that's just not fair :) I'm using { x86 linux unix linux 6.0.3
Feb 26 2004 32 64} and have just tried it out on a Windows
machine and you are 100% correct, it does work there.
|
|
|