[SVN] r5760

Allan Odgaard throw-away-1 at macromates.com
Mon Oct 30 03:46:48 UTC 2006


• new -u/--menu argument to tm_dialog which makes it interpret the paramaters property list as a menu structure, the structure is an array with the key menuItems and each item in the array is again a dictionary with either a title key/value pair or a separator key/value pair, so an example would be to call:

    tm_dialog -up '{ menuItems = ( { title = foo; }, { separator = 1; }, { title = bar; } ); }'

This shows a menu with two items and a separator between these. It might seem a tad verbose, but a menu item can convey a lot of things (which we may want to support in the future).

The result from tm_dialog is a dictionary with a selectedIndex key where the value is a zero-based index into the menuItems array, and a selectedMenuItem key with the selected item as value (so you can generally just store your user data in the structure you pass in. If there is no selection, an empty dictionary is returned — currently tm_dialog’s exit code is not affected by cancel (but probably should be).

Changed:
U   trunk/Tools/Dialog PlugIn/Dialog.h
U   trunk/Tools/Dialog PlugIn/Dialog.mm
U   trunk/Tools/Dialog PlugIn/Dialog.xcodeproj/project.pbxproj
U   trunk/Tools/Dialog PlugIn/tm_dialog.mm



More information about the textmate-dev mailing list