[TxMt] Question on the new DIALOG2 approach
Hans-Jörg Bibiko
bibiko at eva.mpg.de
Tue Sep 30 08:48:24 UTC 2008
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
More information about the textmate
mailing list