inputselect() - return index of selected item

Features wanted...
Post Reply
highend
Posts: 14593
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

inputselect() - return index of selected item

Post by highend »

Don, would it be possible to let inputselect return the index of the selected item, e.g. by using an additional style (e.g. 128)
like popupmenu with the flag = 1?

I'm showing all open tabs via inputselect (because live filtering _rocks_!) and if you have more than one tab with the same destination folder I'm unable to switch to the correct one (by scripting) if it's not the first entry for that folder that get's selected. At least I can't find a way to do so...

An index would allow me to do so even if the list get's filtered :)
One of my scripts helped you out? Please donate via Paypal

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: inputselect() - return index of selected item

Post by LittleBiG »

highend wrote:Don, would it be possible to let inputselect return the index of the selected item, e.g. by using an additional style (e.g. 128)
like popupmenu with the flag = 1?

I'm showing all open tabs via inputselect (because live filtering _rocks_!) and if you have more than one tab with the same destination folder I'm unable to switch to the correct one (by scripting) if it's not the first entry for that folder that get's selected. At least I can't find a way to do so...

An index would allow me to do so even if the list get's filtered :)
Why don't you attach the position of the tab before the folder name one by one and show the concatenated value in the inputselect? "1-C:\Windows", "2-C:\Documents\Office" and so on...

highend
Posts: 14593
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: inputselect() - return index of selected item

Post by highend »

I wanted to stay away from "polluting" the path name (one of the reasons: I'm using folder icons for these entries in the list) but if it doesn't fit the nature of the inputselect() command or is too much work I'll go that route.

Thanks for the suggestion.
One of my scripts helped you out? Please donate via Paypal

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: inputselect() - return index of selected item

Post by LittleBiG »

highend wrote:I wanted to stay away from "polluting" the path name (one of the reasons: I'm using folder icons for these entries in the list) but if it doesn't fit the nature of the inputselect() command or is too much work I'll go that route.

Thanks for the suggestion.

Code: Select all

//inputselect without visible pollution
  $ch = inputselect(, "C: |D:  |E:   ",,0);
  msg strlen($ch)-strlen(trim($ch,,"R"));
Just for fun :mrgreen:

admin
Site Admin
Posts: 65060
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: inputselect() - return index of selected item

Post by admin »

highend wrote:Don, would it be possible to let inputselect return the index of the selected item, e.g. by using an additional style (e.g. 128)
Yep, done.

highend
Posts: 14593
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: inputselect() - return index of selected item

Post by highend »

@LittleBiG

A creative solution but somehow also crude :)

@Don

Thanks a lot!
One of my scripts helped you out? Please donate via Paypal

Post Reply