Hi,
the new DIALOG2 allows to display an inline menu with headers like:
Nouns table 1 tree 2 vase 3 Verbs count 4 drink 5 eat 6
Very nice! But it could occur the following case:
Nouns drink 1 tree 2 vase 3 Verbs count 4 drink 5 eat 6
If I now choose "drink" I get: <dict> <key>selectedIndex</key> <integer>6</integer> <key>selectedMenuItem</key> <dict> <key>title</key> <string>drink</string> </dict> </dict>
But I do not know which "drink". Ok, I also got selectedIndex 6 and it would be doable to figure it out. To simplify it I changed the code slightly to output this:
<dict> <key>selectedIndex</key> <integer>6</integer> <key>selectedMenuItem</key> <dict> <key>header</key> <string>Verbs</string> <key>title</key> <string>drink</string> </dict> </dict>
if there is an header given. If no header is found you will get the "old" dict.
##############
An other very tiny problem I encountered is the following: I would like to have this menu: Offset 20 10 0 -10 -20
The negative numbers are interpreted as a separator because the strings begin with -. One could easily fix it by using "kMenuItemAttrIgnoreMeta". I did this, but this could be discussed, of course.
Here's the code:
Cheers,
--Hans
Hi,
I also added the chance to change the face how the header will be displayed e.g. in bold, italics, underlined, etc.
Furthermore I added the possibility to call "menu" like
"$DIALOG" menu -p '{ headerStyle = 7; menuItems = ({title = "Nouns"; header = 1; },{title = "drink";}); }'
for compatibility reasons.
Here's the code:
Cheers,
--Hans