Hi,
I'm just writing the extension for DIALOG2 to show up a user-defined open/save panel optionally with an accessory view.
I can call it like:
"$DIALOG" panel open -p '{message="Input"; button1 = Load; allowMultipleSelection = 1; startDir = "/usr/bin/"; string=ANNA; switch=1;}' ~/Desktop/acc.nib
whereby 'string' and 'switch' are set in the accessory view (TextIInputField and a Checkbox) specified in acc.nib. It works fine.
Now I tried to show these panels as sheets bound to the current window. This also works fine ;) BUT: I do not know how to write the 'resultDict' plist back to TM if I'm using sheets :{ (NSLog() shows the correct plist)
If I show up the panels as windows I'm using: [TMDCommand writePropertyList:resultDict toFileHandle:[proxy outputHandle]];
called within '(void)handleCommand:(CLIProxy*)proxy'
Fine. But if I'm using sheets then I have to call: [openPanel beginSheetForDirectory: startDir file: [parameters objectForKey:@"file"] types: fileTypes modalForWindow: documentWindow modalDelegate: self didEndSelector: @selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo: nil];
within '(void)handleCommand:(CLIProxy*)proxy' and this means I have to leave the method '(void)handleCommand:(CLIProxy*)proxy'
My method to handle the sheet after closing is - (void)openPanelDidEnd:(NSOpenPanel*)openPanel returnCode: (int)returnCode contextInfo:(void*)contextInfo
and I didn't find a way to get access to TMDCommand's [proxy outputHandle]. I tried to copy the handle, to set proxy as class variable, etc. I directly wrote to stdout but it's redirected.
Is there anyone who can give me an hint? (If it would be better to post the preliminary code for panel.mm, please let it me know)
Thanks --Hans
On 31 Mar 2008, at 14:24, Hans-Joerg Bibiko wrote:
I'm just writing the extension for DIALOG2 to show up a user-defined open/save panel optionally with an accessory view.
I can call it like:
"$DIALOG" panel open -p '{message="Input"; button1 = Load; allowMultipleSelection = 1; startDir = "/usr/bin/"; string=ANNA; switch=1;}' ~/Desktop/acc.nib
whereby 'string' and 'switch' are set in the accessory view (TextIInputField and a Checkbox) specified in acc.nib. It works fine.
Now I tried to show these panels as sheets bound to the current window. This also works fine ;) BUT: I do not know how to write the 'resultDict' plist back to TM if I'm using sheets :{
I found a solution.
Short demo (340k): http://www.bibiko.de/TM_D2_PANELSHEET.mov
This leads to a related question. Should we try to add the possibility to show up each modal dialog as a sheet? I tried it out and in principal it works, if the nib doesn't have a autosave name. But I do not know what kind of consequences could occur. Any comments?
Cheers, --Hans