CALayer renderInContext changes zPosition of some child layers

2013-01-03 Thread Markus Spoettl

Hello,

  I'm having a hard time understanding a problem with CALayer's 
-renderInContext:

I have a custom UIView with custom delegate-drawn sublayers. Almost everything 
renders correctly when I do this:


 [[view layer] renderInContext:aContext];

(the context is set up correctly and produces the expected result - an image). 
But some parts of the original view (which is visible on screen when rendering) 
are missing.


I've been debugging this one for quite a while until I realized that missing 
layers are not missing but somehow their zPosition got messed up so they ended 
up below another sibling layer.


Since the affected layers need to be siblings in the same parent layer I can't 
fix this by making them sub-layers to enforce the hierarchy.


Why does this happen and how can I fix it?

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: scroll bars and visible rect

2013-01-03 Thread Mike Abdullah
You need to be more specific. What precisely do you mean by "the visible rect"?

On 2 Jan 2013, at 22:53, koko wrote:

> Are scroll bars inside the visible rect or additive to the visible rect?
> 
> I ask because we use the visible rect to set the size of a bitmap to display 
> and we are getting some strange behavior from some users and thought they may 
> have scroll bars set to display when scrolling.
> 
> -koko
> ___
> 
> 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/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net


___

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: LSSharedFileListInsertItemURL does not honor the display name or icon

2013-01-03 Thread Ben Staveley-Taylor
I thought I would share further information on this topic to help others who 
may come across this thread in the archives. 

I couldn't figure this out and found several similar bug reports from other 
developers in various forums, so I took the plunge and asked DTS. The official 
response is that:

"Regretfully, you have run into a series of bugs found in the Finder.  Launch 
Services does indeed honor the custom name for the favorite item as well as the 
icon, but Finder fails to honor both of those settings."
...
"So until the bug is fixed for LSSharedFileListInsertItemURL, you will have to 
stick with the default image and name associated with that NSURL."

The mechanism that Apple's own Favorites use to display custom icons 
(Applications, Downloads, user home, etc.) is not via Launch Services and is 
not available to developers.

-- Ben.



On 17 Dec 2012, at 19:47, cocoa-dev-requ...@lists.apple.com wrote:

> I am trying to add a new item to the Finder Sidebar Favorites 
> kLSSharedFileListFavoriteItems list. The API for doing this, 
> LSSharedFileListInsertItemURL, is not working for me. The Sidebar folder is 
> created, but with a generic folder icon and the name taken from the target 
> folder instead of the supplied display name. Can anyone see the error in the 
> code below? All the API calls are returning noErr or other success codes; 
> there is no error report.
> 
> The app is not Sandboxed.
> Running on OS X 10.7.5.
> 
> Thanks if you can help,
> 
> -- Ben


___

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: LSSharedFileListInsertItemURL does not honor the display name or icon

2013-01-03 Thread Kyle Sluder
On Jan 3, 2013, at 2:16 AM, Ben Staveley-Taylor 
 wrote:

> 
> I couldn't figure this out and found several similar bug reports from other 
> developers in various forums, so I took the plunge and asked DTS. The 
> official response is that:
> 
> "Regretfully, you have run into a series of bugs found in the Finder.  Launch 
> Services does indeed honor the custom name for the favorite item as well as 
> the icon, but Finder fails to honor both of those settings."
> ...
> "So until the bug is fixed for LSSharedFileListInsertItemURL, you will have 
> to stick with the default image and name associated with that NSURL."

Wow, that's pretty terrible. Dunno if it's necessary, but I'd consider filing a 
duplicate bug just to ensure your voice is heard.

> 
> The mechanism that Apple's own Favorites use to display custom icons 
> (Applications, Downloads, user home, etc.) is not via Launch Services and is 
> not available to developers.

Does Finder expose an Apple Event API for manipulating the Favorites list?

--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: LSSharedFileListInsertItemURL does not honor the display name or icon

2013-01-03 Thread Jerry Krinock

On 2013 Jan 03, at 07:21, Kyle Sluder  wrote:

> Does Finder expose an Apple Event API for manipulating the Favorites list?

I don't know how he does it, but Cocoatech's "Path Finder" (Finder replacement 
app) keeps its "Favorites" in sync with Finder's Favorites.  This feature was 
added several years ago, in a Path Finder upgrade.


___

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


Core Data and localized sort on iOS

2013-01-03 Thread Fritz Anderson
iOS 6

I have (or will have) a Core Data store, one entity of which has an attribute 
that is a French word. French collates differently than English or a naïve 
Unicode sort would. My application will have both English and French 
localizations. It is next-to-nonnegotiable that the word lists I present be 
sorted in French order, regardless of the current locale. There will be 74,000 
instances; I'd like to have tables that narrow down by incremental prefix 
searches.

NSString has comparison methods that can take account of a specified locale, so 
if I'm working in code, I don't (I hope) have a problem.

But I'd like to get ordered results from Core Data fetches. My first impression 
is that I could use the …comparator: versions of NSSortDescriptor, and put my 
localized comparison in the block. But I know Core Data is often pickier about 
what NSFetchRequest will do for you. The examples in the documentation are 
confined to …Key:ascending: descriptors.

I have three questions.

1. Are block-comparator sort descriptors permitted in NSFetchRequest?

2. If so, am I setting myself up for unacceptable performance?

3. If so, can you suggest another approach?

Thanks for your consideration.

— F


___

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: Core Data and localized sort on iOS

2013-01-03 Thread Kyle Sluder
On Jan 3, 2013, at 8:49 AM, Fritz Anderson  wrote:

> iOS 6
> 
> I have (or will have) a Core Data store, one entity of which has an attribute 
> that is a French word. French collates differently than English or a naïve 
> Unicode sort would. My application will have both English and French 
> localizations. It is next-to-nonnegotiable that the word lists I present be 
> sorted in French order, regardless of the current locale. There will be 
> 74,000 instances; I'd like to have tables that narrow down by incremental 
> prefix searches.
> 
> NSString has comparison methods that can take account of a specified locale, 
> so if I'm working in code, I don't (I hope) have a problem.
> 
> But I'd like to get ordered results from Core Data fetches. My first 
> impression is that I could use the …comparator: versions of NSSortDescriptor, 
> and put my localized comparison in the block. But I know Core Data is often 
> pickier about what NSFetchRequest will do for you. The examples in the 
> documentation are confined to …Key:ascending: descriptors.
> 
> I have three questions.
> 
> 1. Are block-comparator sort descriptors permitted in NSFetchRequest?

Not for SQL stores. Unsure about XML. Supported for in-memory.

> 
> 2. If so, am I setting myself up for unacceptable performance?
> 
> 3. If so, can you suggest another approach?

In-memory scan? 74,000 items might not be all that many to fault in and sort.

Alternatively, manually maintain an English and a French index when updating 
your data. Dunno of the best strategy here. the naive solution is to have a 
"french_index" and "english_index" column, but updating all the rows in your 
database just to handle a single insertion at the front of the list seems like 
a bad idea. But if your word list is static, that seems like the perfect 
approach.

--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: scroll bars and visible rect

2013-01-03 Thread koko
visibleRect

Returns the visible region of the receiver, in its own coordinate space. 
(read-only)

@property(readonly) CGRect visibleRect
Discussion

The visible region is the area not clipped by the containing scroll layer.


And I may have answered my question since it says the visible region is not 
clipped by the containing scroll layer I assume the scroll bars are inside the 
visible rect;

-koko





On Jan 3, 2013, at 3:02 AM, Mike Abdullah wrote:

> You need to be more specific. What precisely do you mean by "the visible 
> rect"?
> 
> On 2 Jan 2013, at 22:53, koko wrote:
> 
>> Are scroll bars inside the visible rect or additive to the visible rect?
>> 
>> I ask because we use the visible rect to set the size of a bitmap to display 
>> and we are getting some strange behavior from some users and thought they 
>> may have scroll bars set to display when scrolling.
>> 
>> -koko
>> ___
>> 
>> 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/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 
> 

___

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: scroll bars and visible rect

2013-01-03 Thread Kyle Sluder
On Jan 3, 2013, at 9:54 AM, koko  wrote:

> visibleRect
> 
> Returns the visible region of the receiver, in its own coordinate space. 
> (read-only)
> 
> @property(readonly) CGRect visibleRect
> Discussion
> 
> The visible region is the area not clipped by the containing scroll layer.

Well I'm glad I didn't actually get around to building the OS X sample project 
I was going to construct to answer your question about -[NSView visibleRect], 
since you never specified you were working on iOS…

--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: scroll bars and visible rect

2013-01-03 Thread Kyle Sluder
On Jan 3, 2013, at 9:54 AM, koko  wrote:

> visibleRect
> 
> Returns the visible region of the receiver, in its own coordinate space. 
> (read-only)
> 
> @property(readonly) CGRect visibleRect
> Discussion
> 
> The visible region is the area not clipped by the containing scroll layer.
> 
> 
> And I may have answered my question since it says the visible region is not 
> clipped by the containing scroll layer I assume the scroll bars are inside 
> the visible rect;

Wait hold on, you ARE talking about OS X. But you copied docs that are either 
from Core Animation or UIKit. Neither is relevant to this discussion.

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


Core Data and localized sort on iOS

2013-01-03 Thread Matt Neuburg
What I do in my Core Data-based Latin and Greek vocabulary list iOS apps is 
maintain extra fields (attributes) that contain transliterations of the 
Greek/Latin terms into the English alphabet in such a way that sorting normally 
on those fields gives me the order that is correct for Greek/Latin. m.

On Jan 3, 2013, at 12:00 PM, cocoa-dev-requ...@lists.apple.com wrote:

> Message: 1
> Date: Thu, 03 Jan 2013 10:49:15 -0600
> From: Fritz Anderson 
> To: Cocoa-Dev Cocoa-Dev 
> Subject: Core Data and localized sort on iOS
> Message-ID: <202d147a-95b8-40ec-a6ae-baaf04130...@manoverboard.org>
> Content-Type: text/plain; charset=windows-1252
> 
> iOS 6
> 
> I have (or will have) a Core Data store, one entity of which has an attribute 
> that is a French word. French collates differently than English or a naïve 
> Unicode sort would. My application will have both English and French 
> localizations. It is next-to-nonnegotiable that the word lists I present be 
> sorted in French order, regardless of the current locale. There will be 
> 74,000 instances; I'd like to have tables that narrow down by incremental 
> prefix searches.
> 
> NSString has comparison methods that can take account of a specified locale, 
> so if I'm working in code, I don't (I hope) have a problem.
> 
> But I'd like to get ordered results from Core Data fetches. My first 
> impression is that I could use the …comparator: versions of NSSortDescriptor, 
> and put my localized comparison in the block. But I know Core Data is often 
> pickier about what NSFetchRequest will do for you. The examples in the 
> documentation are confined to …Key:ascending: descriptors.


___

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: Core Data and localized sort on iOS

2013-01-03 Thread Fritz Anderson
On 3 Jan 2013, at 2:08 PM, Matt Neuburg  wrote:

> What I do in my Core Data-based Latin and Greek vocabulary list iOS apps is 
> maintain extra fields (attributes) that contain transliterations of the 
> Greek/Latin terms into the English alphabet in such a way that sorting 
> normally on those fields gives me the order that is correct for Greek/Latin. 
> m.

You may be right, but I don't understand. Greek (unless polytonic) and Latin 
have smaller alphabets than English, so mapping words to English 
transliterations would make sense.

French has accents, which are significant in collation. Further, accented 
characters count in collation from right to left: _e_e < _é_e < _e_é < _é_é (as 
I understand it). A simple transliteration would collapse them all to _e_e, 
thus losing the information I most worry about, am I right?

For the moment, Kyle's suggestion of pre-cooking the collation order (I have a 
fixed list) makes the most sense, and I thank him for it.

— F


___

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: Editing multiple selections with bindings

2013-01-03 Thread Patrick Cusack
Keary,

I am checking whether or not the user is trying to edit multiple items in my 
delegate's - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText 
*)fieldEditor

If the choose to not complete editing, I should be able to discard editing on 
the bound NSArrayController, but my control still has focus after calling 
discardEditing.

Thoughts?

Patrick


On Jan 2, 2013, at 9:10 PM, Keary Suska wrote:

> On Jan 2, 2013, at 7:29 PM, Patrick Cusack wrote:
> 
>> Ok, I do have a delegate for my controls and am currently using 
>> control:textShouldEndEditing:. If I return no, however, my control still has 
>> focus, and I can't think of a programmatic way to lose focus without 
>> committing changes. 
> 
> You would call -discardEditing on the NSObjectController that should be 
> managing the detail interface.
> 
>> On Jan 2, 2013, at 5:20 PM, Keary Suska wrote:
>> 
>>> On Jan 2, 2013, at 9:59 AM, Patrick Cusack wrote:
>>> 
 Sorry, I might not be clear. I have a table view that is bound to an 
 NSArraryController. I want users to be able to edit single and multiple 
 selections from a detail view that has NSTextfields and ComboBoxes. There 
 are occasions where users forget that they have selected multiple items 
 and proceed to edit cues, unaware that they are actually mutating more 
 than one row of data. When an editor tabs into a control like the 
 NSTextField or NSComboBox, I want to give them a chance to discard 
 editing. I can easily deduce that multiple items in my NSArrayController 
 are selected, throw an NSRunAlert, and give users an option to make a 
 choice, but at that point, I have already entered focus into the control 
 and any attempt to leave that control will still change the  selected 
 items. I tried overriding acceptsFirstResponder, and conducting my test in 
 that selector, but acceptsFirstResponder gets called more than once, and 
 then the control passes focus onto the next control in the kew view loop. 
 Really what I want to a accomplish is to discard the editing and resign 
 focus from the control. 
>>> 
>>> No--my error--you did say that you are editing in a detail interface. The 
>>> only thing I can think of is to register a controller as the delegate for 
>>> the detail fields, then you have access to control:textShouldEndEditing: 
>>> and friends (look for the NSControlTextEditingDelegate protocol in the 
>>> docs). All NSControl subclasses use these so it should work for your combo 
>>> boxes as well.
>>> 
 On Jan 2, 2013, at 6:41 AM, Keary Suska wrote:
 
> On Jan 2, 2013, at 12:05 AM, livinginlosange...@mac.com wrote:
> 
>> I have an application where a user can select multiple rows of data from 
>> an NSArrayController and edit those rows from a detail view. Now, there 
>> are cases where users have inadvertently changed the values for multiple 
>> rows of data when they did not intend to. How can I warn a user when 
>> they enter a texfield or nscombobox that they are about to edit multiple 
>> rows of data and gracefully give them a way to back out? I noticed that 
>> there is no way to discard editing when in a textfield. Is that the 
>> case? I am using the control: textShouldEndEditing: delegate method 
>> which allow me to get 90% of the way there, but the textfield retains 
>> focus, and I can not tab out of the field without getting my warning. 
>> Ideally, pressing "esc" should allow me to discard any editing and make 
>> the field lose focus. 
> 
> IIRC you can set a delegate to the table view and implement 
> tableView:shouldEditTableColumn:row:, and you should be able to prevent 
> editing from even starting until the user has confirmed.
> 
> 
> 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/archive%40mail-archive.com

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

Re: Core Data and localized sort on iOS

2013-01-03 Thread Matt Neuburg

On Jan 3, 2013, at 12:49 PM, Fritz Anderson wrote:

> A simple transliteration

I didn't say the transliteration was simple. I had to devise a code (properly 
called a "beta code") that would yield the correct result. To give a simple 
example, if you want a-accent-aigu to sort before a-accent-grave, you might 
transliterate them as a1 and a2. Or, just the other way round, if you want them 
to sort indifferently, you might transliterate them both as a. By the same 
token, I lowercased everything because I didn't want case to be significant in 
the sort order. But the point is that this code, once devised, can be 
machine-generated mechanically at the time you construct the database, and then 
Bob's your uncle. This technique is as old as the hills and quite as solid. 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data and localized sort on iOS

2013-01-03 Thread Kyle Sluder
On Thu, Jan 3, 2013, at 02:54 PM, Matt Neuburg wrote:
> I didn't say the transliteration was simple. I had to devise a code
> (properly called a "beta code") that would yield the correct result. To
> give a simple example, if you want a-accent-aigu to sort before
> a-accent-grave, you might transliterate them as a1 and a2. Or, just the
> other way round, if you want them to sort indifferently, you might
> transliterate them both as a. By the same token, I lowercased everything
> because I didn't want case to be significant in the sort order. But the
> point is that this code, once devised, can be machine-generated
> mechanically at the time you construct the database, and then Bob's your
> uncle. This technique is as old as the hills and quite as solid. m.

Or, since you're doing this at database construction time, you could
just sort the entries lexicographically, store their sort rank in a
field, and only use 4 bytes per row instead of as many as your "clever"
code requires.

--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: Core Data and localized sort on iOS

2013-01-03 Thread Matt Neuburg
Yes, actually I do both. m.

On Jan 3, 2013, at 3:42 PM, Kyle Sluder wrote:

> On Thu, Jan 3, 2013, at 02:54 PM, Matt Neuburg wrote:
>> I didn't say the transliteration was simple. I had to devise a code
>> (properly called a "beta code") that would yield the correct result. To
>> give a simple example, if you want a-accent-aigu to sort before
>> a-accent-grave, you might transliterate them as a1 and a2. Or, just the
>> other way round, if you want them to sort indifferently, you might
>> transliterate them both as a. By the same token, I lowercased everything
>> because I didn't want case to be significant in the sort order. But the
>> point is that this code, once devised, can be machine-generated
>> mechanically at the time you construct the database, and then Bob's your
>> uncle. This technique is as old as the hills and quite as solid. m.
> 
> Or, since you're doing this at database construction time, you could
> just sort the entries lexicographically, store their sort rank in a
> field, and only use 4 bytes per row instead of as many as your "clever"
> code requires.
> 
> --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


Custom initWithFrame?

2013-01-03 Thread Eric Dolecki
I am creating a UIView-based control that I would also like to pass in 
parameters at the time of creation. Is this doable? I don't want to keep 
calling methods on my object if I can pass all with initwithframe somehow.

Thanks,
Eric

Sent by Eric's faithful iPad. 
___

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: Custom initWithFrame?

2013-01-03 Thread Jonathan Hull
Sure, just define initWith…. in your subclass and call super -initWithFrame: 
from it.

Thanks,
Jon

On Jan 3, 2013, at 5:28 PM, Eric Dolecki  wrote:

> I am creating a UIView-based control that I would also like to pass in 
> parameters at the time of creation. Is this doable? I don't want to keep 
> calling methods on my object if I can pass all with initwithframe somehow.
> 
> Thanks,
> Eric
> 
> Sent by Eric's faithful iPad. 
> ___
> 
> 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/jhull%40gbis.com
> 
> This email sent to jh...@gbis.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: Custom initWithFrame?

2013-01-03 Thread Jean Suisse
On 4 janv. 2013, at 02:28, Eric Dolecki wrote:
> I am creating a UIView-based control that I would also like to pass in 
> parameters at the time of creation. Is this doable? I don't want to keep 
> calling methods on my object if I can pass all with initwithframe somehow.
> 
> Thanks,
> Eric

Eric, maybe you could use :

- (id)initWithFrame:(NSRect)frame andOtherObject:(someClass*)myOtherObject
{
self = [super initWithFrame:frame];
if (self)
{   
[self setOtherObject:myOtherObject];
}   

return self;
}

Best regards,
Jean






---
Jean Suisse
Institut de Chimie Moléculaire de l’Université de Bourgogne
(ICMUB) — UMR 6302





___

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: scroll bars and visible rect

2013-01-03 Thread koko
I beg to differ with you all:

visibleRect
Returns the visible region of the receiver, in its own coordinate space. 
(read-only)

@property(readonly) CGRect visibleRect
Discussion

The visible region is the area not clipped by the containing scroll layer.

Availability

Available in Mac OS X v10.5 and later.
Related Sample Code

ImageBrowserViewAppearance
ImageKitDemo
Declared In

CAScrollLayer.h




On Jan 3, 2013, at 11:07 AM, Kyle Sluder wrote:

> On Jan 3, 2013, at 9:54 AM, koko  wrote:
> 
>> visibleRect
>> 
>> Returns the visible region of the receiver, in its own coordinate space. 
>> (read-only)
>> 
>> @property(readonly) CGRect visibleRect
>> Discussion
>> 
>> The visible region is the area not clipped by the containing scroll layer.
>> 
>> 
>> And I may have answered my question since it says the visible region is not 
>> clipped by the containing scroll layer I assume the scroll bars are inside 
>> the visible rect;
> 
> Wait hold on, you ARE talking about OS X. But you copied docs that are either 
> from Core Animation or UIKit. Neither is relevant to this discussion.
> 
> --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: scroll bars and visible rect

2013-01-03 Thread Kyle Sluder
On Jan 3, 2013, at 6:23 PM, koko  wrote:

> I beg to differ with you all:


(Snip)
> 
> Declared In
> 
> CAScrollLayer.h
> 

What I wrote:

> 
> 
> On Jan 3, 2013, at 11:07 AM, Kyle Sluder wrote:
>> 
>> 
>> Wait hold on, you ARE talking about OS X. But you copied docs that are 
>> either from Core Animation or UIKit. Neither is relevant to this discussion.

--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: Custom initWithFrame?

2013-01-03 Thread Eric E. Dolecki
Yes, thank you. That's perfect.

Eric



  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  Imagineric 


On Thu, Jan 3, 2013 at 8:38 PM, Jonathan Hull  wrote:

> Sure, just define initWith…. in your subclass and call super
> -initWithFrame: from it.
>
> Thanks,
> Jon
>
> On Jan 3, 2013, at 5:28 PM, Eric Dolecki  wrote:
>
> > I am creating a UIView-based control that I would also like to pass in
> parameters at the time of creation. Is this doable? I don't want to keep
> calling methods on my object if I can pass all with initwithframe somehow.
> >
> > Thanks,
> > Eric
> >
> > Sent by Eric's faithful iPad.
> > ___
> >
> > 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/jhull%40gbis.com
> >
> > This email sent to jh...@gbis.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: scroll bars and visible rect

2013-01-03 Thread Graham Cox
You're confusing CAScrollLayer (Core Animation) with NSScrollView.

I *think* that NSScrollVIew's visible rect changes when the scroll bars are 
shown/hidden. That would stand to reason. Basing the size of some content on 
the visible rect sounds like a bad idea - you might sometimes use this to 
determine what parts of your content to draw or not draw, but not to determine 
what the content itself is.


--Graham



On 04/01/2013, at 1:23 PM, koko  wrote:

> I beg to differ with you all:


___

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: Editing multiple selections with bindings

2013-01-03 Thread Keary Suska
On Jan 3, 2013, at 3:53 PM, Patrick Cusack wrote:

> Keary,
> 
> I am checking whether or not the user is trying to edit multiple items in my 
> delegate's - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText 
> *)fieldEditor
> 
> If the choose to not complete editing, I should be able to discard editing on 
> the bound NSArrayController, but my control still has focus after calling 
> discardEditing.

Yes--discard/commit editing does only that--it won't change focus/first 
responder as that is the responsibility of the window, IIRC. You will have to 
decide what to do next, as you are interrupting the "normal" flow of events. 
What you do depends on the user experience you want. You could call [window 
makeFirstResponder:[[window firstResponder] nextResponder]], which should work 
predictably if you have set the next responder for all applicable editable 
controls. Alternatively you could just pass nil and end all editing. The latter 
may make more sense for the detail view, as I assume the decision might apply 
to every field...

> On Jan 2, 2013, at 9:10 PM, Keary Suska wrote:
> 
>> On Jan 2, 2013, at 7:29 PM, Patrick Cusack wrote:
>> 
>>> Ok, I do have a delegate for my controls and am currently using 
>>> control:textShouldEndEditing:. If I return no, however, my control still 
>>> has focus, and I can't think of a programmatic way to lose focus without 
>>> committing changes. 
>> 
>> You would call -discardEditing on the NSObjectController that should be 
>> managing the detail interface.
>> 
>>> On Jan 2, 2013, at 5:20 PM, Keary Suska wrote:
>>> 
 On Jan 2, 2013, at 9:59 AM, Patrick Cusack wrote:
 
> Sorry, I might not be clear. I have a table view that is bound to an 
> NSArraryController. I want users to be able to edit single and multiple 
> selections from a detail view that has NSTextfields and ComboBoxes. There 
> are occasions where users forget that they have selected multiple items 
> and proceed to edit cues, unaware that they are actually mutating more 
> than one row of data. When an editor tabs into a control like the 
> NSTextField or NSComboBox, I want to give them a chance to discard 
> editing. I can easily deduce that multiple items in my NSArrayController 
> are selected, throw an NSRunAlert, and give users an option to make a 
> choice, but at that point, I have already entered focus into the control 
> and any attempt to leave that control will still change the  selected 
> items. I tried overriding acceptsFirstResponder, and conducting my test 
> in that selector, but acceptsFirstResponder gets called more than once, 
> and then the control passes focus onto the next control in the kew view 
> loop. Really what I want to a accomplish is to discard the editing and 
> resign focus from the control. 
 
 No--my error--you did say that you are editing in a detail interface. The 
 only thing I can think of is to register a controller as the delegate for 
 the detail fields, then you have access to control:textShouldEndEditing: 
 and friends (look for the NSControlTextEditingDelegate protocol in the 
 docs). All NSControl subclasses use these so it should work for your combo 
 boxes as well.
 
> On Jan 2, 2013, at 6:41 AM, Keary Suska wrote:
> 
>> On Jan 2, 2013, at 12:05 AM, livinginlosange...@mac.com wrote:
>> 
>>> I have an application where a user can select multiple rows of data 
>>> from an NSArrayController and edit those rows from a detail view. Now, 
>>> there are cases where users have inadvertently changed the values for 
>>> multiple rows of data when they did not intend to. How can I warn a 
>>> user when they enter a texfield or nscombobox that they are about to 
>>> edit multiple rows of data and gracefully give them a way to back out? 
>>> I noticed that there is no way to discard editing when in a textfield. 
>>> Is that the case? I am using the control: textShouldEndEditing: 
>>> delegate method which allow me to get 90% of the way there, but the 
>>> textfield retains focus, and I can not tab out of the field without 
>>> getting my warning. Ideally, pressing "esc" should allow me to discard 
>>> any editing and make the field lose focus. 
>> 
>> IIRC you can set a delegate to the table view and implement 
>> tableView:shouldEditTableColumn:row:, and you should be able to prevent 
>> editing from even starting until the user has confirmed.
>> 
>> 
>> Keary Suska
>> Esoteritech, Inc.
>> "Demystifying technology for your home or business"
>> 
> 


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/Unsubscrib