Re: Accessing a property of a view via its controller doesn't work

2021-09-04 Thread Greg Weston via Cocoa-dev
> I access the window of a view by two different ways, in the controller and in 
> the view, resp., and in the controller, I always get a nil pointer.

Have you verified that the view you’re accessing in the controller is the same 
instance as the one that works?
___

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: What is the preferred way to set NSTextView content from NSAttributedString?

2020-02-02 Thread Greg Weston via Cocoa-dev
> - I want to set the displayed contents of V to T2.
> 
> What is/are the recommended way/s to do this?
> 
> *I would hope that I could assign V.attributedString = T2, but alas the
> world does not seem to be this simple.*

The documentation suggests you should be working with the view’s textStorage 
which is a mutable attributed string. So... just clear it out and reset the 
contents from T2?
___

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: Need for Swift

2019-10-15 Thread Greg Weston via Cocoa-dev

> This discussion about Swift vs Objective-C is interesting, but I think it
> omits something important. Both those languages only build apps for Apple
> products.

This was probably “omitted” because it’s not actually true.
___

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


NSImage to JPEG file?

2019-01-16 Thread Greg Weston

>> That would be poor API design. If it had -writeToFile, then it would also 
>> need -writeToStream:, -writeToFileHandle:, -writeToFileDescriptor:, 
>> -writeToNSURLSessionDataDelegate:, etc.
>> Providing the data itself means you can then use existing APIs on other 
>> classes to put the data anywhere you want.
> 
> But all of that would come "for free" if NSImage inherited from NSData, no?

No. Because there’s no guarantee that the “data” that define an NSImage - or 
its representation(s) - conform to any specific commodity format.
___

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: NSDrawer

2018-07-15 Thread Greg Weston
Casey McDermott wrote:

> NSPanel is still modal, but longer lasting.  We use it a lot, and it
> looks better than the modal dialogs in the current app.

I read in digest mode so maybe this has already been pointed out, but NSPanel 
is not modal.
___

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: NSComboBox -comboBox:completedString: not called

2018-03-13 Thread Greg Weston

> So, to answer my own question, I can "get this to work" using a custom 
> NSComboBoxCell 
> subclass, implementing -completedString.
> 
> Having seen this in action I must confess this is a Bad Idea™.

You’re describing long-standing documented behavior and the correct approach to 
achieve the alternative behavior you want. Where’s the Bad Idea?
___

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: NSCollectionView selection behavior is insanely bad

2017-04-26 Thread Greg Weston
> Instead of doing the right thing when shift-clicking (selecting a range from 
> the anchor), it simply adds/removes the clicked item to/from the selection. 
> That's unlike pretty much any Apple matrix-of-items selection behavior ever.

You mean it selects like Finder icon views have since 1984? Like a collection 
of discrete items instead of a continuum?
___

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


New iTunes visual plugin SDK?

2017-03-27 Thread Greg Weston
So, apparently iTunes 12.6 doesn't support older plugins any more. Has anyone 
seen or heard news of a new SDK so those of us who have created plugins can 
update them?

Greg
___

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: Overriding the release mehod

2017-01-25 Thread Greg Weston
Dave wrote:

> I hate it when people ask [why are you doing X]!

Decades of experience seeing such questions make us think that when someone is 
asking how to do something extraordinary there's about 99% chance they don't 
actually need to do it and are making things harder for themselves. Sometimes 
the best answer to "How do I do X?" is "You don't. Do Y instead." If someone is 
trying to give the best answer they may need to know what the asker is really 
trying to accomplish.
___

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: Limiting app installation

2016-09-05 Thread Greg Weston
> Does Apple allow a developer to limit the number of devices on which an app 
> can run? I have an app that requires you to pay more to install it on more 
> than one iPhone and two iPads. It should go without saying these are all on 
> the same Apple ID.
> 
> I thought Apple didn't allow this. But maybe they just don't provide a 
> mechanism for imposing this limitation, but don't prevent developers from 
> implementing their own?

The EULA tells personal users that they can install an app on any device they 
own, and business users that it can either be installed on all devices 
controlled by one user or on a single device shared among multiple users. I 
would expect attempts to override that promise to be frowned upon.
___

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: Objective-C basics - (Why NSNumber conforms to NSCopying protocol)

2016-08-11 Thread Greg Weston
>> 2. The fact than an object is immutable does not (in general) mean that a 
>> copy can be represented by the same object reference. For example, an object 
>> that contained its own date of creation might be immutable, but a copy might 
>> have a different date, and therefore be a different object. Putting this 
>> another way, the immutability does not make NSCopying conformance irrelevant.
> 
> Are there any real world examples of this in the Cocoa flora of objects?  If 
> you had asked me before reading your response I would have called the 
> behavior you describe a bug.  I would have said the result of -copy on an 
> object should have the same -hash and return true for -isEqual:.

The fact that internal instance variables are not identical does not mean that 
hash and isEqual cannot work as intended. It would only be a bug if the 
contract is broken. That's the point of requiring functional identity rather 
than strict identity.

Whether there are real examples of this in Cocoa is hard to say, because we're 
talking inherently about things that aren't part of a class' interface.
___

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: discontiguous bounds ?

2016-05-09 Thread Greg Weston
> I wish to provide a facility with a NSTableView wherein the leftmost  
> (specifiable) columns remain statically on the left of the display  
> (subject to vertical scrolling) while the remaining columns scroll  
> normally constrained to the right of the static columns. I've done  
> this successfully (and easily) on mainframe (ISPF) applications, but  
> I'm not able to come up with a Cocoa implementation short of using two  
> separate NSTableView's with attendant bag-of-worms complexity.
> If I were wishing, I could wish for the ability to specify multiple  
> discontiguous areas for the bounds of a view.

So just to clarify, you're looking for the typical spreadsheet option (such as 
Numbers offers) to specify an arbitrary number of header columns?
___

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: Where are my bytes hiding?

2016-05-05 Thread Greg Weston

> Second question:
> Finder says about the containing folder: 11,239 bytes (33 KB on disk) for 9 
> items
> 11,239 = sum of TotalFileSizes of the 8 files in this folder.
> But where do the “33 KB on disk” come from? 8 times “Zero bytes on disk” 
> should be zero, shouldn’t it?

Surely "xxx on disk" is counting allocation blocks rather than bytes
___

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: Panes vs. Separate Windows

2016-01-11 Thread Greg Weston
> (I also don’t want to restart Xcode wars, but I do actually believe that the 
> unified window style that arrived in Xcode 4 was an actual decision about 
> which worked best, made by clever people who actually thought about it. It 
> wasn’t — I believe — merely clueless. I also want to point out that Xcode 3 
> was *hugely* criticized for its window bloat.)

For what it's worth, I felt like the changes to Xcode over the last few 
versions were most likely motivated by the notion that Xcode should 
superficially mimic Eclipse.

I loathe Eclipse.

I barely write for Apple platforms any more, and in all honesty Xcode is a 
non-trivial part of that.
___

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: LSSharedFIleList API deprecated

2015-12-09 Thread Greg Weston
> I opened a radar a while back and got this answer:
> 
> "Shared file lists are no longer supported. There is no exact replacement 
> API.”
> “If you want to manage your recent documents list, you should use 
> NSDocumentController."
> “If you want to run a background tool independent of your main application, 
> you should use a Launch Agent."
> 
> My application already uses NSDocumentController; however, there is no means 
> to remove a recent item from the list and my application uses 
> LSSharedFileListItemRemove. I updated the radar with the need to remove 
> recent items. No word yet.
> —kevin

While not optimal, I would imagine this could be accomplished with a 
combination of recentDocumentURLs, clearRecentDocuments: and 
noteNewRecentDocumentURL:.

Greg
___

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: The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Greg Weston


> It's been about 4 or 5 years since I made this mistake but I've just seen a 
> massive swath of code where every access of a dictionary object is using 
> valueForKey instead of objectForKey.
> 
> I've got a few examples of why this is a "really bad idea"™, 

I would like to see these examples, because I can't think of any reason why it 
should be a bad idea. Per the documentation, it's a wrapper around 
objectForKey: with one special case.
___

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: The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Greg Weston


> On Nov 10, 2015, at 15:21, Alex Zavatone  wrote:
> 
> 
>> Yeah.  Honestly, I'm looking for cases that would justify why all the 
>> dictionary object access blocks in this code that use valueForKey are 
>> wrapped with @try/@catch clauses.  I've never seen cases with objectForKey 
>> that would trying to catch exceptions accessing dictionary objects.

It's really difficult to say what that coder's motivation was at that time. For 
all we know, it was a habit carried over from .NET by someone new to Cocoa. 
___

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: Handling http:// URLs

2015-10-14 Thread Greg Weston
>>  
> Admittedly, I'm currently struggling to find a concrete example of why this 
> is useful, but I just know it is:

This, I think, is one of those phrases that should give one pause when posting. 

> Any app(s) should be able to register URL patterns they're able to handle. If 
> the user takes an action that results in a URL being requested that one or 
> more of these apps could handle, iOS should present the user with a list of 
> these URLs, and get the user's permission to then handle the URL.

You could contrive a use case for just about any behavior you could imagine. 
Lacking the aforementioned concrete example, I can't come up with any of my own 
that aren't handled at least as well by a more "normal" mechanism and it 
strikes me that this has much more potential for abuse, or at least confusion 
and annoyance, than for unique utility.

Greg
___

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 transfer data by using light

2015-09-17 Thread Greg Weston

> This toy can connect to the iphone's network by detecting the blinking
> screen of an iPhone. I wonder if it is possible that using this technique
> to transfer data.

Absolutely. Such techniques have been used for 150 years, using lamps or 
reflected sunlight to send Morse-like codes to human observers. Consumer 
computer applications date back at least 20 years, such as the Timex Datalink 
watch.

As a practical matter, this is the same task as interpreting a 1D barcode, such 
as a UPC label.
___

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: Possible to defer initialization of let variable?

2015-07-07 Thread Greg Weston
 If you ask the wrong question, you get a wrong answer. :)
 
 Whether or not it was the wrong question is debatable.

Honestly I find that assertion suspect considering that you've moved the 
goalposts three times.
___

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: Idea for Improving Vibrancy

2015-02-16 Thread Greg Weston
 I have an idea for improving vibrancy
 
 Me too. Kill it.

Ditto. I look at vibrancy as Apple showing Microsoft how to do Glass right 
without questioning whether it should be done at all. To me, consume extra 
resources in order to reduce the usability of the system is a fundamentally 
flawed pursuit.
___

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: Am I Reinventing the Wheel? (Part I)

2015-01-08 Thread Greg Weston
Aandi Inston wrote:
 (This is in addition to the five characters prohibited in strings because
 they are XML markup).

Minor nit. There are only 2 prohibited characters in XML, whether in a string 
or out.
___

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: NSCoding vs NSSecureCoding

2014-06-17 Thread Greg Weston
Sean McBride wonders:

 I was modernizing some of my code to support NSSecureCoding instead of just 
 NSCoding and stumbled upon that fact that NSColor and NSImage support only 
 NSCoding and not NSSecureCoding.  Whereas NSURL, NSData, NSArray and 
 countless others now support NSSecureCoding.
 
 Is it just that Apple hasn't gotten around to NSColor and NSImage, or is 
 there some rationale I'm not seeing?

Given my understanding of NSSecureCoding's implications/promises, I'm thinking 
NSColor and NSImage may have nothing to gain by implementing that protocol. 
Perhaps the (current) encoded form of those types is only a collection of 
scalars; object substitution isn't a meaningful concern.
___

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