comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Combobox / Droplist index problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Combobox / Droplist index problem [message #40261] Fri, 30 July 2004 07:53 Go to next message
Chris Lee is currently offline  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 #40262 is a reply to message #40261] Fri, 30 July 2004 06:01 Go to previous messageGo to next message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Jacques Basson wrote:
> 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)?
>

Hello Jacques,

I just tested your code, I agree with you that the combobox event structure does
not always has INDEX = 2, regardless of which '2' in the menu choice I select.

I'm on ...
{ ppc darwin unix Mac OS X 6.0.3 Feb 26 2004 32 32}

I haven't used the combobox because it doesn't have the droplist's equivalent of

selectIndex = WIDGET_INFO(listID, /Droplist_Select)

Ben
Re: Combobox / Droplist index problem [message #40263 is a reply to message #40262] Fri, 30 July 2004 05:31 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
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
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Combobox / Droplist index problem [message #40349 is a reply to message #40261] Sun, 01 August 2004 23:50 Go to previous message
basson is currently offline  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 Go to previous message
basson is currently offline  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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Translate characters/string size to data/normal coordinates?
Next Topic: serial port

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:56:07 PDT 2025

Total time taken to generate the page: 0.00477 seconds