@Don
Why not do it this way (style = 1024):
This style would allow user defined icons (but the path isn't autotruncated by XY, the user has to take care of this),
with the following logic
- Separator must have been set to something _different_ than "|"
This would switch the behavior of to what popupmenu() / popupnested() already provide:
listdata can be used as "Caption|Data|Icon|State" where the separator is bound to "|".
If you want to add the full logic, "State" could be supported (e.g. if state contains "1", items are preselected when style = 2 is used in conjunction)
But because prefixing each line with a "+" leads to the same result, this could be left out.
If only "Caption" is used ("|" is NOT present at all), it's still the same old behavior, "Caption" would be treated as
the full path to a file and the icon is taken from it (if style = 1 or style = 8 is set), otherwise if "|" is present
the icon is taken from the "Icon" field and if "Icon" is not used, but "Data" is, it is taken from that one).
This wouldn't break existing scripts (style = 1024 is necessary), requires not too much additional programming
for the logic (no can of worms here), doesn't require any additional params ("sep_itemlist" would not be necessary
and not in an unexpected position (at the end of the parameter list)) and opens inputselect() a whole new world
by supporting user defined icons.
The only minor drawback: The separator for "Caption|Data|Icon|State" is bound to "|"...
Code: Select all
$list = <<<>>>
%USERPROFILE%\Desktop\7-Zip|R:\7-Zip.lnk|D:\Tools\7-Zip\7zFM.exe
%USERPROFILE%\Desktop\AIMP|R:\AIMP.lnk|D:\Tools\AIMP\some_icon.ico
%USERPROFILE%\Desktop\HxD|D:\Tools\HxD\HxDPortable.exe
D:\Tools\IcoFx\icofx3.exe
>>>;
$sel = inputselect("Start app...", $list, <crlf>, 1024);
// 1st entry: Caption|Data|Icon -> Get icon from "Icon" | Shows: 7-Zip
// 2nd entry: Caption|Data|Icon -> Get icon from "Icon" | Shows: AIMP
// 3rd entry: Caption|Data -> Get icon from "Data" | Shows: HxD
// 4th entry: Caption -> Get icon from "Caption" | Shows: D:\Tools\IcoFx\icofx3.exe