bugGNUstep - Bugs: bug #19031, [NSDocument...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19031: [NSDocument runModalSavePanel:withAccessoryView:] doesn't check for existing accessoryView

Submitted by:  Fabian Borschel <seirei>
Submitted on:  Sun 11 Feb 2007 04:37:17 PM UTC  
 
Category: Gui/AppKitSeverity: 3 - Normal
Item Group: BugStatus: In Progress
Privacy: PublicAssigned to: Fred Kiefer <FredKiefer>
Open/Closed: In Test

Tue 20 Feb 2007 08:32:08 PM UTC, comment #5:

The text there is not as clear to me as it seems to be for you:

"You can control whether the default accessory view (which contains a pop-up menu allowing the user to choose what type to save) appears in the Save panel by overriding shouldRunSavePanelWithAccessoryView. The default accessory view is used if that method returns YES and the document supports writing multiple types.

You can customize the panel more completely by overriding prepareSavePanel: and modifying the panel before calling super. For example, you could replace the accessory view entirely."

The word replace might indicate that you don't have to stop it from getting created, but I am not sure about that. Do you have the means to test this on Apple? I could do, but wont have the time for this before the FOSDEM.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Tue 20 Feb 2007 05:26:32 PM UTC, comment #4:

Hm, well I thought if i don't want any accessory view you override the [NSDocument shouldRunSavePanelWithAccessoryView] and return NO.

If you want a customized accessory view you override [NSDocument prepareSavePanel] and do you changes there. At least that's what Apple tells in their FAQ for Document-Based Applications.

http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/index.html#//apple_ref/doc/uid/10000006i

There on the left menu select "Frequently Asked Questions" and look for the question "How can I customize the Save panel?". Apple uses frames, so i can't give you a direct link to this. Sorry.

Fabian Borschel <seirei>
Tue 20 Feb 2007 03:10:06 PM UTC, comment #3:

Not sure, if you are correct. I would expect that, if you don't want the standard accessory view for your document, you override the shouldRunSavePanelWithAccessoryView method to return NO. Why would you want any other accessory view to be created that you don't want to use?

With that in place my change makes perfect sense, at least to me :-)

If you still insist on your requested behaviour you will need to prove that Apple does it just the way you want it to be.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Tue 20 Feb 2007 01:43:14 PM UTC, comment #2:

Your workaround is wrong in a kind of funny way.
You should test whether savePanel already has an attached accessoryView. So something like

- (int)runModalSavePanel: (NSSavePanel *)savePanel
withAccessoryView: (NSView *)accessoryView
{
if ([savePanel accessoryView] == nil)
{
[savePanel setAccessoryView: accessoryView];
}
return [savePanel runModal];
}

You tested whether accessoryView is nil which always is not because the given variable "accessoryView" always points to the fileType view generated by NSDocument class itself.

About the general case i don't know enough about how things work. But just taking the name "setAccessoryView" i would assume that this method replaces any existing accessory view. Maybe there could be something like "addAccessoryView".

Fabian Borschel <seirei>
Sun 18 Feb 2007 08:03:07 PM UTC, comment #1:

I added a workaround for this problem, could you please test if it resolves your issue?
What I did is just not to set the accessory view in this method if it is nil. This wont work in the general case, when you want the standard accessory view plus your own, but in many cases it should be sufficient.

Fred Kiefer <FredKiefer>
Project MemberIn charge of this item.
Sun 11 Feb 2007 04:37:17 PM UTC, original submission:

Hi all,

if a document based application sets an accessory view via [NSDocument prepareSavePanel] to add a customized accessory view it gets overwritten by [NSDocument runModalSavePanel:withAccessoryView:].

Maybe [NSDocument runModalSavePanel:withAccessoryView:] should check whether savePanel already has an accessory view or if it's still nil.

Fabian

Fabian Borschel <seirei>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by FredKiefer (Posted a comment)
  • -unavailable- added by seirei (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 18 Feb 2007 08:03:07 PM UTCFredKieferStatusNone=>In Progress
      Assigned toNone=>FredKiefer
      Open/ClosedOpen=>In Test

    Back to the top


    Powered by Savane 3.1-cleanup1