Window border artifacts

Discussion in 'Mac Programming' started by akakhan, Aug 22, 2010.

  1. akakhan macrumors newbie

    Joined:
    Aug 22, 2010
    #1
    Hello friends.
    Below is a screenshot, which explains the problem.
    Interestingly, this effect occurs only when I resize the sheet horizontally, and when I try to change the size of the vertical effect disappears.
    How to fix this?
    [​IMG]
     

    Attached Files:

    • 2.png
      2.png
      File size:
      67.8 KB
      Views:
      174
  2. TheShinyMac macrumors 6502a

    TheShinyMac

    Joined:
    Apr 3, 2009
  3. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #3
    )) *I accidentally attached the wrong picture.
     
  4. TheShinyMac macrumors 6502a

    TheShinyMac

    Joined:
    Apr 3, 2009
    #4
    Upload another
     
  5. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #5
    Refresh the page ) already uploaded

    "effects" near Cancel button occurs when the sheet resizing horizontally )
    and more: "effects" occurs only when panel in "sheet mode". I think this is directly related to the transparency of the sheet.
     
  6. TheShinyMac macrumors 6502a

    TheShinyMac

    Joined:
    Apr 3, 2009
    #6
    That looks like more of a glitch in the software not GPU so your all set I believe
     
  7. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
  8. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #8
    When I resize the sheet vertically, the page refreshes and the glitch disappears. How do I update the sheet when resizing horizontally to disappear glitches? (Method for NSPanel, NSWindow or any way) HELP

    P.S.: The sheet inherited from NSPanel
     
  9. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #9
    Why? Is it older code that you converted from a panel to a sheet? Try switching it to a NSWindow, see it that helps.
     
  10. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #10
    Thanks, but How can it help me? NSPanel inherits from NSWindow. But I try and, of course, it did not help. ))

    [​IMG]
     

    Attached Files:

  11. Sydde macrumors 68020

    Sydde

    Joined:
    Aug 17, 2009
    #11
    I suppose the other question might be why would you need to resize the sheet at all? Zero the resize flag. It is highly unlikely that anyone will ever notice or complain.
     
  12. Peter Maurer macrumors member

    Joined:
    Oct 9, 2008
    #12
    I'm curious: Do you draw the sheet's bottom bar gradient yourself (with a custom view), or are they content borders, as introduced with Mac OS X 10.5?

    Anyway, one thing you could try is monitoring size changes for the sheet (by means of a delegate, for instance), then marking either the whole window or all of your bottom bar buttons' superview hierarchy for needing display. Clearly, you shouldn't have to do that, but it might help.

    (By the way, here's another vote for making this particular sheet non-resizable. Regardless, though, this glitch is still interesting.)
     
  13. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #13
    Yes, disabling resizing "solve the problem", but as Peter said, it does not fix the glitch.
    Besides changing the size, you may need in other windows.
     
  14. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #14
    Yes, this bottom bar (border), which was introduced in Mac OS X 10.5.

    How do I do this?
     
  15. Peter Maurer macrumors member

    Joined:
    Oct 9, 2008
    #15
    Try something like this in your sheet's delegate:

    Code:
    - (NSSize)windowWillResize: (NSWindow*)theWindow toSize: (NSSize)theProposedWindowSize {
    	NSView *aView = copyPasteboardButton;	// assume copyPasteboardButton is an IBOutlet connected to the "Copy Pasteboard" button in your sheet's bottom bar
    	while (aView = [aView superview]) {
    		[aView setNeedsDisplay: YES];
    	}
    	return theProposedWindowSize;
    }
    It's not pretty, but it might work. :D

    Alternatively, you could subscribe to NSWindowDidResizeNotification for your sheet and do the -setNeedsDisplay: loop in your notification handler.
     
  16. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #16
    Thanks, now works. But still - this bug))
     
  17. akakhan thread starter macrumors newbie

    Joined:
    Aug 22, 2010
    #17
    Here's a temporary fix that bug.

    Code:
    @implementation NSPanel (SheetResize)
    
    - (NSSize) windowWillResize: (NSWindow*)theWindow toSize: (NSSize)theProposedWindowSize
    {
    	[_borderView setNeedsDisplay: YES];
    	return theProposedWindowSize;
    }
    
    @end
     

Share This Page