On 30. Oct 2006, at 07:49, Brad Choate wrote:
Of course, now I'm wondering how this will change to support nested
menus. Perhaps a menu item can have a 'menuItems' key/value pair
also?
Yes -- we generally use ‘children’ as the key for a sub-item array,
but yes, the reason why I wasn’t keen on making the Ruby wrapper
“strings only” was partly because we will need to attach more than
just a label to each item, and the return can thus also not just be
an integer.
Cocoa has started to operate with an “index path” which is an array
of integers, but I really prefer to just return the entry for the
selected item, as we presently do when handing in an array of hashes.
On Oct 30, 2006, at 3:46 AM, Allan Odgaard wrote:
• 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
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev
_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev