Hi,
I'm just rewriting the GetBundles bundle to support the new syntax of DIALOG2. In principal it works fine if I take the eventInfo Dict. But I came up with a "problem".
I have a NIB containing a NSSegmentedControl for filtering the repos Bundles, Review, GitHub, All. I bound it via Segment Selection > Selected Label to Paramters.selcetion.bundleSelection and connected the entire NSSegmentedControl to File's Owner 'performButtonClick'. Each Segment has its own tag number.
With DIALOG1 I get e.g.: <dict> <key>bundleSelection</key> <string>Review</string> <key>cancelBtn</key> <string>cancelButtonIsPressed</string> <key>dataarray</key> <array> <dict>
....
then I can check whether there's a returnArgument, if not is there a key 'bundleSelection'...
BUT with DIALOG2 the eventInfo Dict gives me: <key>eventInfo</key> <dict> <key>tag</key> <integer>0</integer> <key>type</key> <string>buttonClick</string> </dict> <key>model</key> <dict> <key>bundleSelection</key> <string>Review</string> <key>cancelBtn</key> <string>cancelButtonIsPressed</string> <key>dataarray</key> <array> <dict>
This would me that I have to deal with both the eventInfo Dict AND the model Dict in order to find which button was pressed.
If I have a 'normal' button bound to performButtonClick DIALOG2 response is: <key>eventInfo</key> <dict> <key>tag</key> <integer>4</integer> <key>title</key> <string>Rescan Bundle List</string> <key>type</key> <string>buttonClick</string> </dict>
Is there a way to put into the eventInfo Dict the title of the chosen Segment of a Segment Control à la the 'normal' button event?
My very first idea was to include into TMDNibController.mm - (IBAction)performButtonClick:(id)sender ... if([sender respondsToSelector:@selector(selectedSegment)] & [sender respondsToSelector:@selector(cell)]) [res setObject:[NSNumber numberWithInt:[[sender cell] tagForSegment: [sender selectedSegment]]] forKey:@"selected_tag"];
Then you can deal with unique tag numbers and you only need the eventInfo Dict.
Many thanks in advance
--Hans
On 30 Sep 2008, at 10:48, Hans-Jörg Bibiko wrote:
[ DIALOG2 ] This would me that I have to deal with both the eventInfo Dict AND the model Dict in order to find which button was pressed. [...] Is there a way to put into the eventInfo Dict the title of the chosen Segment of a Segment Control à la the 'normal' button event?
I talked with Hans about this on IRC, but for the records:
1. performButtonClick: is something I would like to deprecate. 2. Binding to returnArgument:«arguments» should allow for any binding property to end up in the event info. 3. Long-term it should be possible to observe just the binding property w/o having to involve action methods: http://lists.macromates.com/textmate/2008-August/026309.html -- there is a (minor?) challenge here though indicating which (root) object to observe. 4. Long-term we also plan to add a sort of a filter key-path argument to tm_dialog that makes it so that only the given key-path is returned (rather than full model).