Re: Creating NSTableView programmatically

2017-12-14 Thread corbin dunn


> On Dec 12, 2017, at 2:12 AM, Eric Matecki  wrote:
> 
> Hi,
> 
> On 11/12/2017 20:10, Quincey Morris wrote:
>>> I made my own text field class according to this (in NSTableCellView's doc) 
>>> :
>> 
>> I think you’re still kinda Doing It Wrong™. The standard (and, I believe, 
>> recommended) way to do this is to create an instance of
>> NSTableCellView, which has the “objectValue” property, along with other 
>> potentially useful behaviors for cell views (such as
>> identifiers that allow the NSTableView to cache and manage cell views).
> 
> I know it's wrong, or at least bad, but NSTextView and NSButton are the 
> controls I kind of master right now...
> I really don't need a textview, as I'm just trying to reproduce the 
> "Combattant" example.
> I still can't get the names to display with NSTableCellView.
> 
> Here (at the bottom of the page) :
> https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TableView/PopulatingViewTablesWithBindings/PopulatingView-TablesWithBindings.html
> it says :
> """
> When you make the connection to the table view’s Content binding, the 
> objectValue property of the NSTableViewCell used as the cell for the table 
> column is configured such that for each item in the model array, the table 
> updates the objectValue property to the current row’s Person object
> 1) Select the text field in the table column cell and create the binding.
> All bindings of subviews in the cell are made to the objectValue.
> Configure the textField instance’s value binding.
> 
> Binding field | Value
> ---
> Bind to:  | Table Cell View
> Model key path| objectValue.name
> """
> 
> So I have this in my NSTableView's delegate, which is my interpretation of 
> the above :
> 
> - (NSView *)tableView:(NSTableView *)tableView
>   viewForTableColumn:(NSTableColumn *)tableColumn
>  row:(NSInteger)row
> {
> #if 0  // this shows the names
> 
>cTextView*  view = [[cTextView  alloc]  init]; // cTextView is my custom 
> NSTextView with just an added objectValue property
>[view  bind: @"value"  toObject: tableView  withKeyPath: 
> @"objectValue.name"  options: 0];  // wrong, but works
>//[view  bind: @"value"  toObject: view  withKeyPath: @"objectValue.name"  
> options: 0]; // right, works
> 
> #else // this doesn't show the names
> 
>NSTableCellView*  view = [[NSTableCellView  alloc]  init];
>//[[view  textField]  setBackgroundColor: [NSColor  redColor]]; // just to 
> be sure to see it when empty... nada
>//[[view  textField]  bind: @"value"  toObject: tableView  withKeyPath: 
> @"objectValue.name"  options: 0]; // wrong, doesn't work
>[[view  textField]  bind: @"value"  toObject: view  withKeyPath: 
> @"objectValue.name"  options: 0]; // right?, but doesn't work

^ This is correct, but the piece you are missing is somehow providing the 
objectValue for the resulting tableCellView. 

NSTableView sets the objectValue to the result from the table’s content 
binding. It does this on the result you return from the above method. However, 
I recommend just implementing tableView:objectValueForTableColumn:row: in your 
delegate and returning something. The “something” you are turning has to be an 
object that has a “name” property (based on your binding). You could just bind 
it to “objectValue” and return a (cached) string.

corbin

> 
> #endif
>return  view;
> }
> 
> Note that I bind the NSTextView to tableView, while the doc says "the 
> objectValue property of the NSTableViewCell", not of the tableview... but it 
> works, and I don't understand why... I don't like it when I don't understand 
> what's happening.
> It also works when binding to the view, which is expected (I first bound it 
> to tableView by mistake...).
> It's still weird (to me) to bind an object's binding to one of it's own 
> properties.
> I guess it's more or less by chance that it displays the names, and that some 
> changes in my model won't get correctly propagated...
> 
> In the case of NSTableCellView, neither binding works... I don't get any 
> exception or crash, but nothing is displayed inside my table view (although 
> it's size suggests the four rows are there).
> But setting the backgroud of the textfield to red doesn't show any red on the 
> screen...
> (Trying to the set the cell's background gives me a "may not respond to 
> message" warning, and obviously nothing gets red on the screen).
> 
> Something in the "big scheme of things" escapes me, and Apple's doc was not 
> very helpful until now.
> 
>> In a very unusual or complex case, you might subclass NSTableCellView to add 
>> properties or behaviors to it, but it’s normally not
>> necessary. Custom properties, for example, can be carried around by the 
>> object referred to by “objectValue”, and custom behaviors
>> can sometimes be implemented as part of the delegate.
>> 
>> Instead of using a cell view other than a NSTableCellView or 

Re: How to make a NSText​Find​Bar​Container client.

2017-03-29 Thread corbin dunn

> On Mar 28, 2017, at 1:45 PM, Daryle Walker  wrote:
> 
> It seems that I’ll be the first American in general & GitHub open-source 
> history to ever make a NSText​Find​Bar​Container subclass. The window 
> controller shows two views in a split view. The top half is a NSTableView 
> surrounded by a NSScrollView. The bottom half is a NSTextView surrounded by a 
> scroll view. Each one can handle NSTextFinder, but I’m considering them 
> halves of the same document (since they are). So I’m make a single find-bar 
> to cover both views. I’ve read about NSTitlebarAccessoryViewController and 
> wonder if I can use it to hold the Find controls.
> 
>> class MyWindowController: NSWindowController {
>>//...
>>dynamic var representedMessage: RawMessage?
>>dynamic var isWritable: Bool = true
>> 
>>// Outlets
>>@IBOutlet weak var messageController: NSObjectController!
>>@IBOutlet weak var headerController: NSArrayController!
>>@IBOutlet weak var textFinder: NSTextFinder!
>>@IBOutlet weak var accessoryView: NSVisualEffectView!
>> 
>>// Pseudo-outlets
>>var headerViewController: NSViewController!
>>var bodyViewController: NSTabViewController!
>>var addBodyViewController: NSViewController!
>>var bodyTextViewController: NSViewController!
>> 
>>var headerTableView: NSTableView!
>>var bodyTextView: NSTextView!
>> 
>>/// Table of which characters, combining the header and body as a single 
>> string, are where.
>>dynamic var textRanges = [NSMakeRange(0, 0)]
>>/// The accessory title-bar to contain the text-finding controls.
>>let findBar = NSTitlebarAccessoryViewController()
>> 

This creates an empty class; you should subclass 
NSTitlebarAccessoryViewController and provide implementation stuff to get the 
view, or use initWithNibName and pass in your NIB that contains the view. Hence 
the log you mention later.

>>//…

You left off what you are doing here; it might be relevant.

corbin

>> 
>>override func windowDidLoad() {
>>super.windowDidLoad()
>>//...
>>findBar.layoutAttribute = .bottom
>>}
>>//...
>> }
> 
> I added a NSTextFinder to my window controller’s top bar and added an outlet. 
> I’m using the window controller class as the NSTextFinderClient delegate:
> 
>> extension MyWindowController: NSTextFinderClient {
>> 
>>/// Determine the right substring, from the text range map.
>>func string(at characterIndex: Int, effectiveRange outRange: 
>> NSRangePointer, endsWithSearchBoundary outFlag: 
>> UnsafeMutablePointer) -> String {
>>//...
>>}
>> 
>>/// Determine the length of the virtual string, from the text range map.
>>func stringLength() -> Int {
>>return NSMaxRange(self.textRanges.last!)
>>}
>> 
>> }
> 
> and a NSTextFindBarContainer delegate:
> 
>> extension MyWindowController: NSTextFinderBarContainer {
>> 
>>var findBarView: NSView? {
>>get { return self.findBar.view }
>>set { self.findBar.view = newValue ?? /*self.accessoryView*/ NSView() 
>> }
>>}
>> 
>>func contentView() -> NSView? {
>>return self.window?.contentView
>>}
>> 
>>var isFindBarVisible: Bool {
>>get {
>>return self.findBar.parent != nil
>>}
>> 
>>@objc(setFindBarVisible:) set {
>>if newValue && self.findBar.parent == nil {
>>self.window?.addTitlebarAccessoryViewController(self.findBar)
>>} else if !newValue && self.findBar.parent != nil {
>>self.findBar.removeFromParentViewController()
>>}
>>}
>>}
>> 
>>func findBarViewDidChangeHeight() {
>>// Do I need to do something here?
>>}
>> 
>> }
> 
> I have no idea if what I’m doing here is even close to being right. (The 
> “accessoryView” property maps to a NSVisualEffectView that I made because I 
> thought “NSView()” was wrong at first. It made no difference.) When I try 
> running the app, creation of the first window is jammed by:
> 
>> 2017-03-28 15:33:27.659649 XNW[51906:6766586] -[NSNib 
>> _initWithNibNamed:bundle:options:] could not load the nibName: 
>> NSTitlebarAccessoryViewController in bundle (null).
>> 2017-03-28 15:33:27.677235 XNW[51906:6766586] -[NSNib 
>> _initWithNibNamed:bundle:options:] could not load the nibName: 
>> NSTitlebarAccessoryViewController in bundle (null).
> 
> Is anyone from Apple and/or has privately made a NSTextFindBarContainer class 
> capable of helping? As I said, there are no answers from WebSearch (i.e. 
> others will be helped by me). Is there Apple sample code that covers this?
> 
> — 
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> 

Re: Printing in Swift

2017-03-23 Thread corbin dunn

> On Mar 21, 2017, at 7:45 AM, David Delmonte  wrote:
> 
> Hello Group. 
> 
> I have an NSView-based app (i.e. not document-based), and I’d like to bolt on 
> a printing subsystem. I can get NSViews in my main controller to print ok. 
> However, I want to have a special view constructed just for printing. The 
> view should not show in the app’s window.
> 
> I cannot seem to figure out a way to do this.  I have tried various forms of 
> these examples:
> 
> 1. Add an NSView to my main view window? Seems logical, but it’s awkward in a 
> storyboard, (I can’t position the view in the storyboard).
> 
> 2. Programmatically create a custom NSView with a xib?
> 
> For this, I’ve tried:
> 
> @IBOutlet weak var printView: NSView!
> ….
> let printOperation = NSPrintOperation(view: printView!)
> 
> This results in the comprehensive “fatal error: unexpectedly found nil while 
> unwrapping an Optional value” message.

Sounds like printView is nil, but shouldn’t be; maybe you are loading the NIB 
wrong? What is your code? Is the Outlet hooked up?

corbin

> 
> 
> 3. A seperate ViewController? If so, how can I avoid having two print buttons 
> — one to call the print controller, and the second, to print the 
> PrintController’s view.
> 
> I’ve tried reading the Apple docs, but they are not the way I learn best. 
> I’ve waded through SE, but have come up blank. Could you point me towards a 
> solution please.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: programmatically tell when spotlight/mds is indexing

2017-03-23 Thread corbin dunn
Also, please log bugs requesting for public API to do this. Thanks!

corbin

> On Mar 23, 2017, at 9:53 AM, Saagar Jha  wrote:
> 
> I couldn’t find a public API, but Metadata.framework defines 
> _MDConfigCopyStoreInformation(NSString *path). It returns an dictionary 
> containing the key “CurrentlyScanning”, which you might find useful.
> 
> Saagar Jha
> 
>> On Mar 18, 2017, at 09:37, sqwarqDev > > wrote:
>> 
>> 
>>> On 18 Mar 2017, at 23:05, Jerome Krinock  wrote:
>>> 
>>> To generalize your question, you want to reverse-engineer some other app to 
>>> reveal some status information. I’ve had to do this a couple times.
>> 
>> Thanks for the thought, but my question was really just a sanity check to 
>> make sure that there isn’t an already existing public API I might have 
>> missed that a developer could use to query the status of mds. 
>> 
>> Any kind of guesswork about what files may or may not be open when mds is 
>> indexing would be a bit too hit and miss for what I need.
>> 
>> 
>> Best
>> 
>> 
>> Phil
>> @sqwarq

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: needsDisplay and subviews

2017-03-09 Thread corbin dunn

> On Mar 8, 2017, at 8:46 AM, Jeremy Hughes  wrote:
> 
> If needsDisplay is set to true for an NSView, does that also cause subviews 
> to be redrawn?
> 
> I’ve seen conflicting statements about this, but haven’t found anything in 
> Apple’s documentation.

Just to be clear: if you want a view to be redrawn you should call 
setNeedsDisplay on that view. That’s really the bottom line. There are some 
cases where AppKit will redraw subviews when a parent view is invalidated, but 
you should not depend on this!

I also don’t recommend things like this:

> override var needsDisplay: Bool
> {
>   willSet
>   {
>   for view in subviews
>   {
>   view.needsDisplay = newValue
>   }
>   }


Instead, it is better if your subviews invalidate themselves when their state 
changes.

corbin




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Is it possible to set an NSTableView cell background color?

2017-02-23 Thread corbin dunn

> On Feb 22, 2017, at 6:27 PM, David Delmonte  wrote:
> 
> I tried you solution but it doesn’t color the cell. Scratching my head some 
> more.. I’ll probably ask on Stack Overflow.

How did you get it to compile?  It requires a view based tableview. Your first 
step is to convert to a view based tableview.

corbin

> 
> 
>> On Feb 22, 2017, at 8:37 PM, Saagar Jha  wrote:
>> 
>> Well, assuming you have a NSTableCellView, you can set its background color 
>> using its layer. For example:
>> 
>> cell.layer.backgroundColor = NSColor.black.cgColor
>> 
>> Saagar Jha
>> 
>>> On Feb 22, 2017, at 16:14, David Delmonte >> > wrote:
>>> 
>>> Hi all, I have a table that has records by date. I want to color those 
>>> entries based on the decade.
>>> 
>>> I cannot seem to find a way to do this.
>>> 
>>> Any help would be appreciated.
>>> 
>>> David
>>> ___


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSAlert::runModal doesn't work on 10.6

2016-08-24 Thread corbin dunn

> On Aug 23, 2016, at 4:31 PM, dangerwillrobinsondan...@gmail.com wrote:
> 
> 
> 
>> On Aug 24, 2016, at 2:56 AM, Andreas Falkenhahn  
>> wrote:
>> 
>> Is that your personal opinion or is this documented anywhere?
> There's not anything to the contrary I've seen. 

Andreas is right. For you to call NSApplicationMain means you have to have a 
main nib  (or storyboard). But to be clear… NSApplicationMain just initializes 
NSApp (the instance, which is based on NSPrincipalClass), and then calls [NSApp 
run].  The main run loop is in [NSApp run]. You probably can call [NSApp run] 
without actually creating a NIB.

corbin

> Look no further than LSUIElement. 
> There is an info plist key that says you have no UI, and guess what it works 
> even if you included one. 
> There are methods for launching/activating without UI. 
> App templates have evolved over the years. 
> There wasn't always a wired up app delegate in the nib by default. It just 
> happens to be a good starting pattern most of the time. 
> You don't need an app delegate. 
> You don't need a window. 
> You are not required to have any of the default menus. 
> You don't have to provide any icon (the system will provide a default based 
> on the .app bundle UTI). 
> You only really have to have an Info plist but that can be embedded in the 
> binary, so even the app bundle is not required. 
> All this adds up to its not required. It's strongly encouraged and supported 
> because it's a great set of design patterns that facilitate good development 
> and consistent experience within the ecosystem. 
> 
> There are always folks from other language and platform backgrounds who show 
> up wanting to avoid nibs. And they can. But some things are going to be 
> incredibly hard without it. 
> 
> You do need to hang on to that main runloop created by NSApplicationMain() if 
> you want any AppKit views to work right. 
> ___
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sidebar outline view, rowSizeStyle, and bold text

2016-06-10 Thread corbin dunn

> On Jun 10, 2016, at 9:54 AM, David Catmull <davidcatm...@gmail.com> wrote:
> 
> OK, thanks. I wasn’t thinking of bold being affected by row size, but I guess 
> it makes sense that it's going to reset the font entirely.

Yeah, and if you want to have more control then don’t use the textField outlet 
(make your own), and appkit won’t do any formatting. 

corbin

> 
> On Fri, Jun 10, 2016 at 10:46 AM, corbin dunn <corb...@apple.com 
> <mailto:corb...@apple.com>> wrote:
> 
>> On Jun 10, 2016, at 7:58 AM, David Catmull <davidcatm...@gmail.com 
>> <mailto:davidcatm...@gmail.com>> wrote:
>> 
>> I have a view-based, sidebar-style NSOutlineView. For some items, I want to
>> make the text bold. But if I change the rowSizeStyle to medium instead of
>> the default (in awakeFromNib), the text doesn't display as bold. If instead
>> I use a custom row size (in outlineView:heightOfRowByItem:) it works. What
>> gives?
> 
> Let’s take a look at the header :)
> 
> typedef NS_ENUM(NSInteger, NSTableViewRowSizeStyle) {
> /* The table will use the system default layout size: small, medium or 
> large. */
> NSTableViewRowSizeStyleDefault = -1,
> 
> /* The table will use the -rowHeight or ask the delegate for a variable 
> row height (if implemented) and cell layout is not changed. */
> NSTableViewRowSizeStyleCustom = 0,
> 
> /* The table will use a row height specified for a small/medium or large 
> table.
>  It is required that all sizes be fully tested and supported if 
> NSTableViewRowSizeStyleCustom is not used.
>  Some standard Aqua metrics may be applied to cells based on the current 
> size. */
> NSTableViewRowSizeStyleSmall = 1,
> NSTableViewRowSizeStyleMedium = 2,
> NSTableViewRowSizeStyleLarge = 3,
> } NS_ENUM_AVAILABLE_MAC(10_7);
> 
> 
> So, if you set it to Small/Medium/Large then you will get some standard 
> metrics applied to things. Specifically, things setup to these outlets on an 
> NSTableCellView:
> 
> @property (nullable, assign) IBOutlet NSTextField *textField;
> @property (nullable, assign) IBOutlet NSImageView *imageView;
> 
> 
> 
> 
> 
> corbin
> 
> 
> 
> 
> 
>> 
>> I'm setting it to bold in outlineView:viewForTableColumn:item: by setting
>> view.textField.font = NSFont boldSystemFontOfSize
>> :view.textField.font.pointSize].
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto:Cocoa-dev@lists.apple.com>)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com>
>> 
>> This email sent to corb...@apple.com <mailto:corb...@apple.com>
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Sidebar outline view, rowSizeStyle, and bold text

2016-06-10 Thread corbin dunn

> On Jun 10, 2016, at 7:58 AM, David Catmull  wrote:
> 
> I have a view-based, sidebar-style NSOutlineView. For some items, I want to
> make the text bold. But if I change the rowSizeStyle to medium instead of
> the default (in awakeFromNib), the text doesn't display as bold. If instead
> I use a custom row size (in outlineView:heightOfRowByItem:) it works. What
> gives?

Let’s take a look at the header :)

typedef NS_ENUM(NSInteger, NSTableViewRowSizeStyle) {
/* The table will use the system default layout size: small, medium or 
large. */
NSTableViewRowSizeStyleDefault = -1,

/* The table will use the -rowHeight or ask the delegate for a variable row 
height (if implemented) and cell layout is not changed. */
NSTableViewRowSizeStyleCustom = 0,

/* The table will use a row height specified for a small/medium or large 
table.
 It is required that all sizes be fully tested and supported if 
NSTableViewRowSizeStyleCustom is not used.
 Some standard Aqua metrics may be applied to cells based on the current 
size. */
NSTableViewRowSizeStyleSmall = 1,
NSTableViewRowSizeStyleMedium = 2,
NSTableViewRowSizeStyleLarge = 3,
} NS_ENUM_AVAILABLE_MAC(10_7);


So, if you set it to Small/Medium/Large then you will get some standard metrics 
applied to things. Specifically, things setup to these outlets on an 
NSTableCellView:

@property (nullable, assign) IBOutlet NSTextField *textField;
@property (nullable, assign) IBOutlet NSImageView *imageView;





corbin





> 
> I'm setting it to bold in outlineView:viewForTableColumn:item: by setting
> view.textField.font = NSFont boldSystemFontOfSize
> :view.textField.font.pointSize].
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
> 
> This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSTableView is messaging zombie delegate

2016-05-10 Thread corbin dunn

> On May 6, 2016, at 1:03 PM, Matthew LeRoy  wrote:
> 
> Hello,
> 
> I'm having an issue where an NSTableView appears to be messaging its delegate 
> after the delegate has been deallocated, causing an EXC_BAD_ACCESS crash. It 
> doesn't always happen, but it happens regularly. My understanding is that 
> NSTableView's delegate is a zeroing weak reference, and so I'm stumped as to 
> how/why it is sending a message to the delegate after the delegate has been 
> deallocated.

Where does it say that? It is not a zero’ing weak reference.

corbin

> 
> The basic scenario is that my application shows a custom modal sheet which 
> contains an NSTableView. The NSWindow for the sheet is loaded from a Nib via 
> an NSWindowController, and contains (among other things) an empty NSView 
> which is a placeholder for additional UI. An NSViewController loads the 
> additional UI (which includes the NSTableView) from a separate Nib and the UI 
> is placed in the placeholder NSView within the NSWindow. The application 
> holds a reference to the NSWindowController, which holds a reference to the 
> NSViewController, which has a *weak* reference (outlet) to the NSTableView. 
> The NSTableView's delegate is its File's Owner (the NSViewController).
> 
> The crash can be made to happen simply by showing the sheet ([NSApp 
> beginSheet:...]), then immediately closing it ([NSApp endSheet:returnCode:], 
> followed by [sheet orderOut:self], [sheet close], _windowController = nil;). 
> Again, it doesn't happen every time, but when it does it appears that the 
> NSTableView sends -respondsToSelector: to its delegate, even though the 
> delegate (the NSViewController) has been deallocated. Here's the stack trace 
> from the crash log:
> 
> Application Specific Information:
> objc_msgSend() selector name: respondsToSelector:
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libobjc.A.dylib 0x7fff9267d4dd objc_msgSend + 29
> 1   com.apple.AppKit0x7fff975fa76d -[NSTableRowData 
> _removeViewAndAddToReuse:forRow:] + 163
> 2   com.apple.CoreFoundation0x7fff98e11496 
> __65-[__NSDictionaryM 
> enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
> 3   com.apple.CoreFoundation0x7fff98e11389 -[__NSDictionaryM 
> enumerateKeysAndObjectsWithOptions:usingBlock:] + 185
> 4   com.apple.AppKit0x7fff9779941c -[NSTableRowData 
> _removeNonVisibleViewsInDictionary:] + 88
> 5   com.apple.AppKit0x7fff9753900c -[NSTableRowData 
> _removeRowsBeingAnimatedOff] + 60
> 6   com.apple.Foundation0x7fff84a09b4e 
> __NSFireDelayedPerform + 377
> 7   com.apple.CoreFoundation0x7fff98e1cb94 
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
> 8   com.apple.CoreFoundation0x7fff98e1c823 __CFRunLoopDoTimer 
> + 1075
> 9   com.apple.CoreFoundation0x7fff98e1c37a 
> __CFRunLoopDoTimers + 298
> 10  com.apple.CoreFoundation0x7fff98e13871 __CFRunLoopRun + 
> 1841
> 11  com.apple.CoreFoundation0x7fff98e12ed8 
> CFRunLoopRunSpecific + 296
> 12  com.apple.HIToolbox 0x7fff882f7935 
> RunCurrentEventLoopInMode + 235
> 13  com.apple.HIToolbox 0x7fff882f7677 
> ReceiveNextEventCommon + 184
> 14  com.apple.HIToolbox 0x7fff882f75af 
> _BlockUntilNextEventMatchingListInModeWithFilter + 71
> 15  com.apple.AppKit0x7fff97431df6 _DPSNextEvent + 
> 1067
> 16  com.apple.AppKit0x7fff97431226 -[NSApplication 
> _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
> 17  com.apple.AppKit0x7fff97425d80 -[NSApplication 
> run] + 682
> 18  com.apple.AppKit0x7fff973ef368 NSApplicationMain 
> + 1176
> 19  libdyld.dylib   0x7fff984505ad start + 1
> 
> I've reproduced the crash using the Zombies template in Instruments, and it 
> indicates that the NSViewController is indeed the zombie object that is being 
> sent the -respondsToSelector: message.
> 
> I've pored over the retain/release log in Instruments for the 
> NSViewController instance and everything appears to be in order - in order 
> words, I don't think I'm over-releasing it. Based on my debugging, the 
> NSTableView appears to be living on well after the NSWindowController has 
> been released and deallocated (which causes the NSViewController to also be 
> released and deallocated). I would've expected that the NSTableView would be 
> deallocated before the NSViewController or NSWindowController since I'm not 
> holding any references to it elsewhere, but it appears it isn't deallocated 
> until later (I have confirmed that it is in fact being deallocated 
> eventually). Still, even if the NSTableView outlives its delegate, shouldn't 
> the delegate reference 

Re: Faster scrolling after resizing window

2016-01-21 Thread corbin dunn
That doesn’t make much sense. Try comparing samples before and after. What is 
different?

corbin

> Il giorno 17 gen 2016, alle ore 5:16 AM, Martin Huber  
> ha scritto:
> 
> I have a strange problem in my application (on 10.11, but I don't know 
> whether that's important). After opening a document, scrolling in the 
> document is a bit sluggish. But after resizing the document window with the 
> mouse or maximizing it by Alt+click on the green title bar button, scrolling 
> is a lot faster.
> 
> Resizing the window by code with -[NSWindow zoom:] and -[NSWindow 
> setFrame:display:animate:YES] speeds up scrolling, too, but -[NSWindow 
> setFrame:display:animate:NO] doesn't.
> 
> The document window uses a subclass of NSView for displaying its content and 
> doesn't have any layers.
> 
> Does anybody know what  -[NSWindow zoom:] and -[NSWindow 
> setFrame:display:animate:YES] might change at the window, so that following 
> scrolls are faster?
> 
> Martin
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
> 
> This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: -clickedRow

2015-11-06 Thread corbin dunn

> On Nov 5, 2015, at 12:51 PM, Jens Alfke  wrote:
> 
> 
>> On Nov 5, 2015, at 12:35 PM, Raglan T. Tiger  wrote:
>> 
>> In -rightMouseDown I call [self clickedRow] which always returns -1 in a row 
>> or not in row
> 
> Yeah, you’re getting control before the base class has had a chance to set 
> the clickedRow property. (Have you tried calling the superclass method first? 
> That might help.)

Plus, NSTableView only sets it on mouseDown:. (well, it does it at a few other 
key points, but not rightMouseDown)

corbin

> 
>> What should I be doing to get the clicked row?
> 
> Convert the position to local coords, then call -rowAtPoint:.
> 
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
> 
> This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Responsive scrolling control with lots of subviews

2015-03-04 Thread Corbin Dunn

 On Mar 2, 2015, at 10:26 AM, Ben ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 
 On 2 Mar 2015, at 17:42, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Mar 2, 2015, at 02:44 , Ben ben_cocoa_dev_l...@yahoo.co.uk 
 mailto:ben_cocoa_dev_l...@yahoo.co.uk wrote:
 
 Since NSCell is apparently on the way out, I've been trying to build a new 
 control I need using views. It's a cut-down spreadsheet-alike grid
 
 I don’t see that anyone has yet asked the question of why the grid needs to 
 have subviews. Implementing the rows and columns yourself means inventing 
 your own duplicate API for managing them, but it’s likely not a lot of code, 
 assuming you only need textual editing of one cell at a time (and can 
 therefore use a single re-usable, movable text field for the editing).
 
 So, why can’t your spreadsheet-like grid be a single custom view that draws 
 its own text and graphics in a grid-like pattern directly?
 
 PS. I have tried using/subclassing NSTableView and have filed a bug for the 
 functionality that I'm after
 
 Purely for interest’s sake, can you tell us what functionality is missing, 
 for your use-case?
 
 
 
 I hadn't considered asking my delegate for text and images directly. That 
 could be a simpler way to do things - I will look into it.
 
 
 The functionality that I'm missing is:
 
 - Granularity of selection. For example single or multiple disconnected 
 cells. NSTableView only gives me row or column.
 - Scrollable floating headers on both axis. This I did sort-of manage with 
 NSTableView by styling the first column to look like a header, but it was not 
 great.

Did you indeed log bugs for these requests? I haven’t seen any come in for 
them. Please give me the radar #’s.

thanks!

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: titlebar accessory? window:willPositionSheet:usingRect: not called in full-screen mode

2015-03-04 Thread Corbin Dunn

 On Feb 27, 2015, at 2:26 PM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 
 On Feb 27, 2015, at 9:24 AM, Corbin Dunn corb...@apple.com wrote:
 
 
 On Feb 25, 2015, at 9:40 AM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 Great, because that's exactly what I'm using it for
 
 The toolbar case or the certain control one? When you're in fullscreen 
 mode, the toolbar isn't actually attached to your window. It's attached to 
 a separate one so it can slide down with the menubar. But if it’s the 
 control, it wouldn't surprise me if Apple forgot they'd mentioned that 
 option and didn't think about it when they decided whether this delegate 
 method needed to be called.
 
 This was thought about. The delegate isn’t called because, as you all noted, 
 the sheet is appearing in another window that the application doesn’t own. 
 AppKit takes care of drawing the titlebar, toolbar, and titlebar accessory 
 views (new to 10.10). Sheets are designed to drop below all these, and move 
 with the window when the menu bar drops down.
 
 
 titlebar accessory? oooh.
 
 ... some hours later: Is there any way to configure its autolayout so it 
 doesn't overlap the title text, and especially the buttons?


For an item that is set to align to NSLayoutAttributeBottom, we assume whatever 
height you set is preferred, and fill the width to be the width of the window.

For an item that is set to align to NSLayoutAttributeRight, we assume whatever 
width you set is preferred, and fill the height to match the height of the 
titlebar area. 

So, armed with that info, just don’t set the width to be large enough to 
overlap the window title text.

-corbin

PS: thank you for logging the bugs on this
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: window:willPositionSheet:usingRect: not called in full-screen mode

2015-02-27 Thread Corbin Dunn

 On Feb 27, 2015, at 12:14 AM, Arjan van Leeuwen arj...@opera.com wrote:
 
 On Thu, Feb 26, 2015 at 2:45 PM, Uli Kusterer witness.of.teacht...@gmx.net
 wrote:
 
 On 25 Feb 2015, at 15:47, Arjan van Leeuwen arj...@opera.com wrote:
 This method is useful in many situations. If your window has a toolbar,
 for
 example, you can specify a location for the sheet that is just below
 it. If
 you want the sheet associated with a certain control or view, you could
 position the sheet so that it appears to originate from the object
 (through
 animation) or is positioned next to it.
 
 Great, because that's exactly what I'm using it for :). However, when my
 app is in full-screen mode, this function never gets called. Other
 related
 delegate functions, like windowWillBeginSheet: and windowDidEndSheet: do
 get called correctly on the delegate, so the delegate is obviously still
 there and as far as I can see should be receiving a call to
 window:willPositionSheet:usingRect:.
 
 I wonder whether Apple's UI team know of this documentation. Positioning
 a sheet next to any other UI element seems totally wrong for everything
 we've seen in Mac UI so far. Especially given 10.7 introduced pop-overs,
 which are designed exactly for that purpose and are not modal (or rather,
 cancel their mode when you click outside them, at least by default).
 
 Are you sure it is a good idea to use a sheet for something like that? It
 sounds more like a job for a popover, which also handles much more of the
 required behaviour automatically.
 
 
 I'm pretty sure a popover is not the way here, although a windowed dialog
 could be possible :). This is a browser, and we're talking about the dialog
 for saving a web page. That dialog is supposed to be either a sheet or a
 windowed dialog, and since it's attached in this case to a specific tab of
 the browser, we think it should be a sheet. And since it's related to a
 specific tab, we expect it the sheet to appear attached to that tab (or
 'originating from it' to use the language of the documentation), not
 outside of it.
 
 It seems that only Safari has figured out the secret to making the sheet
 appear in the right place in full-screen mode as well as in windowed mode,
 in other applications I see behavior similar to what happens in our
 application (the sheet is well-positioned in windowed mode but hangs around
 at its standard location in full-screen mode).

Safari uses the standard API. In particular, titlebarAccessoryViewControllers. 
These almost entirely alleviate the need for custom sheet positioning. 

The case where they don’t work is for a borderless window where you are drawing 
your own titlebar controls. 


Also, please be running the latest OS 10 SU, as some things have been fixed in 
this area of sheet positioning, mainly with people who use a custom 
contentBorderThicknessForEdge. 


corbin

 
 
 
 Does anyone know what I can do to make the framework call
 window:willPositionSheet:usingRect:, even in full-screen mode? Or if not,
 what other way should I use to position the sheet that will work in all
 situations?
 
 Fullscreen has a lot of assumptions about your window. We have a custom
 window title bar, yet when we're in fullscreen, the OS draws a fake
 standard title bar and toolbar for us floating above the window when you
 show the menu bar. Given you can't even inhibit that, I'm not surprised
 that they would also show sheets in the standard location relative to these
 fake window decorations.
 
 
 Yes, I'm aware of that, and it makes some sense. Still would be nice to
 know if I could customize it somehow though.
 
 Thanks for your replies,
 
 Arjan
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: window:willPositionSheet:usingRect: not called in full-screen mode

2015-02-27 Thread Corbin Dunn
 
 Fullscreen has a lot of assumptions about your window. We have a custom 
 window title bar, yet when we're in fullscreen, the OS draws a fake 
 standard title bar and toolbar for us floating above the window when you 
 show the menu bar. Given you can’t even inhibit that, I'm not surprised that 
 they would also show sheets in the standard location relative to these fake 
 window decorations.


Please log bugs if you want to inhibit this, and please describe exactly why 
and what you are trying to do.
corbin


 
 Sorry I'm not of more help,
 -- Uli
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: window:willPositionSheet:usingRect: not called in full-screen mode

2015-02-27 Thread Corbin Dunn

 On Feb 25, 2015, at 9:40 AM, Lee Ann Rucker lruc...@vmware.com wrote:
 
 Great, because that's exactly what I'm using it for
 
 The toolbar case or the certain control one? When you're in fullscreen 
 mode, the toolbar isn't actually attached to your window. It's attached to a 
 separate one so it can slide down with the menubar. But if it’s the control, 
 it wouldn't surprise me if Apple forgot they'd mentioned that option and 
 didn't think about it when they decided whether this delegate method needed 
 to be called.

This was thought about. The delegate isn’t called because, as you all noted, 
the sheet is appearing in another window that the application doesn’t own. 
AppKit takes care of drawing the titlebar, toolbar, and titlebar accessory 
views (new to 10.10). Sheets are designed to drop below all these, and move 
with the window when the menu bar drops down.


Arjan: 

 Does anyone know what I can do to make the framework call
 window:willPositionSheet:usingRect:, even in full-screen mode?

Yes, I know, and the answer is no, you can’t in full screen mode get that 
delegate call.


 Or if not,
 what other way should I use to position the sheet that will work in all
 situations?

You shouldn’t have to… can you describe exactly what you are trying to do and 
log a bug requesting we start calling the delegate? Pictures would be extremely 
helpful in a case like this.

corbin





 
 
 From: cocoa-dev-bounces+lrucker=vmware@lists.apple.com 
 [cocoa-dev-bounces+lrucker=vmware@lists.apple.com] on behalf of Arjan van 
 Leeuwen [arj...@opera.com]
 Sent: Wednesday, February 25, 2015 6:47 AM
 To: cocoa-dev@lists.apple.com
 Subject: window:willPositionSheet:usingRect: not called in full-screen mode
 
 Hi,
 
 To open a save file sheet, I'm starting an NSSavePanel as a sheet
 via beginSheetModalForWindow:completionHandler:. Because my application
 needs custom positioning for the sheet, the window delegate of my main
 window overrides window:willPositionSheet:usingRect:. According to the
 documentation, this
 
 Tells the delegate that the window is about to show a sheet at the
 specified location, giving it the opportunity to return a custom location
 for the attachment of the sheet to the window.
 
 
 And
 
 This method is useful in many situations. If your window has a toolbar, for
 example, you can specify a location for the sheet that is just below it. If
 you want the sheet associated with a certain control or view, you could
 position the sheet so that it appears to originate from the object (through
 animation) or is positioned next to it.
 
 
 Great, because that's exactly what I'm using it for :). However, when my
 app is in full-screen mode, this function never gets called. Other related
 delegate functions, like windowWillBeginSheet: and windowDidEndSheet: do
 get called correctly on the delegate, so the delegate is obviously still
 there and as far as I can see should be receiving a call to
 window:willPositionSheet:usingRect:.
 
 Does anyone know what I can do to make the framework call
 window:willPositionSheet:usingRect:, even in full-screen mode? Or if not,
 what other way should I use to position the sheet that will work in all
 situations?
 
 Thanks,
 
 Arjan
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: All buttons lost focus ring on Yosemite

2015-02-16 Thread Corbin Dunn

 On Feb 12, 2015, at 6:40 AM, Dragan Milić mi...@mac.com wrote:
 
 I’m dealing with a rather strange issue. When running my application on 
 Yosemite, all buttons lose focus ring (when having focus). When I say all, I 
 mean absolutely ALL buttons, even those in standard alert panels and sheets. 
 I can move focus between buttons using keyboard without any problem (provided 
 that pressing tab is set to move focus between “All controls” in the Keyboard 
 System Preferences), it’s just that a button currently having focus doesn’t 
 draw its focus ring. Focus rings of text fields and lists are drawn as 
 expected.
 
 When running exactly the same application bundle under Mavericks (and 
 earlier), everything seems fine, button focusses are shown as expected. I’d 
 really appreciate any help in solving this mysterious problem. Thanks in 
 advance.

Sounds like you have added a bad category on NSButton, NSButtonCell, NSControl 
or NSView that overrides some default behavior.

corbin

 
 — Dragan
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: dealloc query for NSTableCellView

2015-02-05 Thread Corbin Dunn

 On Feb 4, 2015, at 5:43 AM, Jonathan Mitchell jonat...@mugginsoft.com wrote:
 
 
 On 4 Feb 2015, at 13:27, Roland King r...@rols.org wrote:
 
 If I have an observation pattern which is set up, and the previous one torn 
 down, in setXXX:(id)xxx like you do then my dealloc usually goes
 
 [ self setXXX:nil ]
 
 which both removes the observers and sets the property to nil so it doesn’t 
 happen again. 
 
 Your problem here seems to be that you’ve tied the property to the observers 
 in the set, but you are removing the observers without nil’ing the property 
 in dealloc, thus leaving yourself open to another setter getting called. 
 Thanks.
 
 That approach does work in this case.
 I don’t particularly like it in general because (in the more generic 
 NSViewController case) it calls back into a core method generally used to 
 help setup an instance.
 Calling this in a habitual sense from -dealloc feels sort of wrong!
 
 
 
 Crucially I find that in this case after my subclass -dealloc the 
 superclass -dealloc calls -setObjectValue : nil which causes observation 
 warnings to be issued (I always try and clear these types of issues because 
 at the very least they mask real problems) as _objectValue will still be 
 non nil and [self removeObservers] gets called again.
 
 
 Is it normal for superclasses to message during dealloc?
 
 I would still like to know what people’s expectations are here.

It is quite normal and done in a lot of places. 

FWIW, NSTableCellView’s dealloc looks like this:

- (void)dealloc {
self.objectValue = nil;
self.imageView = nil;
self.textField = nil;
[_aux release];
[super dealloc];
}

All the properties are @synthesized.

corbin


 
 Thanks
 
 J
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSThread

2015-01-13 Thread Corbin Dunn

 On Jan 13, 2015, at 9:57 AM, Mike Abdullah mabdul...@karelia.com wrote:
 
 
 On 13 Jan 2015, at 16:18, Mike Abdullah mabdul...@karelia.com wrote:
 
 
 On 13 Jan 2015, at 16:07, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 I allocate and init an NSThread as follows:
 
  if ( m_mythread ) [m_mythread cancel];
  m_mythread = [[MYThread alloc] initWithTarget:m_mythread 
 selector:@selector(start) object:m_anobject];
  [m_mythread start];
 
 Looking closer, I have to wonder what you think this code will do. You seem 
 to be trying to create a thread that will message *itself* to do its work.

Not only that, but I bet it infinite loops restarting itself. 

1. Use init, not initWithTarget.
2. Override -main to do your threaded work.

corbin


 At the time this code is executed, m_mythread will either be nil, or will 
 point to an older thread instance that you’re about to supersede.
 
 I think you need to take a step back and evaluate your app design. What are 
 you actually trying to accomplish here? Would using NSOperationQueue or GCD 
 better suit your needs?
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Request for guidance re. CALayer

2015-01-07 Thread Corbin Dunn

 On Jan 7, 2015, at 7:02 AM, Luc Van Bogaert luc.van.boga...@me.com wrote:
 
 Hello,
 
 I’ve been working on a drawing app for OS X in Objective-C for personal 
 educational purposes. Thanks to the help I’ve received from various people in 
 this list, this is coming along very nicely, but now I am once again calling 
 for your help on a more complex subject.
 
 My aim for this app is to provide some kind of “layer” functionality. I’ve 
 already implemented a Layer class as an NSObject subclass, and I also have a 
 panel to manage Layer objects, including creation, deletion, renaming, 
 reordering, editing various attributes (locked, hidden, etc.).
 
 I also have implemented a custom view class CanvasView representing the app’s 
 drawing canvas. I realise I could do all the drawing using this view’s 
 drawRect: method. But somehow I keep having this feeling that I should pursue 
 the usage of CALayer objects, possibly using them to form a composite object 
 as part of my Layer class. What I have been trying to do so far is adding a 
 CALayer property to my Layer class, so I can add a real CALayer object as a 
 sublayer in my custom CanvasView reating a one-on-one relation between my 
 Layers (that would contain the graphics data) and real CALayer objects (to 
 display the graphics). I have assigned the Layer object as the CALayer 
 object’s delegate…
 I’m exactly not sure why, but to me this seems to be a good strategy for 
 performance considerations and possibly offering other advantages later on...
 
 However, I am not at all sure if this is the best route to take, so I would 
 welcome any help or recommendations on this.
 
 Wether or not this is the best approach for my drawing app, I could also use 
 some basic expert advise on Core Animation programming in general, and 
 specifically on the usage of the CALayer class. I’ve read some of Apple’s 
 docs and I will read them again and again, but maybe someone here could 
 summarise some important basic concepts for me or touch on some 
 misconceptions that beginners should watch out for.
 
 For instance, I have already been able to create and add sublayers to a 
 layer-backed view, but it is still unclear to me how to draw graphic content 
 in these layers. I know that there are various methods, but I still don’t 
 have a clear picture of how layers generally fit together with custom views. 
 I’ve read about the CALayer delegate property and the drawLayer:inContext: 
 method, but I’m not sure who, when or how this method should be called.
 
 Thanks for any help,


Hi Luc,

You don’t need to go directly to using CALayers, and in fact, I don’t recommend 
this. You can still get the power of CoreAnimation by using layer-backed 
NSViews. On your view that contains the majority of your subviews (i.e.: your 
“drawing layers”), call setWantsLayer:YES. All subviews will now be 
layer-backed. 

Each virtual layer that you want the user to draw into should be a custom 
NSView subclass. Each of these views should override drawRect: and implement 
the drawing for that particular layer.

Under the hood, AppKit sets the delegate and implements drawLayer:inContext:, 
and call your NSView’s drawRect:.

If you need to access specific CALayer properties, ideally use the NSView cover 
methods (such as compositingFilter, backgroundFilters, etc), but you can 
fallback to directly setting the view.layer property yourself. Just be careful, 
as AppKit “owns” certain properties (frame, bounds, position, flipped, etc).

-corbin

 
 -- 
 Luc Van Bogaert
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSOutlineView click and bug

2015-01-07 Thread Corbin Dunn
Hi Leornardo,

Please log this as a bug. You are running Mac OS 10.10, right?

corbin

 On Jan 7, 2015, at 1:01 AM, Leonardo mac.iphone@gmail.com wrote:
 
 Hi, I'm struggling with a singular trouble.
 In my window I have put an NSOutlineView and a NSScrollView containing a
 NSClipView containing an NSView.
 
 I subclassed the NSClipView and overrided the magnifyWithEvent method.
 This way I can better control the zooming of the clipView and its
 documentView. It works pretty well.
 
 The trouble comes when I click on a row of the outlineView, then I pinch and
 zoom the clipView. The zoom occurs so slowly... No matter whether I click
 later. Even if I set the clipView or the documentView as first responder,
 the zoom keeps on occurring so slowly. The only way to get back the correct
 zoom speed is to activate a different application then re-activate my
 application. And the zoom works well again. No matter whether the
 outlineView is still the firstResponder.
 
 So, what should I look for to fix this bug?
 
 
 Regards
 -- Leonardo
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Blurry is the New Sharp

2015-01-05 Thread Corbin Dunn
 
 My app will have a source view, so I'd like to know if there's a way to tell 
 the window server to use only the desktop image to create vibrancy effects in 
 a the sidebar, ignoring any other windows which may lie between my app and 
 the desktop.  

This is not possible.

corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSVisualEffectView NSVisualEffectBlendingModeBehindWindow transparency

2015-01-05 Thread Corbin Dunn

 On Dec 26, 2014, at 2:26 AM, Jacek Oleksy jole...@opera.com wrote:
 
 Hi,
 I add vibrancy effect to my window using the following code:
 
 In the view class:
 - (void)awakeFromNib {
 NSVisualEffectView* vibrantView = [[NSVisualEffectView alloc]
 initWithFrame:self.frame];
 vibrantView.appearance = [NSAppearance
 appearanceNamed:NSAppearanceNameVibrantLight];
 [vibrantView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
 [self addSubview:vibrantView];
 }
 
 It uses default blending mode (which is
 NSVisualEffectBlendingModeBehindWindow), and this is what I need.
 
 Problem: the vibrancy effect goes right to the bottom of the desktop,
 i.e. the color of desktop background color shines through (even if
 there are some other windows in the way!).

This is the explicit HI design; it includes a certain percentage of the desktop 
image in the blur.

 
 The effect that I need is to have the transparency effect include only
 the top visible window, this is how NSPopover works:
 
 In view controller:
 @interface PopoverController : NSViewController {
 }
 @end
 @implementation PopoverController
 - (void)loadView {
self.view = [[NSView alloc] initWithFrame:NSMakeRect(10,10,100,100)];
 }
 @end
 - (void) viewDidAppear {
NSPopover* popover = [[NSPopover alloc] init];
PopoverController* controller =[[PopoverController alloc] init];
[popover setContentViewController:controller];
[popover setBehavior:NSPopoverBehaviorTransient];
[popover showRelativeToRect:self.view.bounds ofView:self.view
 preferredEdge:NSMaxYEdge];
 }
 
 The popup that is created gets the vibrancy effect only from the
 window that is right below it.
 
 Any ideas on how to make it work for custom window?

There is not any API to control this option. Please log a bug requesting this 
ability.

Thanks,
corbin


 
 Thanks,
 Jacek
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSOutlineView not lazy when expanding items :(

2014-09-18 Thread Corbin Dunn

 On Sep 16, 2014, at 4:48 PM, Jerry Krinock je...@ieee.org wrote:
 
 
 On 2014 Sep 16, at 15:23, Kyle Sluder k...@ksluder.com wrote:
 
 I'd try wrapping things in an NSAnimationContext with 
 allowsImplicitAnimation=NO. Though I'm not sure where you would have the 
 opportunity to wrap the built-in expand behavior.
 
 Yes, I’ve never understood “graphics contexts” and its new friend 
 NSAnimationContext.  They seem like these magic singletons that just exist in 
 the ether.  Anyhow, I tried doing this…
 
[[NSAnimationContext currentContext] setAllowsImplicitAnimation:NO] ;
 
 both in -applicationDidFinishLaunching and in 
 -outlineView:numberOfChildrenOfItem:.  The latter is about the last thing 
 that happens before the data source becomes deluged with messages on all 
 items.  There was no effect.
 
 I also looked at the NSTableViewAnimationOptions stuff suggested by Jens, but 
 the only place to plug that in is in the -insertRows… and -removeRows… 
 methods, and the documentation indicates that these options are all about 
 view-based tables.
 
 Finally, I did a video capture on the animation so I could look at it 
 frame-by-frame to see what was going on.  Interestingly, when there are 1000 
 rows to be expanded but only 10 will fit in the window, the animation starts 
 by drawing the tenth item at the top, then moves it down, and then the other 
 nine progressively do the same.  So, the animation should not be a cause for 
 fetching the bottom 990 items.
 
 Conclusion: I don’t think this has anything to do with animation.
 
 * * *
 
 Weird that here we are with the Apple Watch and Swift, and old NSOutlineView 
 still doesn’t work as it should.

Have you logged a bug on this issue? It will not likely get fixed unless you 
report it.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: How to change highlight colour on NSTableView row

2013-10-22 Thread Corbin Dunn

On Oct 22, 2013, at 5:36 AM, Darren Wheatley dar...@tenjinconsulting.co.uk 
wrote:

 Hi,
 
 Thanks for the reply.
 
 I tried the code sample you suggested but can't get it to work.
 
 When running the default highlighting is being layered on top of this custom 
 highlighting (I can see part of the custom highlighting where the rects are 
 not quite overlapping). Do you know how I prevent the standard formatting 
 from being displayed?

Your cell is drawing that part; Override:

- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView 
*)controlView;

and return nil as an easy work around.

 
 Also, (might be a symptom of the above) the custom highlighting is not always 
 removed when I click on a new row. If I scroll those rows off the screen and 
 back on the highlighting is fixed, so there is some sort of display refresh 
 problem.

If you are drawing outside of the “normal” highlight area, then you are 
responsible for invalidating it when selection changes.

corbin

 
 I have tried standard and source list highlighting (set in the xib), and both 
 display the same behaviour.
 
 Do you know what might be going on here, or anything I should check in my 
 code? Any suggestions you could make would be very much appreciated.
 
 FYI, I am developing on 10.8.5 and targeting 10.7.
 
 Regards
 
 Darren.
 
 
 
 On 21 Oct 2013, at 17:23, jonat...@mugginsoft.com wrote:
 
 On 21 Oct 2013, at 16:19, Darren Wheatley dar...@tenjinconsulting.co.uk 
 wrote:
 
 Hi,
 
 I have a custom subclass of NSTableView in my app.
 
 Can anyone suggest a method that will allow me to set a custom highlight 
 colour on on a row when the user clicks on it?
 
 I've Googled for a solution, but haven't been able to find anything that 
 works.
 
 
 For cell based tables try:
 
 - (void)highlightSelectionInClipRect:(NSRect)clipRect
 
 There is a sample implementation at 
 http://stackoverflow.com/questions/7038709/change-highlighting-color-in-nstableview-in-cocoa.
 You may need to set selectionHighlightStyle to 
 NSTableViewSelectionHighlightStyleSourceList
 
 Note: This method should not be subclassed or overridden for a view-base 
 table view. Instead, row drawing customization should be done by subclassing 
 NSTableRowView.
 
 Jonathan
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk
 
 This email sent to dar...@tenjinconsulting.co.uk
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSOutlineView Travails

2013-05-02 Thread Corbin Dunn

On Apr 17, 2013, at 2:09 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Apr 17, 2013, at 10:50 , Gordon Apple g...@ed4u.com wrote:
 
 We are converting tables and outlines to view-based.  So far, so good, on
 tables.  But NSOutlineView has been a pain.  First of all, there is no
 documentation on this, zero, zip, nada, zilch, in the NSOutlineView
 Reference.  You have to rely on sample code and NSOutlineView.h.
 
 Yup, the documentation situation for NSOutlineView is awful.

You should log bugs at bugreporter.apple.com asking for specific things you 
would like to see better. Please be specific; general statements like X is 
terrible don't help us know what you are wanting to know. A better thing would 
be to say I don't understand how to begin editing in NSOutlineView.. or it 
took me a long time to figure out XX, and it should be documented.

corbin

 
 Our outline view has a column/cell identifier ³LineNumber², one for
 ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
 NSTreeController.  Converting to views (yes, using
 outlineView:viewForTableColumn:item:), we could not even get the nib to
 load.  ObjectValue always came up nil.  We tried binding the tableView to
 the tree controller ‹ still nil.  
 
 You can't try binding here. If you're using a data source, you don't bind 
 the outline view to the tree controller, and in that case you need to set 
 view.objectValue to the desired object before returning from 
 'outlineView:viewForTableColumn:item:'.
 
 Otherwise, you *must* bind the outline view's content binding to the tree 
 controller, and the outline view should then maintain objectValue for you. 
 (But since I always use data sources these days, I can't swear that this is 
 precisely correct.)
 
 Ok, after examining sample code, we
 decided that just maybe there was something magic about the column/cell
 identifier ³MainCell², so we changed our third column/cell identifier and
 replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
 loads.  However, still no values.
 
 Since you're talking about loading nibs, I assume you've got code to register 
 the nib, and I bet you forgot to ensure that the nib is registered with with 
 the identifier that matches what you're actually using.
 
 If I remember the details correctly, you're going to invoke 
 'makeViewWithIdentifier:owner:' inside 
 'outlineView:viewForTableColumn:item:'. When you're using registered nibs, 
 you must use the identifier that the nib is registered under, and the 
 identifier assigned to the built-in cell view (that you're not using) is 
 irrelevant. When you're using the built-in cell view, you must use its 
 identifier, of course.
 
 The column identifier is basically unrelated, unless you *choose* to 
 configure it to match the actual cell view identifier. The table view 
 documentation assumes this is desirable, but I've never found it makes 
 anything much easier. All it does is provide the opportunity for things to 
 get out of sync, as you discovered.
 
 Even worse, the turn-down dingy appears
 in the first column, not the third where we want it.  It does turn down the
 right number of times and depths to match our outline, but is in the wrong
 place and no values.
 
 So how do I get the outline back into the third column and get my
 objectValues to work?
 
 Are you sure you aren't inadvertently returning a group row view, or a 
 full-row view?
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSOutlineView Travails

2013-05-02 Thread Corbin Dunn

On Apr 21, 2013, at 11:51 AM, Gordon Apple g...@ed4u.com wrote:

 Our view-based NSOutlineView still has a few annomalies, but mostly works.
 Now, we are attempting to install a hoverView in our outline column to
 launch a popover (display only) when mousing over a row.  This works just
 fine with NSTableViews, but so far does not work at all with NSOutlineView.
 We had hoped this would not be a problem because NSOutlineView is a subclass
 of NSTableView.  Our theory is that because the presence of turn-down
 buttons in the outline view, there must be an additional intervening view
 that handle this and related layout issues within the cell.  Has anyone
 successfully used a hoverView with NSOutlineView?

No, there isn't any additional intervening of the views. Visually, the view 
based NSOutlineView is a super-thin wrapper around NSTableView to add 
indentation and a disclosure triangle. If it works in NSTableView, it will work 
in NSotulineView, and something else is likely wrong.

Things that would be useful to know:
1. How you are trying to show a popover. (i.e.: relevant code)
2. When you are doing it, and when is it not happening

 
 BTW, a word to the wise.  Bindings to arrayControllers through a
 viewController¹s representedObject is still problematic.  We have filed bug
 reports on this in the past (confirmed bug).

What is the radar you logged for this?

NSTableView and NSOutlineView doesn't use a viewController.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Field editor in view-based table

2013-05-02 Thread Corbin Dunn

On Apr 12, 2013, at 10:58 PM, Martin Hewitson martin.hewit...@aei.mpg.de 
wrote:

 Dear list members,
 
 I have an NSTextField in a row view of a view-based tableview and I see the 
 following behavior:
 
 1)  to get the field editor to show I have to single click the text field and 
 wait about 1s.  
 2) The field editor only shows if I click on a part of the text field where 
 this is text already, but if I click to the right of the current text (but 
 still within the text field) nothing happens. 
 3) Double-clicking directly in the textfield does nothing.
 4) If the row is not selected, and I single click in the textfield, the row 
 is selected, but the field editor is not shown
 
 Is this all expected behaviour? I've tried googling but don't find much 
 discussion on view-based tableviews apart from the examples from Apple. Is 
 there some magic I can do to make the textfield subviews respond (show a 
 field editor) more promptly?
 
 It makes the UI very unresponsive.

Yes, this is expected, and it is the way Finder also works. Well, finder's 
double click action is set to open the file/app.

corbin





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView Travails

2013-05-02 Thread Corbin Dunn

On May 2, 2013, at 3:15 PM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On May 2, 2013, at 14:52 , Corbin Dunn corb...@apple.com wrote:
 
 On Apr 17, 2013, at 2:09 PM, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 On Apr 17, 2013, at 10:50 , Gordon Apple g...@ed4u.com wrote:
 
 We are converting tables and outlines to view-based.  So far, so good, on
 tables.  But NSOutlineView has been a pain.  First of all, there is no
 documentation on this, zero, zip, nada, zilch, in the NSOutlineView
 Reference.  You have to rely on sample code and NSOutlineView.h.
 
 Yup, the documentation situation for NSOutlineView is awful.
 
 You should log bugs at bugreporter.apple.com asking for specific things you 
 would like to see better. Please be specific; general statements like X is 
 terrible don't help us know what you are wanting to know. A better thing 
 would be to say I don't understand how to begin editing in NSOutlineView.. 
 or it took me a long time to figure out XX, and it should be documented.
 
 Yes, I know. But Gordon already said the specific thing: there is no 
 documentation on [view-based outline views], zero, zip, nada, zilch.
 
 This isn't just about programming guides. The delegate method 
 'outlineView:viewForTableColumn:item:' isn't even mentioned in the 
 NSOutlineViewDelegate protocol reference documentation. Zero, zip, nada, 
 zilch.
 
 Under the circumstances, I think it's a little hilarious to be asked to 
 meticulously bug-report what will 'help us know what you are wanting to 
 know.

There isn't zero documentation; 95% of the functionality comes from 
NSTableView, which is well documented. The outline view methods are really just 
cover methods for the NSTableView ones. 

But like I said, please log a bug requesting it be documented. Your specific 
case here would be to document the view based outline view delegate methods.  
But to be fair, the header is fairly verbose (well, terse in the case for those 
methods...because they are just cover methods  as I said).

corbin




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView Travails

2013-05-02 Thread Corbin Dunn

On May 2, 2013, at 3:44 PM, Gordon Apple g...@ed4u.com wrote:

 We did get a customRowView to work in the TableViewPlayground sample.  The 
 popover showed a simple color image view with some text that displayed the 
 row number.  As you mouse over the outline, any previous popover closes and a 
 new one appears at the edge of the outline/table view row.
 
 I filed a request to document the view-based methods for NSOutlineView.
 
 Our outlines and tables are contained in view nibs using view controllers.  
 For the tables, the array controllers are chained in the view-nib containing 
 the tables-view nibs, so each table is bound to an array controller outside 
 its own nib.  Binding it through the view controller’s representedObject (set 
 to the appropriate array controller) doesn’t work, so we just bound them 
 directly in the master view-nib’s view controller code.
 
 In our own code, the customRowView proved deadly.  We are currently engaged 
 in a TSI to try to resolve this and the other issues.
 
 BTW, DTS asked for a complete project. We were going to send in our project 
 code, until we went back and read the Apple, Inc. Developer Agreement.  Not 
 only is there no NDA or intellectual property protection for developers, it 
 explicitly (essentially) states that, once you send it in, they can do 
 anything they darn well want to with it.  So we are now trying to reproduce a 
 project with only that slice of code in it.  Beware!  As someone who is very 
 experienced with the patent process, I can tell you that if you have anything 
 patentable in your code, the simple act of sending it to DTS (with no NDA) 
 can be construed as a disclosure, and can form a statuary bar to you ever 
 getting a patent on it.

I'm not really the right person to be talking to about these issues; if you 
have problems with the DTS service agreement, please contact DTS about it. 

However, it is hard for DTS (and people here on the forums/group) to help 
unless there is enough information. Frequently, that will entail looking at 
your project, or, even more ideally, isolate your problem to a test case that 
reproduces the issue; then, you don't have to send your entire project. Often 
times, I find that people discover the answer to their problem when trying to 
isolate it.

corbin


 
 “You agree that when requesting and receiving TECHNICAL SUPPORT FROM DTS 
 SeRVICES, you will not provide Apple with any INFORMATION, including that 
 incorporated in your software, that is confidential to you or any third 
 party. YOU AGREE THAT Any notice, legend, or label to the contrary contained 
 in any SUCH materials provided by you to Apple shall be without effect. Apple 
 shall be free to use all information it receives from you in any manner it 
 deems appropriate, subject to any applicable patents or copyrights.”
 
 
 On 5/2/13 4:55 PM, Corbin Dunn corb...@apple.com wrote:
 
 
 On Apr 21, 2013, at 11:51 AM, Gordon Apple g...@ed4u.com wrote:
 
  Our view-based NSOutlineView still has a few annomalies, but mostly works.
  Now, we are attempting to install a hoverView in our outline column to
  launch a popover (display only) when mousing over a row.  This works just
  fine with NSTableViews, but so far does not work at all with NSOutlineView.
  We had hoped this would not be a problem because NSOutlineView is a 
  subclass
  of NSTableView.  Our theory is that because the presence of turn-down
  buttons in the outline view, there must be an additional intervening view
  that handle this and related layout issues within the cell.  Has anyone
  successfully used a hoverView with NSOutlineView?
 
 No, there isn't any additional intervening of the views. Visually, the view 
 based NSOutlineView is a super-thin wrapper around NSTableView to add 
 indentation and a disclosure triangle. If it works in NSTableView, it will 
 work in NSotulineView, and something else is likely wrong.
 
 Things that would be useful to know:
 1. How you are trying to show a popover. (i.e.: relevant code)
 2. When you are doing it, and when is it not happening
 
  
  BTW, a word to the wise.  Bindings to arrayControllers through a
  viewController’s representedObject is still problematic.  We have filed bug
  reports on this in the past (confirmed bug).
 
 What is the radar you logged for this?
 
 NSTableView and NSOutlineView doesn't use a viewController.
 
 corbin
 
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Uploading photos to iCloud programatically

2013-02-12 Thread Corbin Dunn
hi,
If a feature or documentation isn't available for something you want to do, 
please log a bug:

bugreporter.apple.com


corbin

On Feb 6, 2013, at 9:42 PM, Balaji M balaji06n...@gmail.com wrote:

 Hi,
 
 I am writing a Mac application which is expected to support uploading
 photos to iCloud.
 After browsing many sites, I feel there is NO developer API to enable
 application to upload directly to photostream.
 My question is:
 Is there any alternative way for applications to upload photos to
 Photostream?
 If not, how about considering photos as NSDocuments and uploading to iCloud?
 
 Please provide me some pointers for accomplishing this feature in my Mac
 app.
 Thanks in advance.
 
 Regards,
 Balaji M.
 +91 8088640610
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-11-01 Thread Corbin Dunn

On Oct 31, 2012, at 7:25 PM, Nick eveningn...@gmail.com wrote:

 Thanks Corbin, it works great (unfortunately I can't draw the gradient 
 depending on the window size (so it's always white on top and black on 
 bottom, no matter how high the window is, for example), but I guess that 
 still gives possibilities for skinning).. 
 I will join the Iain's question.. Is it possible to somehow alter the color 
 of the title text? Or at least set the title to @, and draw manually 
 NSAttributedString in that title area?

No; there is no way to customize the title; please log a bug requesting the 
ability to do this.

corbin

 
 
 2012/11/1 iain i...@sleepfive.com
 Hi Corbin, sorry for semi-hijacking the thread
 
 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:
 
  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the internet
  that I have missed (actually the link I gave in the beginning is the only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..
 
 Calendar uses the public API of setBackgroundColor: on the window, and sets 
 it to a pattern color. That is it.
 
 
 When you use setBackgroundColor: on the window, is there a way to get the 
 titlebar text to draw in a different colour? When you set the background to a 
 dark colour, the titlebar text is still drawn dark with a light highlight so 
 it looks quite bad.
 
 thanks,
 iain
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-11-01 Thread Corbin Dunn
hi nick,

No; you can't stretch it, but you can create a pattern image that is tall, and 
appears to repeat or stretch. Other than that, the only official way to 
customize a window is via a borderless custom window.

However, please do log bugs requesting that AppKit provide an easy way to 
customize windows. It is good to hear from developers that they want this 
functionality.

corbin


On Nov 1, 2012, at 7:35 AM, Nick eveningn...@gmail.com wrote:

 Corbin, is it possible to make the background color pattern image stretch the 
 picture across the window, instead of repeating it?. If not, is dealing with 
 borderless window the only way to get this functionality (like, having a 
 custom colored title bar, and white title bar text)?
 Thank you
 
 
 
 2012/11/1 Nick eveningn...@gmail.com
 Thanks Corbin, it works great (unfortunately I can't draw the gradient 
 depending on the window size (so it's always white on top and black on 
 bottom, no matter how high the window is, for example), but I guess that 
 still gives possibilities for skinning).. 
 I will join the Iain's question.. Is it possible to somehow alter the color 
 of the title text? Or at least set the title to @, and draw manually 
 NSAttributedString in that title area?
 
 
 2012/11/1 iain i...@sleepfive.com
 Hi Corbin, sorry for semi-hijacking the thread
 
 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:
 
  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the internet
  that I have missed (actually the link I gave in the beginning is the only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..
 
 Calendar uses the public API of setBackgroundColor: on the window, and sets 
 it to a pattern color. That is it.
 
 
 When you use setBackgroundColor: on the window, is there a way to get the 
 titlebar text to draw in a different colour? When you set the background to a 
 dark colour, the titlebar text is still drawn dark with a light highlight so 
 it looks quite bad.
 
 thanks,
 iain
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-10-31 Thread Corbin Dunn

On Oct 31, 2012, at 8:50 AM, Nick eveningn...@gmail.com wrote:

 Hello
 
 I am attempting to create an application with custom looking windows
 (similar to new iCalendar on mountain lion, or QuickTime player). I am
 targeting systems from Snow Leopard to Mountain Lion.
 
 So far I've been customizing the window using the idea described at
 http://parmanoir.com/Custom_NSThemeFrame
 (basically I set the window to be Textured, and swizzle the drawRect
 method of the [[window contentView] superview] (which is an instance of
 NSThemeFrame), then draw some nice gradient in that new drawRect
 implementation, and a custom gradiented toolbar.
 The advantage of this method is that I do not have to bother with resizing
 (even the resizing mark in the bottom right corner is drawn automatically)
 and manually drawing titlebar buttons (albeit they have a gray shadow,
 despite i need a black one). Another advantage is that NSToolbar works
 normally with it, and looks nicely with this customly drawn theme frame.

Don't swizzle the theme frame drawRect: -- that won't always work (as you 
noticed) and isn't supported.

 
 This works fine on Leopard and Snow Leopard, but not on Lion/Mountain Lion.
 Somehow, the application becomes very slow there (Instruments says that the
 application spends a whole bunch of time in some timer event somewhere deep
 in the AppKit, even though I do not use any timers in my app). Apart from
 the windows, on Lion/ML the sheets and the panels get this custom drawn
 background with a titlebar.
 
 I am wondering if anyone created customized windows like this or reverse
 engineered this NSThemeFrame? Maybe there are any articles on the internet
 that I have missed (actually the link I gave in the beginning is the only
 one I have found on this topic). Somehow Apple's iCalendar works pretty
 fast on 10.7, while my app doesn't..

Calendar uses the public API of setBackgroundColor: on the window, and sets it 
to a pattern color. That is it.

corbin

 
 If there's no way to fix this for 10.7/10.8, I guess I will have to draw my
 windows from scratch using NSBorderlessWindowMask, but I think it is very
 difficult to completely mimic the original window's behavior: borderless
 windows do not support NSToolBar (i.e., I have to create my own one from
 scratch), on different OS the windows look/behave differently (10.6 - large
 titlebar buttons, resizing only using right-bottom corner, while 10.7 and
 10.8 - small titlebar buttons, resizing using any edge), etc..
 
 
 Thank you,
 Nicolas
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: how to clip inside a path

2012-10-29 Thread Corbin Dunn

On Oct 29, 2012, at 3:47 PM, Graham Cox graham@bigpond.com wrote:

 I have the following method in a category on NSBezierPath, which seems to be 
 what you want, and works in the same way as -addClip:
 
 
 - (void) addInverseClip

Please don't add generic category names to standard appkit classes (like 
NSBezierPath). This could easily conflict with potential names we add in the 
future. Either don't use a category, or use a unique prefix for your method 
names.

corbin


   // this is similar to -addClip, except that it excludes the area 
 bounded by the path instead of includes it. It works by combining this path
   // with the existing clip area using the E/O winding rule, then setting 
 the result as the clip area. This should be called between
   // calls to save and restore the gstate, as for addClip.
   
   CGContextRefcontext = [[NSGraphicsContext currentContext] 
 graphicsPort];
   CGRect cbbox = CGContextGetClipBoundingBox( context );
   
   NSBezierPath*   cp = [NSBezierPath bezierPathWithRect:*(NSRect*)cbbox];
   [cp appendBezierPath:self];
   [cp setWindingRule:NSEvenOddWindingRule];
   [cp addClip];
 }
 
 
 
 --Graham
 
 
 
 
 On 30/10/2012, at 12:22 AM, Roland King r...@rols.org wrote:
 
 I have a graphics context and a path and I want to clip everything inside 
 the path, ie not display it, and leave everything outside the path 
 displayed. The path is simple and doesn't cross itself, for sake of example 
 it may as well be a circle. If I start with a clip-free GC and set that 
 circle as a clipping path, I'll get the opposite, everything in the circle 
 will show, how do I do the other way around? Does it work if I set a path at 
 the bound rect of the GC plus my shape in the middle? That would seem to 
 have two crossings to get into the shape, one at the bounds of the rect, one 
 as you cross the shape, which should mean everything inside the shape is 
 'outside' but does a path at the very extremities of the GC, or even outside 
 it, count as 'crossed'? 
 
 The more I think about it, the more clipping sounds hard to implement
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why does a custom CALayer property work differently from a standard one?

2012-10-25 Thread Corbin Dunn

On Oct 25, 2012, at 4:38 AM, Roland King r...@rols.org wrote:

 Ive been struggling with this for a couple of days now. 
 
 I have a custom CALayer with a custom property, percentage. It's @dynamic and 
 set up to cause a redraw. 
 
 +(BOOL)needsDisplayForKey:(NSString *)key
 {
   return [ @percentage isEqualToString:key ];
 }
 
 I return CABasicAnimations for percentage and for position with the code at 
 the bottom in actionForKey:. The position one just makes the position change 
 really slowly. 
 
 For position all I have to do is make a CABasicAnimation, set the duration 
 and nothing else and return it, the position animates smoothly from where it 
 was to where it's going. 
 
 If I do the same for 'percentage', just return a CABasicAnimation with the 
 duration set, it doesn't animate, it just goes instantly to the final value. 
 For this one I have to explicitly set the 'fromValue' to the current value in 
 the presentation layer, leaving it nil just doesn't do the job. It finds the 
 'toValue' itself, but I have to tell it where it's coming from. 
 
 Why do they work differently? This prevents me from using 
 addAnimation:forKey: for 'percentage' because each one is different, 
 depending what the current value of percentage is. 
 
 
 -(idCAAction)actionForKey:(NSString *)event
 {
   
   if( [ event isEqualToString:@position ] )
   {
   CABasicAnimation *animation = [ CABasicAnimation 
 animationWithKeyPath:@position ];
   animation.duration = 7.f;
   return animation;

Technically, the above code is incorrect. You have to set one of the values, 
per the header comment.


/* The objects defining the property values being interpolated between.
 * All are optional, and no more than two should be non-nil. The object
 * type should match the type of the property being animated (using the
 * standard rules described in CALayer.h). The supported modes of
 * animation are:
 *
 * - both `fromValue' and `toValue' non-nil. Interpolates between
 * `fromValue' and `toValue'.
 *
 * - `fromValue' and `byValue' non-nil. Interpolates between
 * `fromValue' and `fromValue' plus `byValue'.
 *
 * - `byValue' and `toValue' non-nil. Interpolates between `toValue'
 * minus `byValue' and `toValue'.
 *
 * - `fromValue' non-nil. Interpolates between `fromValue' and the
 * current presentation value of the property.
 *
 * - `toValue' non-nil. Interpolates between the layer's current value
 * of the property in the render tree and `toValue'.
 *
 * - `byValue' non-nil. Interpolates between the layer's current value
 * of the property in the render tree and that plus `byValue'. */


corbin


   }

   
   if( [ event isEqualToString:@percentage ] )
   {
   CABasicAnimation *animation = [ CABasicAnimation 
 animationWithKeyPath:@percentage ];
   animation.duration = 2.f;
   animation.fromValue = [ self.presentationLayer 
 valueForKey:event ];
   return animation;
   }
   
   return [ super actionForKey:event ];;
 }
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cross-fading between layers

2012-10-18 Thread Corbin Dunn

On Oct 18, 2012, at 9:53 AM, Kyle Sluder k...@ksluder.com wrote:

 On Oct 18, 2012, at 8:50 AM, Gabriel Zachmann z...@tu-clausthal.de wrote:
 
 So far, I am fading out an existing layer, and fading in a new layer by the 
 following 5 lines of code:
 
  [CATransaction begin];
  [CATransaction setAnimationDuration: fading_duration]; 
  [mainLayer_ replaceSublayer: currentLayer_ with: newlayer];
  currentLayer_ = newlayer;
  [CATransaction commit];
 
 This works fine under Lion, and it worked fine under Snow Leopard.
 
 It does not work any more under ML, i.e., the layers get replaced, but there 
 is no cross-dissolve effect.
 
 My psychic powers tell me that mainLayer_'s delegate is an NSView instance.

I had that same inclination!

 Read the Mountain Lion release notes and watch the WWDC videos on implicit 
 animations in AppKit using NSAnimationContext.

Yeah, those videos are great. 

corbin

PS: NSAnimationContext.currentContext.allowsImplicitAnimations = YES;

 
 
 --Kyle Sluder
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS 6 changes in CATextLayer text drawing

2012-10-11 Thread Corbin Dunn

On Oct 11, 2012, at 10:27 AM, Matt Neuburg m...@tidbits.com wrote:

 (1) CATextLayer in iOS 6 requires an opaque background in order to antialias 
 text. CATextLayer in iOS 5 did not have this limitation; it could antialias 
 its text perfectly well even if its background was transparent. Why the 
 change? I'm guessing that it's an efficiency boost.
 
 I may be confused about this one. I was put off by the fact that my text 
 looks awful on the full-sized Retina simulator, but now it appears that it 
 *always* looked awful on the full-sized Retina simulator. It seems that 
 CATextLayer is **drawing** the text, not using the text system. So now I have 
 a different problem, namely that I don't understand the note at the top of 
 the CATextLayer class docs, since my text drawing in CATextLayer looks the 
 same with or without an opaque background. m.

Well, remember CA runs on both MacOS and iOS. It isn't about anti-aliasing; it 
is sub-pixel anti-aliasing (aka: font smoothing), which is different. iOS does 
not have font smoothing, but Mac OS does. The comment applies to MacOS.

corbi

 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
 TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSApplicationShowExceptions - useful on main thread only?

2012-09-24 Thread Corbin Dunn

On Sep 21, 2012, at 10:38 PM, Ken Thomases k...@codeweavers.com wrote:

 On Sep 21, 2012, at 5:20 PM, Sean McBride wrote:
 
 The 10.7 release notes say:
 
 AppKit now has the ability to report uncaught exceptions. It is controlled 
 by a user default: NSApplicationShowExceptions (YES/NO)
 
 My next version will require 10.7+, so I'm finally taking a look at this 
 thing.
 
 It seems that it only works for the main thread, that is, if there's an 
 uncaught exception on the main thread I get the nice error UI.  But if an 
 uncaught exception occurs on a non-main-NSThread or dispatch queue I get no 
 nice UI.
 
 Can anyone confirm/deny?  Anyone shipping with 
 NSApplicationShowExceptions=YES?
 
 I have no inside knowledge, but I think you've misunderstood the purpose of 
 this default.  It's simply to change the behavior where AppKit would silently 
 swallow exceptions which reached the event loop.  Of course this only applies 
 to the main thread, because that's the only thread which does that.

Yeah, all the option does is implement some code in NSApp's reportException if 
the user default is turned on.

corbin

 
 The new default is described as a tool for developers during development.  I 
 wouldn't necessarily argue that it _shouldn't_ be enabled for a release 
 version of your app, but it's not really an end-user feature.
 
 If you want to change how uncaught exceptions are handled more generally, you 
 should look into Exception Programming Topics: Controlling a Program’s 
 Response to Exceptions 
 https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Exceptions/Tasks/ControllingAppResponse.html
  and NSExceptionHandler.  Of course, you should first strive to make sure 
 your app doesn't raise exceptions, but no amount of programming care or 
 testing can guarantee that it can never happen in the field.
 
 Regards,
 Ken
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Another sandboxing snafu

2012-09-17 Thread Corbin Dunn

On Sep 13, 2012, at 4:15 PM, Graham Cox graham@bigpond.com wrote:

 Grrr... and here's exactly the sort of stupid thing that I was referring to a 
 moment ago in another thread...
 
 
 I'm attempting to show an NSOpenPanel as a sheet, app is sandboxed. This has 
 always worked perfectly fine:
 
   NSOpenPanel*op = [NSOpenPanel openPanel];
   
   [op setAllowsMultipleSelection:NO];
   [op setCanChooseDirectories:NO];
   [op setAllowedFileTypes:[NSImage imageFileTypes]];
   
   void (^completionHandler)(NSInteger result) = ^(NSInteger result)
   {
   if( result == NSFileHandlingPanelOKButton )
   {
 
   // do stuff with URL from panel (omitted)
   }
   };
   
   
   [op beginSheetModalForWindow:[self windowForSheet] 
 completionHandler:completionHandler];
 
 
 But now when this code runs, the following is logged:
 
 
 14/09/12 9:02:18.578 AM WindowServer[108]: CGXSetWindowShape: Operation on a 
 window 0xf87 requiring rights kCGSWindowRightOwner by caller Artboard
 14/09/12 9:02:18.578 AM Artboard[47282]: _NXPlaceWindow: error setting window 
 shape (1001)
 14/09/12 9:02:18.583 AM com.apple.security.pboxd[47286]: 
 FI_TSidebarSplitView: 0x7fd3e34728c0: the delegate 
 FI_TSidebarSplitterController: 0x7fd3e346ce50 was sent 
 -splitView:resizeSubviewsWithOldSize: and left the subview frames in an 
 inconsistent state:
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Split view bounds: 
 {{0, 0}, {0, 0}}
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Subview frame: 
 {{0, 0}, {-316, 0}}
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Subview frame: 
 {{-315, 0}, {315, 0}}
 14/09/12 9:02:18.585 AM com.apple.security.pboxd[47286]: The subview frames 
 are not in the same order as the subviews array. NSSplitView requires that 
 these orders be kept consistent, otherwise behavior is undefined.


This logging indicates a bug in the frameworks. If you can reproduce it, please 
log your app and reproducible steps to bugreporter.apple.com.

thanks!!

corbin

 
 
 
 Anyone got this simple use of NSOpenPanel to work with sandboxing?
 
 
 --Graham
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Another sandboxing snafu

2012-09-17 Thread Corbin Dunn

On Sep 17, 2012, at 4:19 PM, Graham Cox graham@bigpond.com wrote:

 
 On 18/09/2012, at 4:12 AM, Corbin Dunn corb...@apple.com wrote:
 
 14/09/12 9:02:18.578 AM WindowServer[108]: CGXSetWindowShape: Operation on 
 a window 0xf87 requiring rights kCGSWindowRightOwner by caller Artboard
 14/09/12 9:02:18.578 AM Artboard[47282]: _NXPlaceWindow: error setting 
 window shape (1001)
 14/09/12 9:02:18.583 AM com.apple.security.pboxd[47286]: 
 FI_TSidebarSplitView: 0x7fd3e34728c0: the delegate 
 FI_TSidebarSplitterController: 0x7fd3e346ce50 was sent 
 -splitView:resizeSubviewsWithOldSize: and left the subview frames in an 
 inconsistent state:
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Split view bounds: 
 {{0, 0}, {0, 0}}
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Subview frame: 
 {{0, 0}, {-316, 0}}
 14/09/12 9:02:18.584 AM com.apple.security.pboxd[47286]: Subview frame: 
 {{-315, 0}, {315, 0}}
 14/09/12 9:02:18.585 AM com.apple.security.pboxd[47286]: The subview frames 
 are not in the same order as the subviews array. NSSplitView requires that 
 these orders be kept consistent, otherwise behavior is undefined.
 
 
 This logging indicates a bug in the frameworks. If you can reproduce it, 
 please log your app and reproducible steps to bugreporter.apple.com.
 
 
 I certainly will; but haven't reproduced it in a separate project yet

It's okay to include your app as an executable; we can debug that.

 
 
 My feeling is that the sidebar split view problem is a consequence of the 
 first part: CGXSetWindowShape: Operation on a window 0xf87 requiring rights 
 kCGSWindowRightOwner by caller

Possibly...it is hard to say. The split view log is something else though, and 
needs to be fixed in an internal framework that uses AppKit. 

corbin


 
 which has a sandbox/rights denial flavour to it, possibly. It would be useful 
 to know what that actually MEANS so I can look for an originating cause.
 
 --Graham
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: nstableview without nsscrollview

2012-09-12 Thread Corbin Dunn

On Sep 10, 2012, at 6:08 PM, Alfian Busyro alfian.bus...@kddi-web.com wrote:

 Kyle, thanks for your solution.
 Think very hard about this. Why would you want to do this? What would
 you do if your table view gained enough data that it no longer fit in
 the available space?
 So I planning to make two tables in one view but I don't want to separate 
 that two tables with scroll,
 and make only the view (parent view of two tables) is scrollable.

Just leave it in a scrollview, and set it to not scroll in any direction, and 
size the scrollview to the table's height/width. That's it.

 The purpose is if user scroll down that parent view these two tables also 
 have to be scroll down too.
 Like sectional table view but with multiple tables, because I don't want to 
 make it sectional.
 Yes, table views can live outside of a scroll view, but it's not a
 simple task. -[NSTableView tile] loves to resize the table view to
 snugly fit its contents, and -tile will be called at arbitrary times.
 You can't call -setFrameSize: on a table view and expect it to stick.
 it seems pretty annoying.

That table has to control its frameSize; there is no way around this if you 
think about it.

corbin


 
 -- Alfian
 
 On 12/09/10 16:35, Kyle Sluder wrote:
 On Sun, Sep 9, 2012, at 11:17 PM, Alfian Busyro wrote:
 I'm thinking to have an un-scrollable nstableview in mac-osx app.
 because I don't want user to scroll within the table, but have to
 Think very hard about this. Why would you want to do this? What would
 you do if your table view gained enough data that it no longer fit in
 the available space?
 
 Is it possible to have a table view without scroll view, or maybe to
 extract table view from scroll view ?
 Yes, table views can live outside of a scroll view, but it's not a
 simple task. -[NSTableView tile] loves to resize the table view to
 snugly fit its contents, and -tile will be called at arbitrary times.
 You can't call -setFrameSize: on a table view and expect it to stick. (I
 believe I've filed a Radar asking for this ability; if I haven't, I
 really should.)
 
 If the table view's superview is an instance of NSClipView, it will
 resize itself to be at least as big as its superview. So you might
 consider putting the table view inside a naked NSClipView.
 
 --Kyle Sluder
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Focus issues with NSTableView in NSPanel

2012-08-21 Thread Corbin Dunn
Override:

- (BOOL)needsPanelToBecomeKey 

and return NO. If you think about it...that is conceptually what you want. 
Also, the window could return YES from becomesKeyOnlyIfNeeded, and it should 
also work.

-corbin



On Aug 21, 2012, at 5:48 AM, Jean Suisse jean.li...@gmail.com wrote:

 Hello,
 
 I have an NSPanel window that contains an NSTableView with the usual setup 
 (NSPanel - content view (NSView) - NSScrollView - NSTableView - etc).
 When the Panel does not have the focus, clicking on an item of the table view 
 will first activate the panel. Then a second click will be required to select 
 the item. This two-click selection is inconvenient.
 
 I have tried to answer yes to acceptsFirstMouse in the content view, the 
 scroll view, and the table view without success. Anyone knows how to deal 
 with this ?
 
 Best regards,
 Jean
 
 Jean Suisse
 Institut de Chimie Moléculaire de l’Université de Bourgogne
 (ICMUB) — UMR 6302
 
 U.F.R. Sciences et Techniques, Bâtiment Mirande
 Aile B, bureau 411
 9, avenue Alain Savary — B.P. 47870
 21078 DIJON CEDEX
 
 T: +333-8039-9037 
 F: +339-7223-9232
 E: jean.sui...@u-bourgogne.fr
 
 http://www.icmub.fr/185-JEAN-SUISSE_?id=331
 
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Focus issues with NSTableView in NSPanel

2012-08-21 Thread Corbin Dunn

On Aug 21, 2012, at 8:14 AM, Keary Suska cocoa-...@esoteritech.com wrote:

 On Aug 21, 2012, at 8:59 AM, Jean Suisse wrote:
 
 Thank you very much for your reply.
 
 Id did override acceptsFirstMouse all the way down to the NSTableView 
 subclass. And i did the same for acceptsFirstResponder.
 Both acceptsFirstMouse and acceptsFirstResponder are only called for the 
 NSTableView. Every time I return YES… without any effect.
 
 Is there a way to propagate all events ? Or should I propagate mouse down, 
 up, etc. individually ?
 
 You can propagate all events via sendEvent:, although I don't recall whether 
 that is the recommended method. You probably want a more fine-grained 
 approach, at least only forwarding mouse events that occur within the table 
 view's domain.

Don't override or change acceptsFirstMouse. the table *always* says YES to 
acceptsFirstMouse, since it will respond to mouse events in a background window 
when cmd is held down.

Also, you don't have to play with sending events manually; instead, see my 
other response.

-corbin


 
 On 21 août 2012, at 16:51, Keary Suska wrote:
 
 On Aug 21, 2012, at 6:48 AM, Jean Suisse wrote:
 
 I have an NSPanel window that contains an NSTableView with the usual setup 
 (NSPanel - content view (NSView) - NSScrollView - NSTableView - etc).
 When the Panel does not have the focus, clicking on an item of the table 
 view will first activate the panel. Then a second click will be required 
 to select the item. This two-click selection is inconvenient.
 
 I have tried to answer yes to acceptsFirstMouse in the content view, the 
 scroll view, and the table view without success. Anyone knows how to deal 
 with this ?
 
 If you want the click through to effect the table view, it seems more 
 logical to override acceptsFirstMouse: in an NSTableView subclass, rather 
 than the content view...
 
 If somehow the event if being filtered before that point, you could 
 subclass NSPanel to manually propagate the event to the table view...
 
 
 Keary Suska
 Esoteritech, Inc.
 Demystifying technology for your home or business
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Focus issues with NSTableView in NSPanel

2012-08-21 Thread Corbin Dunn

On Aug 21, 2012, at 9:02 AM, Kyle Sluder k...@ksluder.com wrote:

 On Aug 21, 2012, at 8:43 AM, Corbin Dunn corb...@apple.com wrote:
 
 Override:
 
 - (BOOL)needsPanelToBecomeKey 
 
 and return NO. If you think about it...that is conceptually what you want. 
 Also, the window could return YES from becomesKeyOnlyIfNeeded, and it should 
 also work.
 
 I don't know what Jean Suisse needs, but we've been trying to achieve a very 
 similar goal: clicking on a table view in a non-key window should cause the 
 selection to change *and* should cause that window to become key (with the 
 table view as first responder).
 
 Yes, we understand this is a departure from standard behavior. But this is 
 the behavior we desire. (The table view lives in an inspector window and 
 shows a fair bit of data, and users expect to be able to navigate it with the 
 keyboard.)
 
 Unfortunately, the only thing we've done that seems to work is to override 
 -acceptsFirstMouse: to call [self.window makeKeyAndOrderFront:] before 
 returning YES. This feels incredibly hacky. Is there no other way?

Return NO from needsPanelToBecomeKey. Override mouseDown: in the table, and the 
first thing you do is make the window key, and then call super. This way, you 
are manually implementing needsPanelToBecomeKey (well, sort of..)

corbin



 
 --Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Focus issues with NSTableView in NSPanel

2012-08-21 Thread Corbin Dunn

On Aug 21, 2012, at 9:38 AM, Kyle Sluder k...@ksluder.com wrote:

 On Aug 21, 2012, at 9:07 AM, Jean Suisse jean.li...@gmail.com wrote:
 
 Well, then you just need to override:
 
 - (BOOL)needsPanelToBecomeKey 
 
 in the NSTableView (subclass) and return NO. 
 
 I'll try it, but frankly this doesn't make sense. I *do* want the panel to 
 become key when the user clicks the table view. When I return YES from this 
 method, the table view becomes first responder and the panel containing it 
 becomes key, just like I expect, but the selection in the table view does not 
 change to match the item that was clicked.

That's because what you describe is the HI Guideline. However, you can 
control it (see my reply)

corbin

 
 --Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Focus issues with NSTableView in NSPanel

2012-08-21 Thread Corbin Dunn

On Aug 21, 2012, at 9:38 AM, Kyle Sluder k...@ksluder.com wrote:

 On Aug 21, 2012, at 9:07 AM, Jean Suisse jean.li...@gmail.com wrote:
 
 Well, then you just need to override:
 
 - (BOOL)needsPanelToBecomeKey 
 
 in the NSTableView (subclass) and return NO. 
 
 I'll try it, but frankly this doesn't make sense. I *do* want the panel to 
 become key when the user clicks the table view.

Yeah, but you also don't want the standard NSTableView HI behavior, so you have 
to do something custom.

corbin

 When I return YES from this method, the table view becomes first responder 
 and the panel containing it becomes key, just like I expect, but the 
 selection in the table view does not change to match the item that was 
 clicked.
 
 --Kyle Sluder

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableView not setting -clickedRow, -clickedColumn as it should

2012-08-08 Thread Corbin Dunn

On Aug 7, 2012, at 10:55 PM, Graham Cox graham@bigpond.com wrote:

 
 
 According to the release notes for 10.7, NSTableView should now support 
 contextual menus at the individual cell level:
 
 NSTableView/NSOutlineView - Contextual menu support
 
 NSTableView and NSOutlineView now have better contextual menu support. 
 Please see the DragNDropOutlineView demo application for an example of how 
 to properly do contextual menus with a TableView.
 
 The key thing to note is that clickedRow and clickedColumn will now both be 
 valid when a contextual menu is popped up. In addition, one can dynamically 
 set the popup menu for a particular cell/column in the delegate method 
 willDisplayCell:. NSTableView handles this by properly overriding 
 menuForEvent:, setting the clickedRow/clickedColumn, and calling [NSCell 
 menuForEvent:inRect:ofView] to find the correct menu. If no menu was 
 returned, the menu for the NSTableView will be used. If one right clicks on 
 a selection of items, all the items are highlighted. One should check to see 
 if clickedRow is one of the selected rows, and if it is then do the menu 
 operation on all the selected rows. The clickedRow and clickedColumn 
 properties will still be valid when the action is sent from the NSMenuItem.
 
 
 
 But when I implement the method in my custom cell, though it's being called 
 correctly,  -clickedRow and -clickedColumn are returning -1. As a result I 
 can't tell which row I right-clicked, so I can't process the menu further. 
 Has this change been revoked in 10.8 (which I'm using at the moment)?

No it hasn't changed, but the clicked row is set *after* you return a menu. 
That way your menu validation code can use it. I think the DragNDropOutlineView 
demo shows how to do this.

corbin


 
 Code:
 
 - (NSMenu*)   menuForEvent:(NSEvent *)event inRect:(NSRect)cellFrame 
 ofView:(NSView *)view
 {
   NSMenu* menu = nil;
   
   if([view respondsToSelector:@selector(delegate)])
   {
   id tvDelegate = [(id)view delegate];
   
   if([view isKindOfClass:[NSTableView class]]  [tvDelegate 
 respondsToSelector:@selector(contextualMenuForTableView:tableColumn:row:)])
   {
   NSTableView*tv = (NSTableView*) view;
   NSInteger   row, column;
   
   row = [tv clickedRow];
   column = [tv clickedColumn];
 
 
 
 
 --Graham
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableView not setting -clickedRow, -clickedColumn as it should

2012-08-08 Thread Corbin Dunn

On Aug 8, 2012, at 11:38 AM, Kyle Sluder k...@ksluder.com wrote:

 On Wed, Aug 8, 2012, at 10:38 AM, Corbin Dunn wrote:
 No it hasn't changed, but the clicked row is set *after* you return a
 menu. That way your menu validation code can use it. I think the
 DragNDropOutlineView demo shows how to do this.
 
 I've always thought this was an extremely odd design decision, since it
 essentially forces you to use a menu delegate to build your menu rather
 than just handing back the correct NSMenu instance from -menuForEvent:.
 
 Is there a reason that I shouldn't file a bug asking for clickedRow to
 be set as soon as the row is clicked?

I just hadn't thought that people would have needed the clicked row earlier; 
that's about it. Yeah, log a bug; there isn't any reason I can't change it.

corbin

 
 --Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableView not setting -clickedRow, -clickedColumn as it should

2012-08-08 Thread Corbin Dunn

On Aug 8, 2012, at 2:05 PM, Kyle Sluder k...@ksluder.com wrote:

 On Wed, Aug 8, 2012, at 01:21 PM, Corbin Dunn wrote:
 
 On Aug 8, 2012, at 11:38 AM, Kyle Sluder k...@ksluder.com wrote:
 Is there a reason that I shouldn't file a bug asking for clickedRow to
 be set as soon as the row is clicked?
 
 I just hadn't thought that people would have needed the clicked row
 earlier; that's about it. Yeah, log a bug; there isn't any reason I can't
 change it.
 
 Alright, done: rdar://problem/12059014 (NSTableView waits until after
 calling -menuForEvent: before setting -clickedRow)
 
 With a bonus: rdar://problem/12059058 (NSTableView should have a
 -tableView:menu:forEvent: delegate method).

Cool; note that with View Based TableViews these types of things are easier to 
do, since one can just do normal view stuff, and easily query for what row 
they are in (via rowForView:)

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: View-based NSTableView question

2012-07-12 Thread Corbin Dunn

On Jul 12, 2012, at 2:24 AM, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 On Jul 11, 2012, at 15:06 , TJ wrote:
 
 The problem here is that I don't have any idea where and how to get and set 
 the frame of the cell. As you can see during the creation of NSTableCellView 
 I'm basically using an NSZeroRect because [cellView frame] is nil. I 
 subclassed NSTableCellView and added a red color for the background in order 
 to see if the NSZeroRect gets automatically updated to the current cell rect 
 - it does work. But it just doesn't make sense to create a subview of 
 NSTableCellView with a zero-frame... is there a method inside 
 NSTableCellView I should subclass and position the NSTextField? Or is it 
 common to get the frame inside -viewForTableColumn and adjusting the text 
 field there? What's the way Apple had in mind concerning programmatically 
 creating a view-based NSTableView? I couldn't find a lot of information on 
 this, the demo video on developer.apple.com directly uses an NSTextField as 
 the return cell-view but my view needs to be more complex than that. I am 
 pretty sure I just missed something very important here. ;-)
 
 The cell view creation occurs earlier than the point where the cell view's 
 geometry (including its frame) is configured for the row where it's going to 
 be used. (Note that you're only creating the view if there isn't one to 
 reuse, and the re-used one will have the wrong frame from wherever it was 
 last used.)
 
 You never set the frame yourself. The table view does that.
 
 In a circumstance like this, you can create the view with any frame you want, 
 because it will be re-sized and re-positioned later. The only real 
 consideration is that, depending on the intended subviews, you may choose 
 *not* to make the view very small, because autoresizing of subviews of a view 
 that's too small to contain them may produce undesirable results.
 
 So, use an empty frame rect, or a 100 x 100 frame rect or a 1000 x 1000 frame 
 rect or whatever is convenient for the purpose of initially creating the view.
 

Or, if you really need it, you can use the value from frameOfCellAtColumn:row:  
-- that is the value that the table is going to set on the returned cell 
view. The method is pretty fast, so it should be okay to call. However, it 
will be faster to just use a hardcoded value for initial layout (like 100x100, 
or column.width x rowHeight -- and if you want to get even more fancy, subtract 
half the intercellSpacing from each.)

corbin

 And my second question is - is it possible to create a cell view which is 
 bigger than one row, thus it's overlaying other rows (I'm not customizing my 
 table view to death, I have a good reason for cell views being positioned 
 over several rows).
 
 I dunno, but I doubt that it works. The table view re-uses cell views that 
 are scrolled out of the content view, and I suspect it bases this on the row 
 height, not the row's cell view's frame rect. In addition, I'd imagine that 
 overlapping rows might mess up row animations. Lastly, your view is going to 
 be resized by the table view itself, so your attempt to re-size is might be 
 frustrated anyway.
 
 
 P.S. Here's a documentation reference:
 
   
 https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/PopulatingView-TablesProgrammatically/PopulatingView-TablesProgrammatically.html#//apple_ref/doc/uid/1026i-CH14-SW5
 
 which has sample code similar to yours. Note the comment that says, the 
 height of the frame is not really relevant, the row-height will modify the 
 height.
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: nstableview remove/insert rows question

2012-06-28 Thread Corbin Dunn

On Jun 28, 2012, at 4:30 AM, Rick C. rickcort...@gmail.com wrote:

 Hi,
 
 Got a view-based table view and instead of using reloadData I'm removing the 
 existing rows and inserting the new rows so that I can have animation.  I'm 
 also resizing the window in-between these 2 steps because my window resizes 
 to fit how many rows are in my table view.  This works great when my window 
 doesn't resize (due to same amount of rows) or resizes very little.  However 
 let's say I have only 2 rows then remove those 2 rows and resize the window 
 (using setFrame:display:animate:) and finally insert a much larger amount of 
 rows like 15 what happens is the top 5 or 6 rows animate as expected but the 
 rows further down just appear as if I was calling reloadData.  I have checked 
 this and reloadData is not being called, but I can't figure out why all rows 
 don't animate.  Any ideas?

Yes -- I have ideas; actually, even better, I know what is happening! The table 
is very efficient at bringing in only the views you need. What's happening here 
is your animation insert or delete is happening, and no other views are visible 
(or need to be). Then, the table is resized via the window animation, exposing 
more rows that didn't participate in the animation. You can trick them to 
participate in the animation by pulling them in before doing the animation; if 
you are going to have X rows be revealed, call rowViewAtRow:makeIfNecessary:YES 
for the X rows past the last visible one first.

corbin

 
 Thanks,
 
 rc
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: willDisplayOutlineCell of view-based NSOutlineView is not called

2012-06-25 Thread Corbin Dunn
You really want to call [super didAddSubview:] in that code snippet.

corbin

On Jun 23, 2012, at 2:29 PM, Nava Carmon ncar...@mac.com wrote:

 Just for those who need to customize their outline view disclosure arrow:
 Here's the answer from SO, that worked perfectly for me. 
 
 http://stackoverflow.com/questions/11127764/how-to-customize-disclosure-cell-in-view-based-nsoutlineview
 
 
 Best Regards,
 
 Nava Carmon,
 
 Moshiach Times Ltd.,
 
 e-mail: ncar...@mac.com
 Skype: navacarmon
 Phone: +972.52.8157770
 
 
 
 
 On Jun 21, 2012, at 7:27 PM, Nava Carmon wrote:
 
 Thank you all for answering.
 
 Corbin, where is the best place to add my own disclosure button?
 I believe not in the view itself, since it's indented.
 
 Thanks
 
 
 
 On Jun 21, 2012, at 7:25 PM, Corbin Dunn wrote:
 
 
 On Jun 21, 2012, at 7:45 AM, Kyle Sluder k...@ksluder.com wrote:
 
 On Jun 21, 2012, at 1:22 AM, Nava Carmon ncar...@mac.com wrote:
 
 
 
 
 And this is what apple documentation says on this:
 
 outlineView:willDisplayOutlineCell:forTableColumn:item:
 Informs the delegate that an outline view is about to display a cell used 
 to draw the expansion symbol.
 
 _There are no cells_ in a *view-based* outline view.
 
 Either on this list or in the developer forums (devforums.apple.com), 
 Corbin Dunn acknowledged that lack of customizability of disclosure 
 triangles is a known shortcoming with view-based outline views. He 
 mentioned a workaround that involves looking for a subviews with a certain 
 identifier.
 
 Please do log a bug requesting this functionality so we can expose it in an 
 easy way.
 
 Yes, the documentation should be more clear too -- please log a bug on that 
 also.
 
 Another alternative is to hide the disclosure triangle and add your own 
 button that does it. It just would call expandItem or collapseItem as 
 needed.
 
 corbin
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/ncarmon%40mac.com
 
 This email sent to ncar...@mac.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: willDisplayOutlineCell of view-based NSOutlineView is not called

2012-06-21 Thread Corbin Dunn

On Jun 21, 2012, at 7:45 AM, Kyle Sluder k...@ksluder.com wrote:

 On Jun 21, 2012, at 1:22 AM, Nava Carmon ncar...@mac.com wrote:
 
 
 
 
 And this is what apple documentation says on this:
 
 outlineView:willDisplayOutlineCell:forTableColumn:item:
   Informs the delegate that an outline view is about to display a cell used 
 to draw the expansion symbol.
 
 _There are no cells_ in a *view-based* outline view.
 
 Either on this list or in the developer forums (devforums.apple.com), Corbin 
 Dunn acknowledged that lack of customizability of disclosure triangles is a 
 known shortcoming with view-based outline views. He mentioned a workaround 
 that involves looking for a subviews with a certain identifier.

Please do log a bug requesting this functionality so we can expose it in an 
easy way.

Yes, the documentation should be more clear too -- please log a bug on that 
also.

Another alternative is to hide the disclosure triangle and add your own button 
that does it. It just would call expandItem or collapseItem as needed.

corbin



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: nstableview reload with animation possible?

2012-06-19 Thread Corbin Dunn
Well, that method doesn't animate.

Conceptually, what you have to do is this (and assuming you are using a view 
based table view):

1. Call beginUpdates on the table *important*
2. Modify the table to add/remove all the rows that you added or removed. Note 
that it works like an NSArray, so calling removeRow:3 will remove row 3, and 
then what was at row 4 is now at row 3. So to delete what was at row 4 you call 
removeRow:3 again. This is *different* from how it works on iOS which freezes 
the table and does not treat it like an array
3. Call endUpdates

The table will not call the datasource during the time you call 
beginUpdates/endUpdates.

corbin

On Jun 18, 2012, at 5:26 PM, Rick C. rickcort...@gmail.com wrote:

 Thanks I will take a look!
 
 
 On Jun 19, 2012, at 3:59 AM, Marc Respass wrote:
 
 What I'm basically trying to do is call reloadData but with animation and I 
 can't see how to do it?  I know about removing/inserting rows with 
 animation and I tried this, but I keep crashing and I would think it's 
 because I'm removing rows and inserting rows after my datasource has been 
 modified.  That's why normally I use reloadData and it works fine.  Also, 
 it seems there is a method to do this in iOS but it's not available on Mac. 
  So is it possible to do this?  Or can I only use the animation when 
 removing inserting rows without changing the modifying the datasource?  
 Thanks,
 
 Hi Rick,
 
 You probably want
 - (void)reloadDataForRowIndexes:(NSIndexSet *)rowIndexes 
 columnIndexes:(NSIndexSet *)columnIndexes NS_AVAILABLE_MAC(10_6);
 
 In my app, I use it to update rows which get updated one at a time but you 
 can provide an index set with many rows. You might be able to use 
 -rowsInRect which I haven't used passing the rect of the table view's scroll 
 view, I would think. Then you can create the index set with 
 -indexSetWithIndexesInRange:
 
 Hope this helps
 Marc
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
 
 This email sent to rickcort...@gmail.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: A color well in a table view?

2012-06-11 Thread Corbin Dunn

On Jun 11, 2012, at 8:45 AM, H Miersch hmier...@me.com wrote:

 I found the switch that makes my table view view-based, but then my table 
 view showed some default text instead of the text I return from 
 -tableview:objectvaluefortablecolumn:row:
 What can I do about that?

I recommend reading the documentation on how to use a View Based NSTableView, 
and/or look at the TAbleViewPlayround demo to see how it is done.

corbin


 
 Sent from my iPhone
 
 On 7 Jun 2012, at 16:32, Sean McBride s...@rogue-research.com wrote:
 
 On Thu, 7 Jun 2012 13:53:49 +0100, H. Miersch said:
 
 In my Mac app I have a table view which so far only displays text and
 numbers. Now I'd like to put color wells in one column (to supply colors
 for the lines in the diagram) and checkboxes in another (to decide
 whether each line should be drawn or not). Can I do that? If so, what's
 the best way to do that? Is it as easy as modifying
 tableview:objectvaluefortablecolumn:row: to retrieve the color wells
 from the array and return them to the table view, or are there some
 hoops I have to jump through?
 
 Unlike most NSControls, there is no NSCell for NSColorWell.  But 10.7 did 
 add view-based tableviews, so if you can require 10.7+, that's probably your 
 best bet.  I've been meaning to try it myself...
 
 -- 
 
 Sean McBride, B. Eng s...@rogue-research.com
 Rogue Researchwww.rogue-research.com 
 Mac Software Developer  Montréal, Québec, Canada
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: setting preselected file for nsopenpanel

2012-06-11 Thread Corbin Dunn
This is a known limitation, as Lee Ann Rucker reported in the prior message.

One work around is to use setDirectoryURL: and pass it the actual file (not the 
folder). I believe that will pre-select it (sort of by accident).

corbin

On Jun 11, 2012, at 4:08 AM, Rick C. rickcort...@gmail.com wrote:

 Hi,
 
 Been through numerous posts on stack overflow without a solution so here goes:
 
 runModalForDirectory:file:types: was deprecated but in the docs it doesn't 
 give the replacement for the file argument.  How can we have a file 
 preselected when running an open panel?
 
 Thanks,
 
 rc
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSavePanel runModal isn't working in sandbox?

2012-06-08 Thread Corbin Dunn

On Jun 8, 2012, at 11:20 AM, Samuel Williams space.ship.travel...@gmail.com 
wrote:

 
 
 I've had no problems at all with NSSavePanel under the sandbox (the
 inherited methods limitation that Graham mentioned excepted).
 
 My usage looks almost exactly like the code above except that I call
 -beginSheetModalForWindow:completionHandler: instead of -runModal.
 
 BUT. You need the com.apple.security.files.user-selected.read-write
 entitlement set to YES.
 
 
 Yeah, I have already set entitlements correctly. The NSPersistentDocument
 open/save are working fine. But, having issues with NSSavePanel... I tried
 the variation with completionHandler and still had the same problem, I also
 tried using a delegate but that also didn't seem to provide any useful
 information.
 
 Everything was working fine under a non-sandbox environment.. so its a bit
 odd..
 
 Maybe I could try to make a very minimal example that could be used for
 testing..

If you are having trouble, definitely log a bug at bugreport.apple.com

Even if it turns out to be something you might be doing wrong, we can update 
the documentation to better clarify the issue so others don't run into it.

thanks!

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: A color well in a table view?

2012-06-07 Thread Corbin Dunn

On Jun 7, 2012, at 8:32 AM, Sean McBride s...@rogue-research.com wrote:

 On Thu, 7 Jun 2012 13:53:49 +0100, H. Miersch said:
 
 In my Mac app I have a table view which so far only displays text and
 numbers. Now I'd like to put color wells in one column (to supply colors
 for the lines in the diagram) and checkboxes in another (to decide
 whether each line should be drawn or not). Can I do that? If so, what's
 the best way to do that? Is it as easy as modifying
 tableview:objectvaluefortablecolumn:row: to retrieve the color wells
 from the array and return them to the table view, or are there some
 hoops I have to jump through?
 
 Unlike most NSControls, there is no NSCell for NSColorWell.  But 10.7 did add 
 view-based tableviews, so if you can require 10.7+, that's probably your best 
 bet.  I've been meaning to try it myself...

I've given it a try and it works great!

Alternatively,  you can implement a custom cell; This demo does just that:

http://developer.apple.com/library/mac/#samplecode/AnimatedTableView/Introduction/Intro.html

corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: can't hide scrollbar on NSTableView

2012-06-06 Thread Corbin Dunn

On Jun 5, 2012, at 4:44 PM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 
 On Jun 5, 2012, at 7:16 PM, Corbin Dunn wrote:
 
 
 On Jun 4, 2012, at 11:48 AM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 Ok, I'm stumped here. I have a few scrollable views in my window, two
 NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
 hide when not in use, and used the setting of the NSScrollView in IB
 in Xcode to do so.  For the NSTextView it works, but for the
 NSTableViews the scrollbar won't hide, and are also much wider. The
 scrollbar settings are exactly the same for all three NSScrollViews.
 
 What am I missing here, is there another secret setting?
 
 What settings are you referring to? 
 By hide, do you mean autohide scrollers when not needed, or not used? The 
 later is also dependent on the OS settings for your mouse.
 
 I am referring to Automatically hide scroller and Show vertical scroller, 
 these are both on for all three views.  In the textview the scrollbar behaves 
 as expected, in the tableview, the scrollbar is always visible. The scrollbar 
 on the tableviews has a visible 'gutter' as was the case pre-lion and is also 
 drawn in a slightly lighter shade of gray.  All other apps I use (including 
 the TableViewPlayground code example from Apple) have the expected behavior.
 
 Here's a screenshot, hope this works:
 
 http://dl.dropbox.com/u/41198645/Screen%20Shot%202012-06-05%20at%207.36.44%20PM.png
 
 You can see the scrollbar on the right, the 'gutter' and scrollknob are 
 always visible.


It has a scroller there because it has scrollable area. 

All I can guess is that something has some scrollable area or the property is 
reset somewhere (and you don't expect it to be reset). Also look for non pixel 
aligned things; things could be off by 0.5 and it might cause a scroller to 
appear but not scroll anything.

corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: can't hide scrollbar on NSTableView

2012-06-06 Thread Corbin Dunn

On Jun 6, 2012, at 9:54 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 On Wed, Jun 6, 2012 at 12:42 PM, Corbin Dunn corb...@apple.com wrote:
 
 It has a scroller there because it has scrollable area.
 
 Yes, but it should hide when I am not scrolling (as was the case when
 taking the screenshot).

Okay; we are talking about two different things!

Automatically Hide scroller makes it come and go depending on content. But what 
you are talking about is the NSScrollerStyle of overlay that makes them 
disappear when nothing is touching them, *and* you have a touch enabled device 
(track pad, magic mouse,etc). The latter is an option in preferences; make sure 
you have it set to automatically hide scrollers (or, always hide them, even if 
you have a regular mouse).

Just call setScrollerStyle to NSScrollerStyleOverlay to force it on. 
NSScrollView decides if it can be on or off by default using a special 
algorithm; you might be tripping it up by having a view that intersects with 
the scroll area, so you can just force it always to be overlay.

Hopefully this clears up that property and the difference.

corbin

 
 All I can guess is that something has some scrollable area or the property 
 is reset somewhere (and you don't expect it to be reset). Also look for non 
 pixel aligned things; things could be off by 0.5 and it might cause a 
 scroller to appear but not scroll anything.
 
 corbin
 
 I wonder if it has to do with switching from cell based to view based
 NSTableViews.  I'll look into that later tonight.
 
 - Koen.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Preventing NSSavePanel from alerting file overwrite

2012-06-06 Thread Corbin Dunn

On Jun 6, 2012, at 10:04 AM, Gordon Apple g...@ed4u.com wrote:

 Is there a way to block NSSavePanel from alerting a file overwrite?  I¹m
 using it simply to establish a URL and later alert about overwrite when a
 record command is issued.  I would prefer to not have the user see this
 twice.

No, you can't do that. You should use NSOpenPanel (as someone else mentioned). 
If you really want to do this, please log a feature request asking us to expose 
a way to do it.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: can't hide scrollbar on NSTableView

2012-06-05 Thread Corbin Dunn

On Jun 4, 2012, at 11:48 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 Ok, I'm stumped here. I have a few scrollable views in my window, two
 NSTableViews, and an NSTextView.  I'd like to have the scrollbar to
 hide when not in use, and used the setting of the NSScrollView in IB
 in Xcode to do so.  For the NSTextView it works, but for the
 NSTableViews the scrollbar won't hide, and are also much wider. The
 scrollbar settings are exactly the same for all three NSScrollViews.
 
 What am I missing here, is there another secret setting?

What settings are you referring to? 
By hide, do you mean autohide scrollers when not needed, or not used? The later 
is also dependent on the OS settings for your mouse.

corbin


 
 (Lion, Xcode 4)
 
 - Koen.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Animating source view design advice.

2012-05-30 Thread Corbin Dunn

On May 30, 2012, at 11:37 AM, Demitri Muna thatsanicehatyouh...@me.com wrote:

 Just because I hate orphaned questions (as no one answered), I thought I'd 
 answer my own question.
 
 Most examples that use Core Data/bindings/array controllers use a table view 
 as the source view, but I wanted something more flexible with my own custom 
 view that involved a little animation. Although NSTableCellView makes this a 
 little easier, it still felt shoehorned into a table view.

Really? Why? It fits quite perfectly with the view based tableview.

 I think the best answer is the realization that I don't need a table view at 
 all to use the machinery above,

I think the best solution is to use a view based NSOutlineView with variable 
row heights and custom background drawing on the NSTableRowView.

FWIW, Xcode uses NSOutlineView (non-view based at the current time).

corbin


 and that one can simply have an array of NSViews managed by an array 
 controller (in a scroll view). Everything else (e.g. master/detail, bindings) 
 just falls into place after that. The most illustrative example was mmalc's 
 Graphics Bindings, located here:
 
 http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
 
 Although that link will only be valid for about a month before MobileMe ends. 
 :)
 
 Cheers,
 Demitri
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: group row custom drawing nstableview

2012-05-23 Thread Corbin Dunn
Hi Rick,
On May 22, 2012, at 9:14 PM, Rick C. rickcort...@gmail.com wrote:

 Hi,
 
 I'm having some trouble doing a custom drawing for my group row in a 
 view-based nstableview.  First of all I subclassed NSTableRowView is this 
 correct?  

Yes, that is correct.

 And if so the problem I'm having is to recreate the floating effect which 
 normally happens automatically if using a standard NSTableCellView.  I'm able 
 to get the isFloating property, but I'm not sure what's the correct way to 
 make the row float (setAlpha?) without making the text float as well?  Any 
 pointers to get me going in the right direction here would be much 
 appreciated.  Thanks!

I'm not sure what you mean...you simply can draw (override the drawBackground 
method) with an non-1.0 alpha color and the row will appear translucent (only 
when floating).

corbin

 
 rc
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sandbox console messages

2012-05-21 Thread Corbin Dunn
Hi Peter,
Can you log these as bugs (bugreporter.apple.com); it sounds like they are bugs 
in the system which you may not have control over. Please be sure to include 
steps to reproduce, backtraces, and ideally sample code that reproduces it. 
Thanks!

corbin

On May 21, 2012, at 8:41 AM, Peter Krajčík pet...@sunteq.sk wrote:

 Hello,
 I'm trying to migrate an existing application to sandboxing (on Lion).
 
 It is just a regular document-based app, doesn't do anything wild.
 
 I've enabled user selected file access (read/write).
 
 Sometimes I get this message in the console:
 5/21/12 3:28:35.002 AM sandboxd: ([7221]) MyAppName(7221) deny iokit-open 
 AppleGraphicsPolicyClient
 
 With trace:
 OS Version:  Mac OS X 10.7.3 (11D50b)
 Report Version:  7
 
 Backtrace:
 0   libsystem_kernel.dylib 0x7fff8ef9d67a mach_msg_trap + 10
 1   libsystem_kernel.dylib 0x7fff8ef9cd71 mach_msg + 73
 2   IOKit  0x7fff9128f923 
 io_service_open_extended + 241
 3   IOKit  0x7fff9124a5d8 IOServiceOpen + 45
 4   OpenGL 0x7fff8d5be95b
 5   OpenGL 0x7fff8d5bdbfe
 6   libsystem_c.dylib  0x7fff88934e06 pthread_once + 86
 7   OpenGL 0x7fff8d5b6ab4 CGLSetOption + 24
 8   AppKit 0x7fff89eb8501 createPixelFormat + 37
 9   AppKit 0x7fff89eb84aa -[NSOpenGLPixelFormat 
 initWithAttributes:] + 70
 
 
 Also, I keep getting these errors in the console when the app tries to 
 autosave:
 
 5/21/12 11:29:42.000 AM sandboxd: ([710]) MyAppName(710) deny file-write-data 
 /Users/me/Library/Autosave Information/Unsaved MyAppName Document 
 3.myappextension
 
 
 
 I also get messages like these, they seem to be triggered by my app from time 
 to time:
 5/21/12 4:06:58.187 AM com.apple.XType.FontHelper: FontHelper:  message 
 received. (dictionary: 0x106724d10 { count = 2, contents =
 restricted = bool: 0x7fff784e69e0: true
 query = string: 0x106726d00 { length = 113, contents = 
 com_apple_ats_name_postscript == OriyaSangamMN-Bold  
 kMDItemContentTypeTree != com.adobe.postscript-lwfn-font }
 })
 5/21/12 4:06:58.187 AM com.apple.XType.FontHelper: AutoActivation:  scopes (
   /Library/Application Support/Apple/Fonts
 )
 
 The app itself appears to be working fine (even the autosave...), but these 
 console messages are making me nervous.
 What am I supposed to do about this? Is it OK to submit an app that generated 
 these messages for App Store Review?
 
 Thanks,
 Peter
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: _updateTrackingAreas really slow

2012-05-17 Thread Corbin Dunn
Hi _murat,Please log a bug on this for us.


--corbin

On 05/17/12, mlist0...@gmail.com  mlist0...@gmail.com wrote:
 I have an NSCollectionView with really simple (i.e. no tracking areas) item 
 views. 
 
 In a test case of about 1500 items, scrolling gets unacceptably choppy. I've 
 tracked this down to calls to a private method, 
 -[NSView _updateTrackingAreas]. 
 
 While scrolling,  _updateTrackingAreas is called for my item views each time 
 they move a few pixels, even though they have no tracking areas. 
 _updateTrackingAreas in turn calls 
 -[NSNotificationCenter postNotificationName:object:userInfo:], which is what 
 is actually taking up all the time.
 
 Stubbing out _updateTrackingAreas improves the scrolling dramatically, but 
 I'd like to find a sanctioned way to at least delay the recalculation of 
 tracking areas until scrolling is done.
 
 Any pointers?
 
 _murat
 
 
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Layer hosting custom NSView and setAlphaValue

2012-05-14 Thread Corbin Dunn

On May 11, 2012, at 1:53 PM, Markus Spoettl ms_li...@shiftoption.com wrote:

 Hello,
 
  I have a layer hosting custom view which I can't convince to listen to the 
 alpha value I set on its superview. Other views sitting on the same superview 
 correctly fade with the alpha value of the superview changing. My view 
 doesn't. It simply hides when the superview's alpha is less than 1.
 
 Not sure what the problem is, the documentation for setAlphaValue doesn't 
 tell me a lot, neither does the view programming guide.
 
 Any ideas?

Hi Markus,
It sounds like the parent view which you are setting the alphaValue on is not 
layer backed, but you do apparently have a layer backed child. That won't work; 
make the parent layer backed.

corbin

 
 Regards
 Markus
 -- 
 __
 Markus Spoettl
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Layer hosting custom NSView and setAlphaValue

2012-05-14 Thread Corbin Dunn

On May 14, 2012, at 9:52 AM, Markus Spoettl ms_li...@shiftoption.com wrote:

 On 5/14/12 6:10 PM, Corbin Dunn wrote:
 I have a layer hosting custom view which I can't convince to listen to the
 alpha value I set on its superview. Other views sitting on the same
 superview correctly fade with the alpha value of the superview changing. My
 view doesn't. It simply hides when the superview's alpha is less than 1.
 
 Not sure what the problem is, the documentation for setAlphaValue doesn't
 tell me a lot, neither does the view programming guide.
 
 Any ideas?
 
 Hi Markus, It sounds like the parent view which you are setting the
 alphaValue on is not layer backed, but you do apparently have a layer backed
 child. That won't work; make the parent layer backed.
 
 Hi Corbin, thanks and sorry for not being clearer, this is my hierarchy:
 
 container (NSView)
  |
  - button 1 (NSButton)
  - button 2 (NSButton)
  - Custom View (NSView subclass, layer-hosting).
 
 I'm setting the container's alpha value, which fades both buttons, but not my 
 layer hosting custom view.

Hi Markus,
That is what I thought you had as your hierarchy. 

What I was saying is that you must set your container view to be layer backed 
(maybe even just temporarily, while your animation is happening).

The reason is that we use a separate CoreGraphics surface for the topmost view 
that hosts layers (all children views are implicitly made layer backed). Your 
top most view isn't layer backed, and we do a special alpha animation, which 
will not work with the Custom View you have made layer backed.

corbin

 
 My only guess is that there's something I need to do in my custom view but I 
 have no idea what that is.
 
 Regards
 Markus
 -- 
 __
 Markus Spoettl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Layer hosting custom NSView and setAlphaValue

2012-05-14 Thread Corbin Dunn

On May 14, 2012, at 10:49 AM, Kyle Sluder k...@ksluder.com wrote:

 On May 14, 2012, at 9:52 AM, Markus Spoettl wrote:
 
 On 5/14/12 6:10 PM, Corbin Dunn wrote:
 I have a layer hosting custom view which I can't convince to listen to the
 alpha value I set on its superview. Other views sitting on the same
 superview correctly fade with the alpha value of the superview changing. My
 view doesn't. It simply hides when the superview's alpha is less than 1.
 
 Not sure what the problem is, the documentation for setAlphaValue doesn't
 tell me a lot, neither does the view programming guide.
 
 Any ideas?
 
 Hi Markus, It sounds like the parent view which you are setting the
 alphaValue on is not layer backed, but you do apparently have a layer backed
 child. That won't work; make the parent layer backed.
 
 Hi Corbin, thanks and sorry for not being clearer, this is my hierarchy:
 
 container (NSView)
 |
 - button 1 (NSButton)
 - button 2 (NSButton)
 - Custom View (NSView subclass, layer-hosting).
 
 I'm setting the container's alpha value, which fades both buttons, but not 
 my layer hosting custom view.
 
 My only guess is that there's something I need to do in my custom view but I 
 have no idea what that is.
 
 I think you need to manually animate the alpha value of your layer-hosting 
 view's layer.
 
 When you're layer-hosting, AppKit doesn't muck with your layers. As long as 
 you perform the fade of your layer-hosting view's layer within the same 
 animation context as the animation of your superview's alpha, you should be 
 good to go.
 
 I don't know whether I'd consider your scenario a bug.

No, it is not a bug -- unfortunately, we can't make certain things go cross 
boundaries from non-layer backed to layer backed.

This has an easy solution: layer back the container.

corbin

 
 --Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Layer hosting custom NSView and setAlphaValue

2012-05-14 Thread Corbin Dunn

On May 14, 2012, at 1:14 PM, Markus Spoettl ms_li...@shiftoption.com wrote:

 On 5/14/12 8:23 PM, Kyle Sluder wrote:
 On May 14, 2012, at 11:22 AM, Corbin Dunn wrote:
 
 No, it is not a bug -- unfortunately, we can't make certain things go cross
 boundaries from non-layer backed to layer backed.
 
 This has an easy solution: layer back the container.
 
 I assumed that Markus was already doing this, since -setAlphaValue: is
 documented to throw an exception if your view isn't already layer-backed.
 
 I wasn't, and I was puzzled by this as well. I assumed the comment about the 
 exception was a documentation left-over from earlier SDK releases. It 
 definitely doesn't throw an exception when used on non-layer backed views.

Yeah, one can change the alpha value when not using layers. I guess this 
slipped through the cracks, as it has worked for a while. We draw the view (and 
children) into an image and then composite that for the real drawing.

Definitely log a documentation bug asking to clarify this.

corbin


 
 Regards
 Markus
 -- 
 __
 Markus Spoettl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSViewAnimation reversed when using NSAnimationEaseOut

2012-05-14 Thread Corbin Dunn

On May 11, 2012, at 2:35 PM, Markus Spoettl ms_li...@shiftoption.com wrote:

 Hello,
 
  using NSViewAnimation to animate a window frame, when I set the 
 animationCurve to NSAnimationEaseOut, the animation is reversed. I 
 triple-checked and logged the frames and they are set up correctly. The 
 animation dictionary looks like this:
 
   {
NSViewAnimationEndFrameKey = NSRect: {{1219, 900}, {376, 283}};
NSViewAnimationStartFrameKey = NSRect: {{1213, 900}, {408, 307}};
NSViewAnimationTargetKey = SOShapeWindow: 0x10916fe20;
}
 
 yet the window expands, instead of shrinking. If I set NSAnimationEaseIn as 
 animationCurve it works correctly, just with the wrong animation curve.

Definitely log this as a bug.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thread Deadlock

2012-05-14 Thread Corbin Dunn
It's not necessarily deadlocked, but it is definitely blocked. Please log a bug 
for NSDocument, and include any spin reports and ideally any way to reproduce 
it (if possible).

corbin

On May 14, 2012, at 4:44 PM, Graham Cox graham@bigpond.com wrote:

 Hi all,
 
 A user reported our app froze and had to be force quit, and provided this 
 trace from the crash report.
 
 It looks to me to be a classic thread deadlock in the bowels of the kernel - 
 can anyone comment? Is there anything we can do about this sort of thing, or 
 just file a bug and hope?
 
 
 --Graham
 
 Report (significantly truncated for size)
 
 
 OS Version:  10.7.3 (Build 11D50b)
 Architecture:x86_64
 Report Version:  9
 
 Parent:  launchd [150]
 
 PID: 1135
 Event:   hang
 Duration:5.24s
 Steps:   51 (100ms sampling interval)
 
 
 51 -[NSMenu 
 _populateFromDelegateWithEventRef:] + 213 (in AppKit) [0x7fff8ba8dd7f]
   51 
 -[NSDocumentControllerOpenRecentMenuDelegate updateMenu:withEvent:withFlags:] 
 + 45 (in AppKit) [0x7fff8bb102c3]
 51 
 -[NSDocumentController(NSInternal) _populateOpenRecentMenu:includingIcons:] + 
 111 (in AppKit) [0x7fff8bced0ab]
   51 
 -[NSDocumentController(NSPrivate) _recentDocumentURLsForKey:] + 146 (in 
 AppKit) [0x7fff8bcf1813]
 51 -[NSDocumentController 
 _notePendingRecentDocumentURLsForKey:] + 75 (in AppKit) [0x7fff8bce4f94]
   51 -[NSDocumentController 
 maximumRecentDocumentCount] + 169 (in AppKit) [0x7fff8bb5935a]
 51 _LSGetRecentItemCount 
 + 55 (in LaunchServices) [0x7fff9397a330]
   51 
 LSSharedFileListCopyProperty + 219 (in LaunchServices) [0x7fff9397a4f9]
 51 
 _SFLGetMaxItemCount + 25 (in OSServices) [0x7fff8e83e287]
   51 
 __psynch_mutexwait + 10 (in libsystem_kernel.dylib) [0x7fff8eae6bf2]
 Kernel stack:
 51 lo64_unix_scall + 23 (in mach_kernel) [0x2e4977]
   51 unix_syscall64 + 554 (in mach_kernel) [0x5f166a]
 51 psynch_mutexwait + 1450 (in mach_kernel) [0x5c4cba]
   51 ksyn_block_thread_locked + 77 (in mach_kernel) [0x5beddd]
 51 thread_block + 33 (in mach_kernel) [0x22f771]
   51 thread_block_reason + 331 (in mach_kernel) [0x22f62b]
 51 thread_continue + 1729 (in mach_kernel) [0x22f3a1]
   51 machine_switch_context + 582 (in mach_kernel) [0x2cba26]
 
 Thread 0x65b57  DispatchQueue 2
 User stack:
 51 _dispatch_mgr_thread + 54 (in libdispatch.dylib) [0x7fff89b9e14e]
   51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
 Kernel stack:
 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
 
 Thread 0x66e05 
 User stack:
 51 thread_start + 13 (in libsystem_c.dylib) [0x7fff8b6f0b75]
   51 _pthread_start + 335 (in libsystem_c.dylib) [0x7fff8b6ed8bf]
 51 __NSThread__main__ + 1575 (in Foundation) [0x7fff8feb06c6]
   51 -[NSThread main] + 68 (in Foundation) [0x7fff8feb074e]
 51 kevent + 10 (in libsystem_kernel.dylib) [0x7fff8eae77e6]
 Kernel stack:
 51 kqueue_scan + 480 (in mach_kernel) [0x559740]
 
 Thread 0x78af7 
 User stack:
 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
   46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
 Kernel stack:
 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
 
 Thread 0x78af8 
 User stack:
 46 start_wqthread + 13 (in libsystem_c.dylib) [0x7fff8b6f0b85]
   46 __workq_kernreturn + 10 (in libsystem_kernel.dylib) [0x7fff8eae7192]
 Kernel stack:
 46 workqueue_exit + 1808 (in mach_kernel) [0x5c6150]
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: self.myTextField.stringValue = @ fails

2012-05-09 Thread Corbin Dunn

On May 8, 2012, at 8:48 PM, Antonio Nunes devli...@sintraworks.com wrote:

 On 8 May 2012, at 23:10, Corbin Dunn wrote:
 
 
 On May 8, 2012, at 1:35 PM, Antonio Nunes devli...@sintraworks.com wrote:
 
 On 8 May 2012, at 21:46, Andy Lee wrote:
 
 Bizarre indeed. Out of curiosity, are you using ARC? Maybe the compiler is 
 confusedly zeroing a non-weak pointer. I'm *really* grasping at straws, 
 though.
 
 No ARC. No garbage collection either.
 
 Are there any bindings on the text field? Again, I don't see why it would 
 matter; just wondering.
 
 No bindings.
 
 I don't release @ anywhere, so that is indeed very, very unlikely. 
 Also, if I avoid the exception and assign @ to a text field a bit later 
 on in another piece of code, it works just fine.
 
 The same text field (toolbarPageNumberTextField), or a different one?
 
 Another text field. I'm seeing different behaviour though between letting 
 the code run naturally to the empty string assignment and manually moving 
 the PC to the line in question. I'll take another look at it after a good 
 night's sleep...
 
 You may have a formatter on the cell, and it is returning nil.
 
 Also, you are mixing what you are using the text field for. In some cases 
 you are treating it like an integer, and in others a string. I don't 
 recommend using integerValue in your case; instead, convert that integer to 
 a string (and vice-versa when you read the value via 
 self.toolbarPageNumberTextField.integerValue). If you fix those things your 
 problem will probably go away.
 
 Thanks Corbin,
 
 Indeed, there is a number formatter on the cell

Okay-- then that is the problem; the formatter is failing to format  to be a 
number, and giving 'nil' back when you call setStringValue. 

 , so probably that is causing the issue then. To make it possible to have an 
 empty text field when there are no pages in the document I changed the symbol 
 for 0:
   [self.toolbarPageNumberTextField.formatter setZeroSymbol:@]; (I did 
 not know this is possible, until a few minutes ago.)

 
 Then changed all instances of:
   self.toolbarPageNumberTextField.stringValue = 
 @;
 
 to
   self.toolbarPageNumberTextField.stringValue = 
 @0;
 

Did that fix the problem? 


 Following your recommendation I also changed
   
 self.toolbarPageNumberTextField.integerValue = 
 self.pageListController.selectionIndex + 1;
 to
   
 self.toolbarPageNumberTextField.stringValue = [NSString 
 stringWithFormat:@%d, self.pageListController.selectionIndex + 1];
 
 Why do you recommend against using integerValue? For me it would make more 
 sense to always use integerValue, especially now that I can set the value to 
 0 to show an empty text field, since we're conceptually representing numbers 
 here, not strings.

Well, it is just more consistent if you treat it all the same. Plus, when you 
read the integerValue, what NSCell doe is creates an NSScanner and scans the 
string (in the cell) for an integer and returns that value. This creates a 
scanner with your current locale...which may or may not be what you want (it 
probably is). When you call setIntegerValue it sets the objectValue of the cell 
to be an NSNumber. It really isn't an issue, but it just flip-flops the value 
type from a string to an integer back and forth. 

corbin


 
 -António
 
 
 
 ---
 Don't believe everything you think
 ---
 
 
 
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: self.myTextField.stringValue = @ fails

2012-05-08 Thread Corbin Dunn

On May 8, 2012, at 1:35 PM, Antonio Nunes devli...@sintraworks.com wrote:

 On 8 May 2012, at 21:46, Andy Lee wrote:
 
 Bizarre indeed. Out of curiosity, are you using ARC? Maybe the compiler is 
 confusedly zeroing a non-weak pointer. I'm *really* grasping at straws, 
 though.
 
 No ARC. No garbage collection either.
 
 Are there any bindings on the text field? Again, I don't see why it would 
 matter; just wondering.
 
 No bindings.
 
 I don't release @ anywhere, so that is indeed very, very unlikely. Also, 
 if I avoid the exception and assign @ to a text field a bit later on in 
 another piece of code, it works just fine.
 
 The same text field (toolbarPageNumberTextField), or a different one?
 
 Another text field. I'm seeing different behaviour though between letting the 
 code run naturally to the empty string assignment and manually moving the PC 
 to the line in question. I'll take another look at it after a good night's 
 sleep...

You may have a formatter on the cell, and it is returning nil.

Also, you are mixing what you are using the text field for. In some cases you 
are treating it like an integer, and in others a string. I don't recommend 
using integerValue in your case; instead, convert that integer to a string (and 
vice-versa when you read the value via 
self.toolbarPageNumberTextField.integerValue). If you fix those things your 
problem will probably go away.

--corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Should I pixel align in a View subclass in method -initWithFrame:frame?

2012-05-08 Thread Corbin Dunn

On May 8, 2012, at 3:16 PM, Peter Teeson ptee...@me.com wrote:

 This is a continuation of my previous issue stroking a bezier path.

Hi Peter, I'm not sure what issue you were having.
WRT:

 In my sub-class -initWithFrame:frame I do the following:
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
frame.size.width = 200.0;
frame.size.height = 200.0;
frame.origin.x = 50.0;
frame.origin.y = 50.0;
 
 Should I be pixel aligning it?

Your code above is already point aligned, there for it is pixel aligned. If the 
frame was say 200.2 or 200.5, then you should pixel align it.

 And is this the correct way?
   frame = [self convertRectToBacking: frame];
   frame = [self convertRectFromBacking: frame];

The above code doesn't do anything except convert back and forth. Say you have 
a frame origin of 200.5 that you want to be pixel aligned, you would do this:

   frame = [self convertRectToBacking: frame];

Floor in pixel space.
frame.origin.x = floor(frame.origin.x);

   frame = [self convertRectFromBacking: frame];

Now frame is pixel aligned and is back in point space.

corbin

 
   [self setFrame:frame];
   [self setNeedsDisplay:YES];
   … ….
 
 
 Thanks….
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Should I pixel align in a View subclass in method -initWithFrame:frame?

2012-05-08 Thread Corbin Dunn

On May 8, 2012, at 3:44 PM, Kyle Sluder k...@ksluder.com wrote:

 On May 8, 2012, at 3:16 PM, Peter Teeson wrote:
 
 This is a continuation of my previous issue stroking a bezier path.
 In my sub-class -initWithFrame:frame I do the following:
   self = [super initWithFrame:frame];
   if (self) {
   // Initialization code here.
   frame.size.width = 200.0;
   frame.size.height = 200.0;
   frame.origin.x = 50.0;
   frame.origin.y = 50.0;
 
 Should I be pixel aligning it? And is this the correct way?
 
 No, you should treat the view coordinate system as abstract and only pixel 
 align (using -centerScanRect:) when you need to.

Or the more modern:

- (NSRect)backingAlignedRect:(NSRect)aRect options:(NSAlignmentOptions)options

corbin

 Since Quartz coordinates refer to the infinitely-thin space between pixels, 
 the area bounded by a rectangle defined by four points is already pixel 
 aligned. You only need to shift your coordinates if you want a _line segment_ 
 defined by two points to cover whole pixels. This is why you were having 
 issues before, since strokes are applied to line segments while fills are 
 applied to the area bounded by line segments.
 
 This terminology starts to break down a bit when HiDPI gets involved. Where 
 you see pixel in the above paragraph, think of an idealized 
 device-independent pixel which maps directly to real device pixels at 1x 
 (normal) scale factor. Pixel is actually a misnomer here, but there's no 
 real good alternative term for a unit square 1pt on each side, since the 
 term point also refers to the infinitely-small location in the coordinate 
 space that is identified by a coordinate.
 
 And thankfully we only have 1x and 2x scale factors now. Previously we had 
 1.25x and 1.5x factors as well, which made dealing with fractional 
 coordinates even more confusing.
 
 --Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTableview tooltip bug?

2012-05-02 Thread Corbin Dunn
hi don,
I recommend using the builtin tooltip support in NSTableView. There is a 
delegate method to provide the tool tip. Next, you are seeing 
expansionToolTips. Look at NSCell.h for custom drawing API for them. Or, turn 
them off for your table with API on NSTableView.

corbin

On May 1, 2012, at 5:10 PM, Donald Hall d...@appsandmore.com wrote:

 I have an NSTableview column where each cell contains a file name. I use 
 tooltips (addToolTipRect and NSToolTipOwner protocol)  to show the complete 
 path to the file when the user hovers the mouse over the cell. This works 
 fine unless the name of the file exceeds the column width - 3 pixels. i.e. if 
 the width of the text for the cell is greater than (column width - 3) I get a 
 strange behaviour: the correct tooltip flashes briefly in the usual place 
 relative to the cell, then the cell itself becomes highlighted with a bright 
 yellow background. If the text width is greater than the cell width the the 
 highlighted rectangle extends over the column boundary, so I guess it is the 
 enclosing rectangle of the cell's text that is highlighted.
 
 I created a category on NSString to define a truncated string method where I 
 remove characters from the middle of the string to fit it into a specified 
 width. My workaround to this problem was to specify the column width - 3 as 
 the width I wanted for the truncated string.
 
 Has anyone else seen this? Is it a known bug?
 
 Thanks, Don
 
 
 Don Hall
 Apps  More Software Design, Inc. 
 d...@appsandmore.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: DataSource modified while TableView is displaying data

2012-04-26 Thread Corbin Dunn

On Apr 26, 2012, at 3:23 AM, Jean Suisse jean.li...@gmail.com wrote:

 Dear Peter,
 
 Thank you for your reply. Here is the requested code (see below). 
 After more investigations, I would like to take back a previous statement, 
 that the tableview was perfectly aware that the number of rows in the DS was 
 changed. This is due to my inexperience in stepping through the code across 
 multiple threads.
 
 Here are the facts :
 
 - Only the controller removes rows from the datasource. Either in response to 
 user actions (canceling tasks) or as a result of a Task completed 
 notification from a running task.
 - Each change in the dataSource is immediately followed by a reloadData 
 message sent to the TableView.
 - Sometimes, randomly, the TableView requests a row index that is out of 
 bounds by one index (e.g. row #5 when the dataSource contains only 5 
 elements).
 
 I am thinking that a redraw occurs in-between the removal of one element of 
 the table and the reloadData message. 
 For now, I did a quick fix for this issue by adding a category with 
 safeObjectAtIndex…. But one way to be certain would be to ensure that the 
 two messages (removal + reloadData) are sent without any thread/process 
 switching occurring…
 
 The code for numberOfRowsInTableView : (experimentList is an instance of 
 NSMutableAray)
 
 - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView
 { 
   return self.experimentList ? [self.experimentList count] : 0;
 }

This is fine as long as your experimentList is only ever modified on the main 
thread.

It sounds like that isn't the case, which is why you have random problems.

corbin


 
 Jean
 
 
 On 26 avr. 2012, at 11:45, Peter Hudson wrote:
 
 
 Can you post your code for numberOfRowsInTableView:
 
 Peter
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: exception in init

2012-04-04 Thread Corbin Dunn
The general rule is:

1. If it is considered a programming error, raise an exception (or assert -- it 
is the same)
2. If it is normal code flow, then don't log or do anything strange.

However, in general, it is troublesome to have init's return nil.

corbin

On Apr 4, 2012, at 4:38 AM, Ariel Feinerman arielfap...@gmail.com wrote:

 Hi,
 
 I think the question was asked and answered but I cannot see a clearance
 what is the right way to write init in the cases the arguments are nil or
 wrong?
 Returning a nil or raising an exception?
 
 - (id) initWithURL: (NSURL *) url {
 
 
 if ((self = [super init])) {
 
 if (!url) {
 
 // ?
 
 }
 
 if (![url isFileURL]) {
 
 // ?
 
 }
 
 }
 
 return self;
 
 }
 
 I can frequently see the following in init
 
 NSAssert(url, @url may not be nil, );
 
 -- 
 best regards
 Ariel
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: exception in init

2012-04-04 Thread Corbin Dunn

On Apr 4, 2012, at 9:55 AM, Jens Alfke j...@mooseyard.com wrote:

 
 On Apr 4, 2012, at 9:29 AM, Andreas Grosam wrote:
 
 The problem on Mac OS X in Cocoa Apps is, that there is no alert. The 
 application also does not stop, or terminate gracefully. The default 
 behavior of the event loop is to log an error message, and then **continue**.
 
 Not anymore. In Lion you get a very nice Internal error / An uncaught 
 exception was raised... alert, with buttons Show Details, Crash, 
 Continue.
 
 I think it's important to give the user the option to continue, even if the 
 app may be unstable. The user might have some critical unsaved data (assuming 
 this isn't an app that autosaves.)
 
 Note, this is the default behavior. If you want to handle exceptions and 
 possibly terminate the app, AFAIK it requires a very elaborated procedure, 
 unless someone proves me wrong, and shows a simple code snippet how to 
 terminate gracefully after encountering an exception.
 
 https://github.com/snej/MYUtilities/blob/master/ExceptionUtils.h
 
 Make your app's main class be MYExceptionReportingApp instead of 
 NSApplication, and exceptions will be reported with an alert. I haven't 
 tested this functionality recently so I don't know if it still works in Lion, 
 and anyway you might want to add code to no-op it in that case so the nice 
 Apple alert shows up instead.

In Lion+, I recommend using the default AppKit behavior.

(see my reply to Andreas)

corbin



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: exception in init

2012-04-04 Thread Corbin Dunn

On Apr 4, 2012, at 9:29 AM, Andreas Grosam agro...@onlinehome.de wrote:

 The problem on Mac OS X in Cocoa Apps is, that there is no alert. The 
 application also does not stop, or terminate gracefully. The default behavior 
 of the event loop is to log an error message, and then **continue**.

No, there is an alert! you just have to turn it on.  From:

https://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKit.html

AppKit now has the ability to report uncaught exceptions. It is controlled by 
a user default: NSApplicationShowExceptions (YES/NO). The default shipping 
value is NO. In general, it is recommend that developers set it to YES during 
development to catch programming errors. Individual applications can 
automatically turn this on by using [[NSUserDefaults standardUserDefaults] 
registerDefaults: ...] to register the option on. It can be set with defaults 
via: 'defaults write com.yourdomain.app NSApplicationShowExceptions YES'. It 
can also globally be turned on by writing to the global domain.

--corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Round corners of borderless NSWindow without set it transparent

2012-02-29 Thread Corbin Dunn

On Feb 28, 2012, at 12:54 PM, Andrea3000 andrea3...@email.it wrote:

 Il giorno 28/feb/2012, alle ore 20:20, Corbin Dunn ha scritto:
 
 
 On Feb 27, 2012, at 11:51 PM, Andrea3000 andrea3...@email.it wrote:
 
 When the window is small it's as fast as if it were opaque but when it 
 occupies quite all the screen (1920x1080) it becomes noticeably slow during 
 resize.
 
 Did you sample it or use Instruments? What is slow?
 
 The resize is slow. 

Yes, I realize you said it is slow, but you haven't said *why*. You need to 
sample it or use Instruments to find out what is slow and why. 

-corbin


 When the window is small I can resize it as fast as I want and the resize 
 animation is smooth, the window changes size gradually with continuity. 
 
 On the other hand, when the window occupies a big portion of the screen and I 
 resize it fast (I mean, not like a mad..just not slowly) it is sluggish 
 during resize animation
 and the bottom right corner of the window doesn't follow the mouse pointer 
 immediatly, there is always a little delay.
 
 This happens regardless of what I display in the NSOpenGLView, it happens 
 even with only a uniform color background.
 Just for completeness, I use a CVDisplayLink to draw to the OpenGLContext and 
 the context is set to flush buffers in sync with the refresh of the monitor.
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Round corners of borderless NSWindow without set it transparent

2012-02-28 Thread Corbin Dunn

On Feb 27, 2012, at 11:51 PM, Andrea3000 andrea3...@email.it wrote:

 Thank you for the answer.
 
 Il giorno 28/feb/2012, alle ore 06:36, Seth Willits ha scritto:
 
 On Feb 27, 2012, at 5:45 AM, Andrea3000 wrote:
 
 Then, if I set my NSWindow non-opaque I correctly get rounded corners but 
 the window becomes very slow expecially during resize. 
 
 Mmm…. that doesn't sound right. You shouldn't notice anything being slow.
 
 When the window is small it's as fast as if it were opaque but when it 
 occupies quite all the screen (1920x1080) it becomes noticeably slow during 
 resize.

Did you sample it or use Instruments? What is slow?

corbin



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Recommendation: Turn on NSApplicationShowExceptions on your development machines

2012-02-24 Thread Corbin Dunn
Hi Cocoa Developers,

I really recommend turning on this new default that was introduced in Lion:

 defaults write NSGlobalDomain NSApplicationShowExceptions YES

It will let you catch exceptions in your app even when not running under the 
debugger. See the AppKit release notes for more information.

--corbin dunn



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)

2012-02-24 Thread Corbin Dunn

On Feb 23, 2012, at 9:28 AM, Antonio Nunes devli...@sintraworks.com wrote:

 I have a few popovers that, as far as I'm aware of, were working fine up to 
 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it 
 often disappears, whether the click is on the background or on a UI item. I 
 haven't figured out the trick exactly of the way in which clicking makes the 
 popover go away, but it appears to be sensitive to how you click. A popover 
 should never go away though when it is clicked upon. I think this is a bug in 
 10.7.3. Various internet searches for this issue did not return any results, 
 nor did searching Apple's developer forums.
 
 Any ideas what might be causing this, or how to work around the issue? Has 
 anyone else even encountered this issue?

I don't believe we changed NSPopover in 10.7.3, but it is possible that 
something else is affecting this.

It sounds like something outside of the popover is becoming the first 
responder, and that causes the popover to go away.

-corbin


 
 -António
 
 -
 Accepting others as they are
 brings a wonderful freedom
 to your own mind.
 
 --The Peace Formula
 -
 
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: auto malloc[27012]: attempted to remove unregistered weak referrer

2012-01-20 Thread Corbin Dunn

On Jan 18, 2012, at 3:47 PM, Marco S Hyman wrote:

 I've done some searches and haven't found anything regarding this
 in my situation.  An appropriate RTFM pointer would be appreciated.
 
 I'm running a *garbage collected* application in Lion (10.7.2) that was
 most recently compiled using Xcode 4.2.1.   I'm getting these messages
 logged: auto malloc[27012]: attempted to remove unregistered weak referrer 
 0xblahblah
 multiple times. What is most interesting is that it only happens when
 selecting multiple items by dragging.  I first noticed it in this code:
 
 - (IBAction) showOpenPanel: (id) sender
 {
BOOL reloadNeeded = NO;
BOOL showWarning = NO;
 
NSOpenPanel *panel = [NSOpenPanel openPanel];
CFArrayRef types = CGImageSourceCopyTypeIdentifiers();
CFMakeCollectable(types);
[panel setAllowedFileTypes: (NSArray*) types];
[panel setAllowsMultipleSelection: YES];
[panel setCanChooseFiles: YES];
[panel setCanChooseDirectories: NO];
NSInteger result = [panel runModal];
if (result == NSOKButton) {
   // this may take a while, let the user know we're busy
   [self showProgressIndicator];
   NSArray *urls = [panel URLs];
   for (NSURL *url in urls) {
NSString *path = [url path];
   if (! [self isDuplicatePath: path]) {
   [imageInfos addObject: [ImageInfo imageInfoWithPath: path]];
   reloadNeeded = YES;
   } else
   showWarning = YES;
   }
   [self hideProgressIndicator];
 
   if (reloadNeeded)
   [tableView reloadData];
   if (showWarning) {
   NSAlert *alert = [[NSAlert alloc] init];
   [alert addButtonWithTitle: NSLocalizedString(@CLOSE, @Close)];
   [alert setMessageText: NSLocalizedString(@WARN_TITLE, @Files not 
 opened)];
   [alert setInformativeText: NSLocalizedString(@WARN_DESC, @Files 
 not opened)];
   [alert runModal];
   }
}
 }
 
 In the open panel I can click, move the mouse, then shift-click and all is OK.
 If instead I click and drag I get the error multiple times.

Get the error...what error?


  So where did I
 go wrong?

Depends on what your code does in various things, ie: isDuplicatePath:

:)

.corbin

 
 Thanks,
 
 Marc___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: auto malloc[27012]: attempted to remove unregistered weak referrer

2012-01-20 Thread Corbin Dunn

On Jan 20, 2012, at 7:07 AM, Sean McBride wrote:

 On Wed, 18 Jan 2012 15:47:47 -0800, Marco S Hyman said:
 
 I've done some searches and haven't found anything regarding this
 in my situation.  An appropriate RTFM pointer would be appreciated.
 
 I'm running a *garbage collected* application in Lion (10.7.2) that was
 most recently compiled using Xcode 4.2.1.   I'm getting these messages
 logged: auto malloc[27012]: attempted to remove unregistered weak
 referrer 0xblahblah
 
 Have you tried the various debugging environment variables?
 
   NSOpenPanel *panel = [NSOpenPanel openPanel];
   CFArrayRef types = CGImageSourceCopyTypeIdentifiers();
   CFMakeCollectable(types);
   [panel setAllowedFileTypes: (NSArray*) types];
 
 You can avoid the cast using NSMakeCollectable (which also handles nil 
 better).
 
 In the open panel I can click, move the mouse, then shift-click and all is 
 OK.
 If instead I click and drag I get the error multiple times.  So where did I
 go wrong?
 
 In my GC app, I haven't seen this, but am having various problems with 
 NSOpenPanel... half the time, it shows nothing.

I don't know if I saw a report on this come through. Did you log a bug on it?

You could try calling validateVisibleColumns after it is visible as a 
hack/workaround.

corbin






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Does NSOpenGLView override -isOpaque?

2012-01-09 Thread Corbin Dunn

On Jan 6, 2012, at 11:57 AM, vincent habchi wrote:

 Corbin,
 
 Yes, NSOpenGLView has:
 
 - (BOOL)isOpaque {
   return YES;
 }
 
 Thanks for your answer!
 
 Could the documentation then mention than when an NSOpenGLView occupies the 
 whole frame of its parent window, and when its context is set to draw under, 
 one should override -isOpaque to return NO, otherwise nothing gets drawn?

Hi Vincent,
Yes, we can improve the docs! Can you log a bug on bugreporter.apple.com asking 
for it to be improved? that is the best way to get this updated.

thanks,
corbin

 
 Thanks again, have a nice day!
 Vincent

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Does NSOpenGLView override -isOpaque?

2012-01-06 Thread Corbin Dunn

On Jan 6, 2012, at 3:03 AM, Vincent Habchi wrote:

 Hi there, and happy new year to everybody!
 
 I had to battle to correctly display an NSOpenGLView whose context was set to 
 draw under (Glint swapInt = 1; [[self openGLContext] setValues:swapInt 
 forParameter:NSOpenGLCPSwapInterval];). It seems that NSOpenGLView silently 
 overrides the -isOpaque method of NSView to return YES instead of NO; Is that 
 intended behavior (I can’t find any documentation about it)?
 

Yes, NSOpenGLView has:

- (BOOL)isOpaque {
return YES;
}

corbin

 Cheers!
 Vincent
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Retained Outlet

2011-11-18 Thread Corbin Dunn
You are probably orphaning (which is a leak), your window controller subclass. 
Make sure it's dealloc is called; I'm guessing it won't be. This isn't shown in 
leaks, since it isn't a true leak.

corbin

On Nov 18, 2011, at 11:22 AM, Richard Somers wrote:

 On Nov 18, 2011, at 9:31 AM, Kyle Sluder wrote:
 
 On Fri, Nov 18, 2011 at 8:23 AM, Richard Somers wrote:
 The normal pattern for Interface Builder Outlets is assign but I have an 
 outlet that must be retained to work corectly. The outlet is not in File's 
 Owner but is in a custom view in a window.
 
 It is very important that you specify whether you're working on iOS or Mac 
 OS X, and whether your outlet points to a top-level object.
 
 I am working on Mac OS X. The outlet points to a top-level object.
 
 Maybe you can answer your own question by re-reading the Resource 
 Programming Guide:
 
 In general, you are responsible for releasing top-level objects in a nib 
 file. But my File's Owner is an instance of NSWindowController so it will 
 release top-level objects for me.
 
 The outlet in question is in a custom class and requires a setter with retain 
 semantics. NSWindowController will use this setter for the outlet when 
 loading the nib.
 
 Object ownership policy seems a little blurry here. Normally a class will 
 initialize its ivars and then cleanup in dealloc. But the custom class never 
 initializes the outlet. The nib loading machinery initialize the outlet.
 
 So that may mean NSWindowController knows that the outlet has retain 
 semantics and will set the outlet to nil when releasing top-level objects. If 
 not then the class should release the outlet in its dealloc method. I am 
 confused, which one is it?
 
 Maybe I am looking at this wrong. If a class, any class, has an ivar with 
 retained property semantics, it will be initialized to nil even if the class 
 does not explicitly initialize the ivar. In the class dealloc method it 
 should directly release the ivar regardless. If the ivar points to an object, 
 for what ever reason, it will receive a release message. If the ivar is nil, 
 for what ever reason, a release message will go to nil. Either way it works. 
 It this the correct way to look at this?
 
 --Richard
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sandboxing disallows AppleEvents?

2011-11-03 Thread Corbin Dunn
You should log bugs for things which you need to do, but cannot. Please log 
them!

corbin

On Nov 3, 2011, at 11:10 AM, Rick Mann wrote:

 Really? I get how that kind of functionality has made Windoze such a security 
 hole forever, but there are so many Mac applications that depend on being 
 able to send AppleEvents, especially within a suite of applications (all from 
 the same vendor).
 
 Is there no facility for doing this?
 
 Thanks,
 
 -- 
 Rick
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: inserting/removing items in NSOutlineView subclass

2011-11-03 Thread Corbin Dunn
It is sufficient to log a bug and include your app (or how to download your 
app).

corbin

On Nov 3, 2011, at 12:59 PM, Sebastien Boisvert wrote:

 
 
 Those 3 lines were literally pulled directly from my code (call to 
 -beginUpdates, then the call to remove the items, then the call to 
 -endUpdates), so I'm definitively calling it.
 
 I'll try to reproduce it in a simpler test case, but the error gives no clue 
 of what the real cause is so that might be very difficult.
 
 
 
 Hi Sebastien,
 
 
 Your code looked like pseudo code, since it lacked spacing. I think you 
 should still double check if it is called.
 
 As I said before, if you think it is a bug in appkit, please log it at 
 bugreporter.apple.com -- but please include a test app, as I haven't been 
 able to reproduce this myself, and this is the first i've heard of the 
 method not working.
 
 
 corbin
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: inserting/removing items in NSOutlineView subclass

2011-11-01 Thread Corbin Dunn
Hi Sebastien,

Your code looked like pseudo code, since it lacked spacing. I think you should 
still double check if it is called.

As I said before, if you think it is a bug in appkit, please log it at 
bugreporter.apple.com -- but please include a test app, as I haven't been able 
to reproduce this myself, and this is the first i've heard of the method not 
working.

corbin

On Nov 1, 2011, at 10:04 AM, Sebastien Boisvert wrote:

 As you can see from the sample code I provided, I call -beginUpdates and 
 -endUpdates around it.
 
 Full stack trace below. Could the fact that it was being done during a 
 notification being handled have something to do with it?
 
 I was able to avoid the exception by calling the code async on the main 
 thread, but that's not really a workable solution for me.
 
 
 Stack Trace:(
 0   CoreFoundation  0x7fff8672c286 
 __exceptionPreprocess + 198
 1   libobjc.A.dylib 0x7fff8aad4d5e 
 objc_exception_throw + 43
 2   CoreFoundation  0x7fff8672c0ba +[NSException 
 raise:format:arguments:] + 106
 3   Foundation  0x7fff8c4757d3 
 -[NSAssertionHandler 
 handleFailureInMethod:object:file:lineNumber:description:] + 169
 4   AppKit  0x7fff8e89f32b -[NSTableView 
 _doUpdatedWorkWithHandler:] + 133
 5   AppKit  0x7fff8ebd5f35 -[NSOutlineView 
 removeItemsAtIndexes:inParent:withAnimation:] + 214
 6   MyFrmwrk 0x0001003b0ddb -[MyOutlineView 
 endEditing] + 347
 7   MyFrmwrk 0x0001003b2177 
 -[MyCustomEditView controlTextDidEndEditing:] + 215
 8   Foundation  0x7fff8c3c0de2 
 __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 
 47
 9   CoreFoundation  0x7fff866d4e0a 
 _CFXNotificationPost + 2634
 10  Foundation  0x7fff8c3ad097 
 -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
 11  AppKit  0x7fff8ecc5f67 -[NSTextField 
 textDidEndEditing:] + 374
 12  Foundation  0x7fff8c3c0de2 
 __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 
 47
 13  CoreFoundation  0x7fff866d4e0a 
 _CFXNotificationPost + 2634
 14  Foundation  0x7fff8c3ad097 
 -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
 15  AppKit  0x7fff8ed1d361 
 -[NSTextView(NSPrivate) _giveUpFirstResponder:] + 438
 16  AppKit  0x7fff8ed0123e 
 -[NSTextView(NSKeyBindingCommands) insertNewline:] + 537
 17  CoreFoundation  0x7fff8671ba1d -[NSObject 
 performSelector:withObject:] + 61
 18  AppKit  0x7fff8ec1bbad -[NSResponder 
 doCommandBySelector:] + 62
 19  AppKit  0x7fff8ecf690e -[NSTextView 
 doCommandBySelector:] + 198
 20  AppKit  0x7fff8eb4 
 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) 
 interpretEventAsCommand:forClient:] + 1799
 21  AppKit  0x7fff8eea1b4a 
 -[NSTextInputContext handleEvent:] + 747
 22  AppKit  0x7fff8ed6deaf -[NSView 
 interpretKeyEvents:] + 248
 23  AppKit  0x7fff8ece6c65 -[NSTextView 
 keyDown:] + 691
 24  AppKit  0x7fff8e7c6544 -[NSWindow 
 sendEvent:] + 7430
 25  AppKit  0x7fff8e75e68f -[NSApplication 
 sendEvent:] + 5593
 26  AppKit  0x7fff8e6f4682 -[NSApplication 
 run] + 555
 27  AppKit  0x7fff8e97380c NSApplicationMain 
 + 867
 28  Daylite 0x00019862 main + 34
 29  Daylite 0x00019834 start + 52
 30  ??? 0x0005 0x0 + 5
 
 
 
 
 
 From: Corbin Dunn corb...@apple.com
 To: Sebastien Boisvert sebastienboisv...@yahoo.com
 Cc: cocoa-devDev cocoa-dev@lists.apple.com
 Sent: Monday, October 24, 2011 11:45:27 AM
 Subject: Re: inserting/removing items in NSOutlineView subclass
 
 hi sebastien,
 Are you sure you are calling beginUpdates? At what point are you doing the 
 code below in your subclass? Also, can you post the complete stack trace?
 
 If you think it is a bug in appkit, please log it at bugreporter.apple.com 
 -- but please include a test app, as I haven't been able to reproduce this 
 myself, and this is the first i've heard of the method not working.
 
 corbin
 
 On Oct 22, 2011, at 7:56 PM, Sebastien Boisvert wrote:
 
 I have an NSOutlineView subclass that does the following to remove a row:
 
 [self beginUpdates];
 [selfremoveItemsAtIndexes

Re: inserting/removing items in NSOutlineView subclass

2011-10-24 Thread Corbin Dunn
hi sebastien,
Are you sure you are calling beginUpdates? At what point are you doing the code 
below in your subclass? Also, can you post the complete stack trace?

If you think it is a bug in appkit, please log it at bugreporter.apple.com -- 
but please include a test app, as I haven't been able to reproduce this myself, 
and this is the first i've heard of the method not working.

corbin

On Oct 22, 2011, at 7:56 PM, Sebastien Boisvert wrote:

 I have an NSOutlineView subclass that does the following to remove a row:
 
 [selfbeginUpdates];
 [selfremoveItemsAtIndexes:[NSIndexSetindexSetWithIndex:editingRow] 
 inParent:nilwithAnimation:NSTableViewAnimationEffectNone];
 [selfendUpdates];
 
 However, when the above runs, I get the following exception:
 
 *** Assertion failure in -[MyOutlineView _doUpdatedWorkWithHandler:], 
 /SourceCache/AppKit/AppKit-1138.23/TableView.subproj/NSTableView.m:14634
 Exception detected while handling key input.
 Exception Name: NSInternalInconsistencyException
 Exception Reason: NSTableView Error: Insert/remove/move only works within a 
 -beginUpdates/-endUpdates block.
 
 
 Huh? The row index is valid, I'm not overriding any of the above methods, and 
 the calls are balanced, so I don't know why I get this.
 
 I get the same thing if I try to add a row, but discovered that if I have the 
 outline view's delete do it instead, that works, but don't know/explain why. 
 Unfortunately I can't use that workaround in the situation I use the code 
 above for.
 
 Any ideas?
 
 
 Here's the relevant part of the stack trace:
 
 0   CoreFoundation  0x7fff8672c286 
 __exceptionPreprocess + 198
 1   libobjc.A.dylib 0x7fff8aad4d5e 
 objc_exception_throw + 43
 2   CoreFoundation  0x7fff8672c0ba +[NSException 
 raise:format:arguments:] + 106
 3   Foundation  0x7fff8c4757d3 
 -[NSAssertionHandler 
 handleFailureInMethod:object:file:lineNumber:description:] + 169
 4   AppKit  0x7fff8e89f32b -[NSTableView 
 _doUpdatedWorkWithHandler:] + 133
 5   AppKit  0x7fff8ebd5f35 -[NSOutlineView 
 removeItemsAtIndexes:inParent:withAnimation:] + 214
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: OutlineView Expand Animation

2011-10-17 Thread Corbin Dunn
Hi Leonardo,

On Oct 17, 2011, at 11:15 AM, Leonardo wrote:

 Hi,
 I am developing a timeline interface. I have a splitView with 2 views.
 The left one contains an outlineView displaying the name of the tracks.
 The right one contains a simple view containings a blue rectangle (the
 track) that can be dragged horizontally by the user.
 Before Lion I used to expand the outlineView and programmatically show some
 line more on the right view. That worked pretty well.
 With Lion, when I expand the outlineView I automatically get an animation.
 And this animation doesn't match the right view. So my questions are:
 
 1) How can I animate the right view with the expansion of the outlineView
 synchronously?

There's no easy way to hook into it.

 2) Do you think I have to use a right outlineView too and sync these 2
 outlineViews? If so, how to manage the Blue Track dragging within a cell?

 3) Can I turn off this outlineView automatic animation?

Please log a bug requesting the ability to turn off the animations, and to 
allow you to easily synchronize other animations with them.

thanks!

corbin

 
 
 Regards
 -- Leonardo
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Sandboxing + NSSavePanel's accessoryView

2011-10-10 Thread Corbin Dunn
Hi Rimas,
It sounds like a bug in sandboxing in AppKit. Can you log a bug on this? And 
(if possible, but not required) include a sample application that reproduces 
it. 

A work around is to just always set the accessoryView.

thanks,
corbin

On Oct 10, 2011, at 3:17 AM, Rimas M. wrote:

 Hello,
 
 I am trying to enable sandboxing in my app, and I am dealing with a very
 strange behavior. I am not sure if this is a bug of Lion/Sandboxing or I
 have missed something in documentation.
 
 In save panel I am using a custom accessoryView which is set in -
 (BOOL)prepareSavePanel:(NSSavePanel *)savePanel. I am setting setting
 accessory view to the real one only if savePanel's - (BOOL)isExpanded
 returns YES. Otherwise I am setting it to nil.
 To handle save panel's expansion I am using - (void)panel:(id)sender
 willExpand:(BOOL)expanding from NSOpenSavePanelDelegate. If expanding ==
 YES, I am setting the real accessory view, and nil if expanding==NO.
 
 That worked very well on Snow Leopard. It even works well on Lion without
 sandboxing. But if sandboxing is enabled, it does not work. When save panel
 is displayed and I am trying to expand it, expands and collapses back. It is
 impossible to expand it.
 
 Log has showed, that I am getting - (void)panel:(id)sender
 willExpand:(BOOL)expanding with expanding==YES and the second one
 with expanding==NO. At the moment I have no clue what is going on.
 
 Any thoughts about this behavior would be very appreciate.
 
 Best Regards,
 
 Rimas M.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Finder Integration

2011-09-30 Thread Corbin Dunn
Hi Damon,

On Sep 29, 2011, at 12:39 PM, Damon Allison wrote:

 Hello,
 
 I am researching options for integrating with Finder. In particular, I would 
 like my application to provide file and directory icon overlays similar to 
 how Dropbox.app overlays green and blue images on top of file and folder 
 images.
 
 I noticed a few applications (svn utilities) that have used 
 `/Library/Contextual Menu Plugins` plugins to accomplish this. I've also seen 
 programs use SIMBL [1] plugins. Contextual Menu Plugins appears to have been 
 replaced by Automator Services, and SIMBL seems like an unsupported hack.
 
 Is there an 'official' way to integrate with the finder?

No. You are welcome to log bugs asking for an API to do whatever you want.

 If so, what is it? If not, how does dropbox accomplish their finder 
 integration? 

Via hacks, which are probably not compatible from release to release of OS X.

corbin

 
 Either way, I would certainly appreciate any information / source code you 
 could provide.
 
 
 Thanks,
 Damon
 
 [1] SIMBL : 
 http://www.culater.net/software/SIMBL/SIMBL.php___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Receiving Crash Reports

2011-09-30 Thread Corbin Dunn

On Sep 29, 2011, at 10:51 AM, Sean McBride wrote:

 On Thu, 29 Sep 2011 09:12:31 -0600, koko said:
 
 Thanks to all for suggestions.
 
 I was unaware that crash reports were routed to our iTunes Connect
 account .  Question here, we distribute through the App Store as well
 other means.  So, will all be routed or just those that came fe the App 
 Store?
 
 I had been looking at UKCrashReporter and plcrashreporter and have not
 investigarted far enough to make a decision.
 
 I found FeedbackReporter to be the best since it can also report exceptions 
 in addition to just crashes.

AppKit does this by default in Lion. It is available via a user default:

NSApplicationShowExceptions (YES/NO)

I recommend all developers turn it on. When an exception is thrown, it gives 
you a chance to crash the app and generate a crash report.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


  1   2   3   4   5   6   >