[TxMt] DIALOG2 - menu: enhancement suggestions

Hans-Joerg Bibiko bibiko at eva.mpg.de
Fri Mar 28 14:44:36 UTC 2008


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:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: menu.mm.zip
Type: application/zip
Size: 1990 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20080328/13083209/attachment.zip>
-------------- next part --------------



Cheers,

--Hans



More information about the textmate mailing list