Re: intelligent flexible popup

2009-07-21 Thread Quincey Morris

On Jul 20, 2009, at 22:16, Daniel Child wrote:

I seem to have fallen into the pitfall you described below. I can  
get the table view to display values in a combo box from a data  
source, which takes those values from an array in the model. I also  
have autocomplete working.


But I can't seem to get the values I choose to stick (remain  
displayed) in the table. Since the tableview is reusing the combo  
box cell, I don't see how you specify a different value for each row  
(I only have one column). (The choice values do appear when you  
click the arrow, but selecting them does not store a value.) Also,  
I'm not clear on when you capture a selection to get the value  
transferred to the model.


Are you supposed to use some notification to know that the field has  
been edited, and then capture that value and transfer it to the  
model. Sorry if this seems basic, but I've looked over the  
documentation and some sample code and just don't get it.


Here's what I'd try:

-- I'd give each data model object a string property stateName, and  
bind the table column to this property.


-- I'd write a validateStateName: method to check that the entered  
name was one of the names in my list of names. That'd probably a case- 
insensitive test, so I'd also use this method to replace the user's  
entry with a copy of the actual string from the list. (Make sure you  
turn on validates immediately for the binding. That means that the  
validation is done on Enter or Tab, not on every character typed as  
the name of the option might suggest.) Refer to the KVC documentation  
for information about how to write a validateKey: method.


If the user is allowed to enter names not in the list, then this  
method would validate non-list names for correctness (and do things  
like apply proper capitalization and replace the user entry with a  
prettified string) as desired.


-- I'd write a setStateName: setter to store the entered name in the  
instance variable backing the stateName property. Since this method  
could potentially be called for other reasons, I'd also re-apply the  
prettification here, so that the resulting value 'isEqualToString:'  
the matching string from your master list, if it's in your master list.


That's the general idea. The specifics would depend on whether:

-- the user was *only* allowed to enter things from your master list

-- the user was allowed to enter things not in the master list, which  
then get added to the master list


-- the user was allowed to enter arbitrary names, which are *not*  
added to the master list if unknown


If you need the model objects to store a property that's the numeric  
index into the master list, that can be done in the setter too. One of  
the properties would be made dependent on the other, but again the  
details depend on what behavior you specifically need to allow.


Note that this implementation (which is part of the data model)  
doesn't know that a NSComboxBox is being used to get the name -- a  
regular text field could be used just as easily (for you, though not  
for the user). That's as it should be.


HTH


___

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: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Alexander Bokovikov


On 21.07.2009, at 4:07, Kelly Keenan wrote:

Have you figured out what is going on here?  If not, can you please  
file a bug and send me the bug number?  If possible, it would be  
really handy to have a very simple project with this same problem.


OK, I've found a time to recall what and how I did it. Finally I've  
discovered the reason. Here is the actions sequence, leading to the bug.


- create a new project; I used Cocoa-FPC template, recently created by  
Jonas Maebe (see the list for the link) though I don't think the  
template itself does a matter.


- click BuildGo to compile, though I don't think it does a matter  
too. I'm just too lazy to repeat it all again without that step. I  
just remember that I did it earlier.


- open Interface Builder;

- select Object Controller in the Library and drag it into Main  
Menu.XIB window;


- PRINCIPAL STEPS ARE HERE:

- rename the Object Controller instance, i.e. click on the Object  
name label below the blue cube, causing its inline editor appearance,  
and type something. I used AppController name.


- DO NOT change NSObject class name at the top of Info page of the  
Inspector.


- add a new action in the Actions panel of the Info page, and call it  
onClick:.


- drag a push button from Library to the Window

- connect (Ctrl+Mouse Down) the push button instance with  
AppController object in the XIB window; a popup list appears, where we  
choose onClick: action.


- CHANGE the AppController object instance CLASS NAME to  
AppController (was NSObject) in the Object Inspector; the action, we  
just created DISAPPEARS, so Actions panel is EMPTY.


- right-click on the AppController object instance in the XIB window  
and look at the actions list - we can see, that onClick: action still  
exists and it's still connected to the push button; screenshot is here:


http://home.bokovikov.com/etc/mac/xcode/IB-bug_01.png

- click on the cross and disconnect this action from button; now it's  
empty


- add new onClick: action in the Actions panel of Object Info page.

- we can see, that AppController popup window has two actions, but  
Info page now contains only one action.


http://home.bokovikov.com/etc/mac/xcode/IB-bug_02.png

That's all, what I did now. Earlier I yet created appropriate code in  
the AppController.m file. Finally I came to the situation, when  
Actions page in the Inspector contained one onClick: action  
(though AppController's popup shew two actions) and Minus button was  
grayed. Now I did not reproduce it, but I believe the problem reason  
is revealed pretty enough. I demonstrated it all for object actions,  
though the same situation is with object outlets.


Fixing this bug I'd suggest to save all existing actions and outlets,  
rather than remove them completely, because initial class is NSObject,  
which is the base one, so any actions, added to NSObject definitely  
can be added to any of its descendants. Indeed, it would be more  
advanced solution, when a warning will be generated, when object class  
is downgraded. Though I can't provide an exact sample, as I'm not so  
skilled yet in XCode/Cocoa.


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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Alexander Spohr


Am 21.07.2009 um 00:38 schrieb Tim Schmidt:


Is there any way to work around this


Yes: find your memory bug.
EXC_BAD_ACCESS almost always is a memory bug in your code.

atze

___

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: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Graham Cox


On 21/07/2009, at 4:07 PM, Alexander Bokovikov wrote:

- rename the Object Controller instance, i.e. click on the Object  
name label below the blue cube, causing its inline editor  
appearance, and type something. I used AppController name.


- DO NOT change NSObject class name at the top of Info page of the  
Inspector.


[...]



- CHANGE the AppController object instance CLASS NAME to  
AppController (was NSObject) in the Object Inspector; the action,  
we just created DISAPPEARS, so Actions panel is EMPTY.



This might be the cause of the problems you had (possibly could still  
be considered an IB bug) as it's not a workflow that really makes much  
sense.


The name of an object in IB is just a crutch for the programmer, not  
an important aspect of the object's properties. So changing the name  
does nothing, really. What really matters is the class of the object,  
set in the Inspector. Change that FIRST, and it so happens to also  
change the name for you, but the reverse is NOT true. Once you have  
the class set properly, it will know which source file header it needs  
to read to load the relevant actions and outlets, and will presumably  
manage them in a bug-free manner from then on - e.g. if you delete an  
outlet in the header, it will be indicated as a missing outlet in IB  
and allow you to delete it.


Setting the name automatically when you set the class is a  
convenience, but equally you can change the name to make it clear to  
you what the object is. The name has no effect on anything.


--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Alexander Bokovikov


On 21.07.2009, at 12:20, Graham Cox wrote:

Setting the name automatically when you set the class is a  
convenience, but equally you can change the name to make it clear to  
you what the object is. The name has no effect on anything.


I can agree, but the bug is, that I can't correctly change the class  
name _after_ I've added some actions/outlets. I definitely would like  
to have such ability. Adding a new object I could name its class by  
mistake then add a couple of tens actions/outlets, then discover my  
mistake in class naming (remember, all this we do in IB, so none of  
code files could yet be created!), and come face to face with the  
problem.


This is a sort of problem similar to inability of XCode project  
renaming. It's not clear why not to add such feature?


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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data, NSArraycontrollers and secondary to-many relationships.

2009-07-21 Thread Steve Steinitz

Hi Sumanth,

On 20/7/09, Sumanth Peddamatham pedda...@gmail.com wrote:

I've spent a few days playing with NSArrayControllers, fiddling 
with  Content Array, Content Set, Content Object settings; 
tried  understanding @distinctUnionOfSets and 
@distinctUnionOfArrays; but  I've hit a wall.


I've never played with @distinctUnionOfSets nor 
@distinctUnionOfArrays.  I commend you for digging in.  And, 
what a great idea to make a jpeg of your model.


Until someone else gives you a better answer, let me suggest a 
low-tech technique.  Write a method on your Session class that 
returns the set or array that you want, then bind to that.


Hint 1, if you build a MutableSet you get (object-level) 
uniqueness for free.
Hint 2, if your Model is in a state of flux, consider using 
mogenerator for overriding your Model classes.


Cheers,

Steve Steinitz

___

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: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Graham Cox


On 21/07/2009, at 5:07 PM, Alexander Bokovikov wrote:

I can agree, but the bug is, that I can't correctly change the class  
name _after_ I've added some actions/outlets. I definitely would  
like to have such ability. Adding a new object I could name its  
class by mistake then add a couple of tens actions/outlets, then  
discover my mistake in class naming (remember, all this we do in IB,  
so none of code files could yet be created!), and come face to face  
with the problem.



Well, it's not a good answer, but maybe you could change your workflow  
a little. Instead of designing your classes as you go in IB, which to  
my mind is potentially indicative of poor or non-existent design, you  
should code them in Xcode, then you never do need to add outlets or  
actions in IB, and IB merely tracks the changes you make to the code.  
I've always found the ability of IB to do this a bit strange in some  
ways, since at least in my projects, I don't make up controllers as I  
go along in IB - they always pre-exist in code and I just use IB to,  
er, build the interface.


--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Alexander Bokovikov


On 21.07.2009, at 13:19, Graham Cox wrote:

I don't make up controllers as I go along in IB - they always pre- 
exist in code and I just use IB to, er, build the interface.


I'm not against of the above. I can agree with your approach,  
moreover, it's an approach, described in Cocoa classic books. In most  
of cases authors just suggest to create classes (at least their  
skeletons) in code and then open IB for the first time. Though it may  
be not so usual for a newbie to write these magic clauses like  
(IBAction) and IBOutlet, but it is not so fearful.


I only would like to say, that really good and stable software should  
at least be stable to some more or less incorrect user's actions. Is  
it not allowed to change class name after actions/outlets have been  
added? OK, just say that! Or, if it's allowed, just fix a bug. Nothing  
more.


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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IB] - possible bug [was: how to delete action or outlet?]

2009-07-21 Thread Quincey Morris

On Jul 21, 2009, at 00:07, Alexander Bokovikov wrote:

I can agree, but the bug is, that I can't correctly change the class  
name _after_ I've added some actions/outlets. I definitely would  
like to have such ability. Adding a new object I could name its  
class by mistake then add a couple of tens actions/outlets, then  
discover my mistake in class naming (remember, all this we do in IB,  
so none of code files could yet be created!), and come face to face  
with the problem.


There may or may not be a bug here, but mostly this is about confusion.

In IB, you added a onClick: action to *class* NSObject. Then you  
added one to *class* NSObjectController. IB is dutifully remembering  
exactly what you told it.


When you connect the button's action to your NSObjectController  
object, because it's also a NSObject, you have a choice of the two  
actions as your destination, one from each class. Maybe that's a bug,  
maybe that's an oversight, maybe that's just how an edge case happens  
to work, or maybe that's how it works for a genuine reason. I don't  
know.


Since the actions belong to classes, you can't see the NSObject one  
listed in the Identity tab unless you have a NSObject (not a  
NSObjectController) to select. So drag another blue cube into your  
document, delete NSObject's onClick action, then delete that temporary  
blue cube.


Maybe it's a bug that there's no way to see that class's actions  
without an object of that class in the nib, or maybe it's not, or  
maybe there's a way to see it by choosing a different view of things.  
I don't know.


The reason I don't know (and, frankly, don't care) is that -- as of IB  
3 -- there's rarely any reason to add actions this way. As Graham  
pointed out, it's much more common now, and much more convenient IMO,  
just to put the action in a .h file. IB will see it and make it  
available automatically. You don't have to do anything special, and if  
you choose to delete it (by removing it from the .h file, I mean) then  
IB will notice that too. Other than changing the classes of objects,  
and giving cosmetic IB-names to things, the Identity panel just  
doesn't seem terribly useful any more.


Note that -- as of IB 3 -- it's possible to define things like actions  
*within a XIB file only*, without having any supporting code in your  
project. Maybe -- like IB 2 -- it can generate the code definitions in  
your .h files for you, or maybe it can't. I don't know, because I  
don't care, for the same reason -- it just seems so much easier to  
start with the .h files.


It wouldn't hurt to submit a bug report about this -- IB certainly  
isn't doing a very good job of letting you know what's going on in  
this situation -- but I wouldn't be surprised if the answer was works  
as intended.



___

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: Cocoa Graphics Parsing

2009-07-21 Thread Klaus Backert


On 21 Jul 2009, at 03:50, Courtney Arnold wrote:


Hello all,

I need to programmatically parse/read through the contents of an  
NSImage. I am unable to find a tutorial or documentation that would  
explain how to do so. I would like to get some input on where I may  
be able to search for this information.


thank you,


since you want to scan barcode, by Googling I found, among other  
things, this:


http://www.bruji.com/cocoa/barcode.html

They have a barcode scanner project, written in Cocoa. The code is  
available for free.


Klaus

___

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: How do I track down an OSStatus error code?

2009-07-21 Thread Tommy Nordgren


On Jul 20, 2009, at 10:00 PM, Michael A. Crawford wrote:


Looking for the meaning behind the value -43.

-Michael


	Do a batch file search of header files in your SDK for -43, using  
TextWrangler or BBEdit

(http://www.barebones.com)
--
What is a woman that you forsake her, and the hearth fire and the home  
acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the Dane  
women

Tommy Nordgren
tommy.nordg...@comhem.se



___

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: How do I track down an OSStatus error code?

2009-07-21 Thread Roland King
I liked the macerror suggestion, never seen that command, so I tried  
it out



$ macerror -43
Mac OS error -43 (fnfErr): File not found


On Jul 21, 2009, at 6:29 PM, Tommy Nordgren wrote:



On Jul 20, 2009, at 10:00 PM, Michael A. Crawford wrote:


Looking for the meaning behind the value -43.

-Michael


	Do a batch file search of header files in your SDK for -43, using  
TextWrangler or BBEdit

(http://www.barebones.com)
--
What is a woman that you forsake her, and the hearth fire and the  
home acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the  
Dane women

Tommy Nordgren
tommy.nordg...@comhem.se



___

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/rols%40rols.org

This email sent to r...@rols.org


___

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: Cocoa Graphics Parsing

2009-07-21 Thread Jeffrey Oleander

 From: Courtney Arnold court...@rnolds.com
 Subject: Re: Cocoa Graphics Parsing
 To: cocoa-dev@lists.apple.com
 Date: Monday, 2009 July 20, 21:25
 I am expecting that I am going to
 have to drop down to lower levels. I want to be able to
 manually parse an image of a UPC barcode. I assume that the
 best way to do so would be to potentially examine each
 single pixel.
 
 any information that you provide, I would appreciate it.

Yes, it boils down to mincing along, examining
each pixel.

Do a search on syntactic pattern recognition.
That was the title of the class in which we covered
such things.


  
___

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: [iPhone] UITableView cell display bugs ?

2009-07-21 Thread WT

On Jul 20, 2009, at 5:03 PM, David Duncan wrote:


On Jul 20, 2009, at 1:35 AM, WT wrote:

I'm trying to reuse (with some modifications)  
UITableViewCellStyleSubtitle cells, which have two left-aligned  
labels. I want to have both labels and add a right-aligned text  
field. All three views must be as wide as roughly half the  
available content view width.


In order to do what you want you must subclass UITableViewCell and  
override layoutSubviews to do your layout. What is happening is your  
adding and moving around views before this layout has occurred, and  
then the default layout mechanism is resetting them. Your  
layoutSubviews override should call [super layoutSubviews] first.


Aha! So that's the trivial part I was missing. Thank you, 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data, NSArraycontrollers and secondary to-many relationships.

2009-07-21 Thread Sumanth Peddamatham

Thanks for the hints Steve!

I think my message has been sitting in the Moderator queue, but I was  
able to figure out @distinctUnionOfArrays a few days ago.


My solution was to create tiered NSArrayControllers.  One  
NSArrayController for the Sessions Entity, a proxy NSArrayController  
called Hosts in Session, and another proxy named Ports in Session.


Ports in Session is bound to Hosts in Session using a Content  
Array binding of 'arrangedobjec...@distinctunionofarrays.ports'.


Of course, my source is available if anyone's having a similar problem.


Best,

Sumanth Peddamatham

On Jul 21, 2009, at 3:09 AM, Steve Steinitz wrote:


Hi Sumanth,

On 20/7/09, Sumanth Peddamatham pedda...@gmail.com wrote:

I've spent a few days playing with NSArrayControllers, fiddling  
with  Content Array, Content Set, Content Object settings; tried   
understanding @distinctUnionOfSets and @distinctUnionOfArrays; but   
I've hit a wall.


I've never played with @distinctUnionOfSets nor  
@distinctUnionOfArrays.  I commend you for digging in.  And, what a  
great idea to make a jpeg of your model.


Until someone else gives you a better answer, let me suggest a low- 
tech technique.  Write a method on your Session class that returns  
the set or array that you want, then bind to that.


Hint 1, if you build a MutableSet you get (object-level) uniqueness  
for free.
Hint 2, if your Model is in a state of flux, consider using  
mogenerator for overriding your Model classes.


Cheers,

Steve Steinitz



___

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: Cocoa Graphics Parsing

2009-07-21 Thread Alastair Houghton

On 21 Jul 2009, at 04:05, Graham Cox wrote:

Internally, you have -getPixel:atX:y: which would presumably be the  
workhorse at the heart of your class.


-getPixel:atX:y: is fine for the odd what-colour-is-this test, but  
it's the wrong thing to use for any kind of intensive pixel access.   
For a task such as barcode recognition you would probably want to drop  
down and access the bits directly yourself.


Of course, that means getting involved with pixel formats...

Kind regards,

Alastair.

--
http://alastairs-place.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


iPhone Question: UIScrollView

2009-07-21 Thread Eric E. Dolecki
I'm a real noob when it comes to the UIScrollView. What I would like to do:
I have a View that contains a UIScrollView. Instead of loading an image in
there, what I would like to do is load in another view (say an image that's
a lot wider than the portrait iPhone... which has button sprinkled
throughout).

So the idea is you could pan around the view, and click on points of
interest in the image (using UIButtons or whatever). But I'm not quite sure
how to set this up. I created a View XIB (no view controller) and put some
stuff in there.

NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@details
owner:self options:nil];

UIView *infoView = [nibViews objectAtIndex:0];

[myScrollView addSubview:infoView];


This works, but I can't make the view wider than the iPhone portrait. How
should I handle 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Subclassing NSPopUpButton and NSPopUpButtonCell

2009-07-21 Thread Stephen Blinkhorn

Hello Cocoa-Dev,

Oh the joy of subclassing subclasses of NSControl and NSCell.  I am  
making a custom pop up menu object.  I subclass NSPopUpButtonCell and  
simply draw my custom menu button in the drawBezelWithFrame method.


The frame rect that this method passes in has been inset by some  
amount which means that the menu registers mouse clicks for several  
pixel rows above its drawing frame but rejects mouse clicks for  
several pixel rows at the bottom of its frame.  I have tried using the  
bounds rect of the control view but I get the same behaviour.  How can  
I get the real bounding rect of the cell?  I have the same problem  
with a subclass of NSTextFieldCell.


I did try creating a pop up menu control from scratch by creating  
menus and managing the state of its items and I could finish this but  
it feels like I'm reinventing the wheel really.


Thanks,
Stephen 
 
___


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: iPhone Question: UIScrollView

2009-07-21 Thread Graham Cox


On 22/07/2009, at 12:34 AM, Eric E. Dolecki wrote:

This works, but I can't make the view wider than the iPhone  
portrait. How

should I handle this?



set the bounds rect of the infoView to what you want. If larger than  
what will fit in the scroll view, it will be scrollable.


--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone Question: UIScrollView

2009-07-21 Thread Eric E. Dolecki
Might it be okay to add buttons via code on top of a big image, and just
handle button events that way instead of using a sep view?

On Tue, Jul 21, 2009 at 10:41 AM, Graham Cox graham@bigpond.com wrote:


 On 22/07/2009, at 12:34 AM, Eric E. Dolecki wrote:

  This works, but I can't make the view wider than the iPhone portrait. How
 should I handle this?



 set the bounds rect of the infoView to what you want. If larger than what
 will fit in the scroll view, it will be scrollable.

 --Graham





-- 
http://ericd.net
Interactive design and development
___

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: How do I track down an OSStatus error code?

2009-07-21 Thread Michael A. Crawford
Yeah I especially liked that one too.  You know there are quite a few  
handy (for development) command-line utilities laying on the disk.  I  
found out last week that there is a program for creating and  
converting .CAF files.  I had no idea.  It would be nice if someone  
put up a web page or database documenting these for the benefit of all  
developers.  I guess Apple should really take responsibility for that.


-Michael
--
The united stand.  The divided get played.

-- Bernie MAC




On Jul 21, 2009, at 6:41 AM, Roland King wrote:

I liked the macerror suggestion, never seen that command, so I tried  
it out



$ macerror -43
Mac OS error -43 (fnfErr): File not found


On Jul 21, 2009, at 6:29 PM, Tommy Nordgren wrote:



On Jul 20, 2009, at 10:00 PM, Michael A. Crawford wrote:


Looking for the meaning behind the value -43.

-Michael


	Do a batch file search of header files in your SDK for -43, using  
TextWrangler or BBEdit

(http://www.barebones.com)
--
What is a woman that you forsake her, and the hearth fire and the  
home acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the  
Dane women

Tommy Nordgren
tommy.nordg...@comhem.se



___

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/rols%40rols.org

This email sent to r...@rols.org






smime.p7s
Description: S/MIME cryptographic signature
___

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: iPhone Question: UIScrollView

2009-07-21 Thread Graham Cox


On 22/07/2009, at 12:56 AM, Eric E. Dolecki wrote:

Might it be okay to add buttons via code on top of a big image, and  
just handle button events that way instead of using a sep view?



No idea. But why do things in a weird way when a perfectly good  
supported way already exists?


If you add buttons to a view and that view is in a scrollview, and its  
bounds is big enough it will scroll. The buttons will scroll around  
with it if that's what you have in there. The buttons can be added in  
code or in IB, and the main view can draw an image if you want.


What was the question again? Seems to have strayed from the point.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What are the finer points to programatically loading a view from a NIB and attaching to the default window in MainMenu.xib?

2009-07-21 Thread Michael A. Crawford
We have a winner!  Yeah, both NSWindow outlets were not hooked up in  
IB.  Shouldn't I get some sort of warning.  Oh well.  Thanks for  
pointing that out.  The views don't look right but they show up.  I  
will sort it from here.


-Michael

On Jul 21, 2009, at 12:42 AM, Kyle Sluder wrote:

On Jul 20, 2009, at 9:28 PM, Michael A. Crawford michaelacrawf...@mac.com 
 wrote:


The NIB file is loaded in that I was able set a breakpoint on - 
[awakeFromNib] for the NDView class.  Yet, I don't see any output.   
If I remove the controller and use IB to add the NDView to the  
window as a custom-view.  I can see the view and works fine.  I've  
tried both the -[setContent] -[addSubview] calls.


You're in the debugger; that's an important first step. But you need  
to verify that your window outlet isn't nil (as well as the view  
controller's view). If all else fails, remember that you can  
evaluate expressions and invoke arbitrary statements in the gdb  
console.


--Kyle Sluder




smime.p7s
Description: S/MIME cryptographic signature
___

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: [iPhone] CFAttributedStringRef autorelease - not possible?

2009-07-21 Thread Dave Camp

On Jul 19, 2009, at 9:13 AM, Michael Hoy wrote:


NSString *m_scanString = @This is a test.;
CFDictionaryRef emptyDic = (CFDictionaryRef)[NSDictionary dictionary];
CFAttributedStringRef attString =  
CFAttributedStringCreate(kCFAllocatorDefault,  
(CFStringRef)m_scanString, emptyDic);
CFMutableAttributedStringRef linkifiedString =  
CFAttributedStringCreateMutableCopy(kCFAllocatorDefault, 0,  
attString);
NSLog(@%@, (NSString  
*)CFAttributedStringGetString(linkifiedString));

[(id)linkifiedString autorelease];

Testing in a Mac OS 10.5 SDK, this code works. In the iPhone 3.1  
SDK, the last line of code (calling autorelease on  
CFMutableAttributedStringRef) gives EXC_BAD_ACCESS. Everything else  
works as expected.


Is CFAttributedStringRef not castable to id or NSObject* in the  
iPhone environment?


Attributed strings are not supported on the iPhone.

Dave
___

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: iPhone Question: UIScrollView

2009-07-21 Thread Dave Camp

On Jul 21, 2009, at 7:34 AM, Eric E. Dolecki wrote:

I'm a real noob when it comes to the UIScrollView. What I would like  
to do:
I have a View that contains a UIScrollView. Instead of loading an  
image in
there, what I would like to do is load in another view (say an image  
that's

a lot wider than the portrait iPhone... which has button sprinkled
throughout).

So the idea is you could pan around the view, and click on points of
interest in the image (using UIButtons or whatever). But I'm not  
quite sure
how to set this up. I created a View XIB (no view controller) and  
put some

stuff in there.

NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@details
owner:self options:nil];

UIView *infoView = [nibViews objectAtIndex:0];

[myScrollView addSubview:infoView];


This works, but I can't make the view wider than the iPhone  
portrait. How

should I handle this?


Right. You aren't supposed to make views larger than the screen (at  
least according to the docs). I assume that is to keep the layer sizes  
reasonable.


What you do is set the contentSize of the UIScrollView to be as large  
as you want. Then, in your delegate callbacks or UIScrollView  
subclass, you add/remove view tiles as needed to present a seamless  
view to the user. As tiles move offscreen you reuse them as new tiles  
on the opposite side.


Apple has a very nice tiled image view sample from WWDC 09 available  
online.


Dave
___

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: [iPhone] CFAttributedStringRef autorelease - not possible?

2009-07-21 Thread Michael Hoy
I know it doesn't support NSAttributedString. However,  
CFAttributedStringRef is supported. (That's why I'm using it.) The  
documentation reads:


iPhone OS Note: While Core Foundation on iPhone OS contains  
CFAttributedString, there are no additions to the APIs in UIKit to add  
specific attributes such as font, style, or color, and there are no  
APIs to draw attributed strings.


My question is about casting CFAttributedStringRef to id, which  
appears not to work in certain circumstances. For example, adding an  
(id)CFAttributedStringRef to an NSMutableArray appears to work fine...  
CFGetRetainCount() reports an increase and decrease in the retain  
count after adding/removing.


~Michael

On Jul 21, 2009, at 11:20 AM, Dave Camp wrote:


On Jul 19, 2009, at 9:13 AM, Michael Hoy wrote:


NSString *m_scanString = @This is a test.;
CFDictionaryRef emptyDic = (CFDictionaryRef)[NSDictionary  
dictionary];
CFAttributedStringRef attString =  
CFAttributedStringCreate(kCFAllocatorDefault,  
(CFStringRef)m_scanString, emptyDic);
CFMutableAttributedStringRef linkifiedString =  
CFAttributedStringCreateMutableCopy(kCFAllocatorDefault, 0,  
attString);
NSLog(@%@, (NSString  
*)CFAttributedStringGetString(linkifiedString));

[(id)linkifiedString autorelease];

Testing in a Mac OS 10.5 SDK, this code works. In the iPhone 3.1  
SDK, the last line of code (calling autorelease on  
CFMutableAttributedStringRef) gives EXC_BAD_ACCESS. Everything else  
works as expected.


Is CFAttributedStringRef not castable to id or NSObject* in the  
iPhone environment?


Attributed strings are not supported on the iPhone.

Dave


___

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: What are the finer points to programatically loading a view from a NIB and attaching to the default window in MainMenu.xib?

2009-07-21 Thread Bill Bumgarner

On Jul 21, 2009, at 8:13 AM, Michael A. Crawford wrote:

We have a winner!  Yeah, both NSWindow outlets were not hooked up in  
IB.  Shouldn't I get some sort of warning.  Oh well.  Thanks for  
pointing that out.  The views don't look right but they show up.  I  
will sort it from here.


File a bug on that, please

http://bugreport.apple.com/

... it might be returned as a dupe, but dupes are votes and, coupled  
with the narrative on cocoa-dev, will capture another compelling case  
for this particular validation.


b.bum

___

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


what is this currency symbol?

2009-07-21 Thread Andy Lee
I've recently started using the currency option for NSDateFormatter in IB.  I 
could have sworn it was using $ as the currency symbol, but lately it's 
started using ¤, which is a symbol I don't recognize.  Anybody know what the 
¤ is, and how I can get $ back as the default?

This *might* have started happening when I deleted the $ for one particular 
date formatter, which I wouldn't have expected to change things for subsequent 
formatters.  Otherwise, I can't think of anything relevant I might have 
changed.  My System Preferences has US Dollar as the selected currency.

Another possibility is that the ¤ only shows up on one of the machines I've 
been developing on -- I might be mistaken about the behavior changing.  Anyway, 
I'd still like to know what it means.

--Andy


___

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: what is this currency symbol?

2009-07-21 Thread Phil Dokas

On Jul 21, 2009, at 11:53 AM, Andy Lee wrote:


¤


…is the all-purpose currency sign in unicode. Its use is to denote  
that the attached number is a currency value when the appropriate  
symbol for the locale isn't available.


--
Phil Dokas -//- p...@jetless.org

___

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: what is this currency symbol?

2009-07-21 Thread Graham Lee

On 21 Jul 2009, at 16:53, Andy Lee wrote:

 I've recently started using the currency option for NSDateFormatter
 in IB.  I could have sworn it was using $ as the currency symbol,
 but lately it's started using ¤, which is a symbol I don't
 recognize.  Anybody know what the ¤ is, and how I can get $ back
 as the default?


That's the generic currency symbol.

Cheers,

Graham.

--
Graham Lee
Senior Mac Software Engineer

tel: +44 1235 540266
SOPHOS - simply secure


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United 
Kingdom.
Company Reg No 2096520. VAT Reg No GB 348 3873 20.
___

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: what is this currency symbol?

2009-07-21 Thread Nick Zitzmann


On Jul 21, 2009, at 9:53 AM, Andy Lee wrote:

Another possibility is that the ¤ only shows up on one of the  
machines I've been developing on -- I might be mistaken about the  
behavior changing.  Anyway, I'd still like to know what it means.


It's the international symbol for currency. Try selecting it, right- 
clicking, and choosing look up in dictionary for more details.


Nick Zitzmann
http://www.chronosnet.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


setFrameSize called multiple times for a single size change?

2009-07-21 Thread Stuart Malin
I have a sub-classed TableView that is the document view of an  
ScrollView.  The rows of the TableView are composited by a custom  
cell, and soI have overridden the -setFrameSize method of the  
TableView in order to determine if any rows have changed height as a  
consequence of the resize (if so, I invoke - 
noteHeightOfRowsWithIndexesChanged). After performing that calculation  
(and call to inform the table if any rows did change height), I then  
call the -setFrameSize of the super class (the NSTableView).


What I am seeing is that upon invoking the super class's -setFramSzie  
method, the overridden -setFrameSize is invoked twice more: the first  
time with the *old* size, then twice with the new size. While my app  
functions, I am troubled by these seemingly extra calls, and wonder if  
I haven't configured some setting of the TableView or ScrollView that  
I should. All of these objects are instantiated programmatically (not  
in IB). I set a breakpoint to examine the calling stack to see what  
was going on.


The call to set the old size comes from -resizeWithOldSuperviewSize.  
The docs say this can be overriden, so I have done so, making it a no- 
op method (that is, not invoking the super class). My app seems to  
perform just fine.


Question 1 -- Is this okay to do??

The two calls for the new size come, it seems to me, as a consequence  
of the TableView sizing the column (there is only one column in the  
table), as indicated by these two calling stacks:


#0	0x00041148 in -[TweetsListTableView setFrameSize:] at  
TweetsListTableView.m:181

#1  0x93ba6057 in -[NSTableView tile]
#2  0x93baefcf in -[NSTableColumn setWidth:]
#3	0x93baeae0 in -[NSTableView  
_sizeTableColumnsToFitWithStyle:forceExactFitIfPossible:]
#4	0x93bae24a in -[NSTableView  
_sizeTableColumnsToFitForAutoresizingWithStyle:]

#5  0x93bae1d4 in -[NSTableView sizeLastColumnToFit]
#6  0x93bae00f in -[NSTableView _autoresizeToFit]
#7  0x93badd34 in -[NSTableView superviewFrameChanged:]


#0	0x00041148 in -[TweetsListTableView setFrameSize:] at  
TweetsListTableView.m:181

#1  0x93ba6057 in -[NSTableView tile]
#2  0x93bae1e6 in -[NSTableView sizeLastColumnToFit]
#3  0x93bae00f in -[NSTableView _autoresizeToFit]
#4  0x93badd34 in -[NSTableView superviewFrameChanged:]

I now cache the last size given to the -setFrameSize method, and don't  
perform my testing for row height changes if the width hasn't changed,  
so I am no longer incurring that calculation cost.


Question 2 -- Is there a better way to configure the single column's  
resizing mask to avoid the double call?


TIA,
--Stuart

___

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: what is this currency symbol?

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 8:53 AM, Andy Leeag...@mac.com wrote:
 I've recently started using the currency option for NSDateFormatter in IB.  I 
 could have sworn it was using $ as the currency symbol, but lately it's 
 started using ¤, which is a symbol I don't recognize.  Anybody know what 
 the ¤ is, and how I can get $ back as the default?

Do you mean NSNumberFormatter, or are you actually trying to use
NSDateFormatter for this?

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone Question: UIScrollView

2009-07-21 Thread Eric E. Dolecki
Okay - how would I lay the buttons out in IB since IB doesn't allow one to
do that? I'd essentially need to place all my buttons with code anyway,
correct?
I want a really big image with hotspots on it I can click (I'll use with
UIButtons).

On Tue, Jul 21, 2009 at 11:03 AM, Graham Cox graham@bigpond.com wrote:


 On 22/07/2009, at 12:56 AM, Eric E. Dolecki wrote:

  Might it be okay to add buttons via code on top of a big image, and just
 handle button events that way instead of using a sep view?



 No idea. But why do things in a weird way when a perfectly good supported
 way already exists?

 If you add buttons to a view and that view is in a scrollview, and its
 bounds is big enough it will scroll. The buttons will scroll around with it
 if that's what you have in there. The buttons can be added in code or in IB,
 and the main view can draw an image if you want.

 What was the question again? Seems to have strayed from the point.

 --Graham







-- 
http://ericd.net
Interactive design and development
___

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: setFrameSize called multiple times for a single size change?

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 9:17 AM, Stuart Malinstu...@zhameesha.com wrote:
 I have a sub-classed TableView that is the document view of an ScrollView.

For future reference: TableView and ScrollView are not names of
classes in Cocoa.  NSTableView and NSScrollView are; UITableView and
UIScrollView exist in Cocoa Touch, so it's important to make this
distinction.

  The rows of the TableView are composited by a custom cell, and soI have
 overridden the -setFrameSize method of the TableView in order to determine
 if any rows have changed height as a consequence of the resize (if so, I
 invoke -noteHeightOfRowsWithIndexesChanged). After performing that
 calculation (and call to inform the table if any rows did change height), I
 then call the -setFrameSize of the super class (the NSTableView).

You're doing this backwards.  Your delegate should be telling your
table view the size of the rows.  Have your delegate listen for
NSViewFrameDidChangeNotification from the table view, and have it call
-noteHeightOfRowsWithIndexesChanged:.

 What I am seeing is that upon invoking the super class's -setFramSzie
 method, the overridden -setFrameSize is invoked twice more: the first time
 with the *old* size, then twice with the new size. While my app functions, I
 am troubled by these seemingly extra calls, and wonder if I haven't
 configured some setting of the TableView or ScrollView that I should. All of
 these objects are instantiated programmatically (not in IB). I set a
 breakpoint to examine the calling stack to see what was going on.

Sounds like a situation you need to be able to handle (perhaps at the
expense of more drawing).  It may go away if you use the
notifications.

 The call to set the old size comes from -resizeWithOldSuperviewSize. The
 docs say this can be overriden, so I have done so, making it a no-op method
 (that is, not invoking the super class). My app seems to perform just fine.

 Question 1 -- Is this okay to do??

No, because it's orthogonal.  NSTableView is going to resize itself
based on the number of rows and their size.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: setFrameSize called multiple times for a single size change?

2009-07-21 Thread Stuart Malin


On Jul 21, 2009, at 9:17 AM, Stuart Malin wrote:

I now cache the last size given to the -setFrameSize method, and  
don't perform my testing for row height changes if the width hasn't  
changed, so I am no longer incurring that calculation cost.


Question 2 -- Is there a better way to configure the single  
column's resizing mask to avoid the double call?


My bad -- I figured out an answer to the second question after  
posting...


Since I have only one column, I now set the columnAutoresizingStyle of  
the TableView to NSTableViewFirstColumnOnlyAutoresizingStyle


In the past, I had multiple columns, and had instead set this to - 
NSTableViewSequentialColumnAutoresizingStyle


I guess that the TabbleView doesn't notice that there is only one  
column, and so it was generating two resizing calls.

___

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: setFrameSize called multiple times for a single size change?

2009-07-21 Thread Stuart Malin


On Jul 21, 2009, at 9:27 AM, Kyle Sluder wrote:

On Tue, Jul 21, 2009 at 9:17 AM, Stuart Malinstu...@zhameesha.com  
wrote:
I have a sub-classed TableView that is the document view of an  
ScrollView.


For future reference: TableView and ScrollView are not names of
classes in Cocoa.  NSTableView and NSScrollView are; UITableView and
UIScrollView exist in Cocoa Touch, so it's important to make this
distinction.


Good point. I was referring to NS, not UI, and will be clearer in the  
future.


 The rows of the TableView are composited by a custom cell, and soI  
have
overridden the -setFrameSize method of the TableView in order to  
determine
if any rows have changed height as a consequence of the resize (if  
so, I

invoke -noteHeightOfRowsWithIndexesChanged). After performing that
calculation (and call to inform the table if any rows did change  
height), I

then call the -setFrameSize of the super class (the NSTableView).


You're doing this backwards.  Your delegate should be telling your
table view the size of the rows.  Have your delegate listen for
NSViewFrameDidChangeNotification from the table view, and have it call
-noteHeightOfRowsWithIndexesChanged:.


Ah yes, this makes sense -- I will recode.  Thank you Kyle!
___

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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Tim Schmidt


On Jul 20, 2009, at 11:18 PM, Alexander Spohr wrote:



Am 21.07.2009 um 00:38 schrieb Tim Schmidt:


Is there any way to work around this


Yes: find your memory bug.
EXC_BAD_ACCESS almost always is a memory bug in your code.

atze



Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all the  
usual mallocdebug options as well as NSZombies). Furthermore all NIBs  
are managed by NSViewController subclasses. Can anybody point me to  
some advanced guides on NSTableView (beyond the class reference and  
tables guide).

___

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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 9:32 AM, Tim Schmidtschmidt@gmx.net wrote:
 Obviously CG's bitblock transfers access unallocated memory in this case.

No, it probably doesn't.

Remember, 90% of the time, the bug is in your code.  The other 10% of
the time, the bug is in your code.

 If
 I accidently free said memory it completely eludes me where this might
 happen (I am pretty confident I don't release any of my model/controller
 objects unintentionally (I tried running with all the usual mallocdebug
 options as well as NSZombies).

Use Instruments.

 Furthermore all NIBs are managed by
 NSViewController subclasses. Can anybody point me to some advanced guides on
 NSTableView (beyond the class reference and tables guide).

There aren't any.  It's not a hard class to work with.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant

On Jul 21, 2009, at 12:32 PM, Tim Schmidt wrote:

Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all  
the usual mallocdebug options as well as NSZombies). Furthermore all  
NIBs are managed by NSViewController subclasses. Can anybody point  
me to some advanced guides on NSTableView (beyond the class  
reference and tables guide).



  I'll assume you're not customizing the drag and drop process (or  
doing anything with the column drag delegate method).


  My own intuition tells me you might look into your cells. If you  
have any custom (header or data) cells for the column(s) involved or  
do any custom manipulation of those cells (such as  
with ...willDisplayCell:...) that'd be a place to start looking for  
memory management no-nos. Especially if it only happens with  
particular columns.


  Also, if you're using the table datasource protocol, it's possible  
your ...objectValue... datasource method is returning an improperly- 
managed instance of something or other.


  If you're doing anything custom, post your code.

--
I.S.


___

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: what is this currency symbol?

2009-07-21 Thread Andy Lee
On Tuesday, July 21, 2009, at 12:02PM, Nick Zitzmann n...@chronosnet.com 
wrote:
It's the international symbol for currency. Try selecting it, right- 
clicking, and choosing look up in dictionary for more details.

Cool.  I tried to Google the symbol, but didn't think to try Dictionary.  From 
that I see I could have searched for it on Wikipedia too.

On Tuesday, July 21, 2009, at 12:18PM, Kyle Sluder kyle.slu...@gmail.com 
wrote:
Do you mean NSNumberFormatter, or are you actually trying to use
NSDateFormatter for this?

Whoops, I did mean NSNumberFormatter.

Thanks to all for the answers -- nice to learn something.  I'm still puzzled 
about why $ sometimes appears instead, but I should double-check that.  Maybe 
I saw the $ on an *existing* number format that someone else had created.

--Andy


___

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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Nick Zitzmann


On Jul 21, 2009, at 10:32 AM, Tim Schmidt wrote:

Obviously CG's bitblock transfers access unallocated memory in this  
case. If I accidently free said memory it completely eludes me where  
this might happen (I am pretty confident I don't release any of my  
model/controller objects unintentionally (I tried running with all  
the usual mallocdebug options as well as NSZombies). Furthermore all  
NIBs are managed by NSViewController subclasses. Can anybody point  
me to some advanced guides on NSTableView (beyond the class  
reference and tables guide).


One thought: Are you using the -CGImage method of NSBitmapImageRep  
anywhere? If so, then you absolutely must not deallocate the  
NSBitmapImageRep while the CGImageRef is live, because the CGImageRef  
acquired via -CGImage is still using the NSBitmapImageRep's data.


Nick Zitzmann
http://www.chronosnet.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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant
On Tuesday, July 21, 2009, Kyle Sluder kyle.slu...@gmail.com wrote:

 Remember, 90% of the time, the bug is in your code.  The other 10% of
 the time, the bug is in your code.

  That's just not true. Plenty of bugs in the frameworks. I've
personally logged dozens.  It's USUALLY your code but certainly not
always.


 There aren't any.  It's not a hard class to work with.

  Except when it is. Why so many absolutes? Try customizing table
views / columns / header views / etc. I mean beyond setting a custom
data cell or adding keyboard actions. Some of these mechanisms work in
unexpected (and sometimes conflicting) ways. Not all of This behavior
is documented either. It's not insurmountable but it's far from easy.
Tables are fairly complicated UI.

  If you have an app where a column is a first-class conceptual
model, for example, you might need a more interactive header cell ...
There be dragons.

  As to the OP's problem, however, I suspect the real issue is
probably pretty simple since he did not mention heavy customization.
Could be wrong though ...

--
I.S.
___

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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 9:56 AM, I. Savantidiotsavant2...@gmail.com wrote:
  That's just not true. Plenty of bugs in the frameworks. I've
 personally logged dozens.  It's USUALLY your code but certainly not
 always.

It's not intended to be an accurate statement.  The point is to avoid
jumping to conclusions.  Framework code is far more exposed than your
own, and it is immensely more likely that you've screwed up than the
Quartz devs have.

  If you have an app where a column is a first-class conceptual
 model, for example, you might need a more interactive header cell ...
 There be dragons.

You mean like OmniOutliner?  :)

  As to the OP's problem, however, I suspect the real issue is
 probably pretty simple since he did not mention heavy customization.
 Could be wrong though ...

This is where I was coming from.  Then I looked at the stack trace and
saw NSLayerKitGlue.  He might not be doing anything complicated, but
AppKit is.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


The iPhone SDK OpenGL ES Application template

2009-07-21 Thread Wilson Chen
Hi all,

For a typical iPhone application, after the application is finished
launching, the app delegate would then

1) create an instance of UIViewController;
2) ask the view controller for its view which the controller creates on
demand;
3) add the view as a subview of the window.

I really like this pattern since it adheres the MVC pattern. However, inside
the OpenGL ES Application XCode template, the EAGLView is added directly
to the window in the nib file, leaving the controller out.

My question is: since an EAGLView is a subclass of UIView, is there a
particular reason for the template to not follow the common pattern to
adhere the beloved MVC?

ciao,
wils
___

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: Crashes while reordering columns in a NSTableView

2009-07-21 Thread I. Savant

It's not intended to be an accurate statement.  The point is to avoid
jumping to conclusions.  Framework code is far more exposed than your
own, and it is immensely more likely that you've screwed up than the
Quartz devs have.



  I get that. I just don't think that's necessarily a good place to  
make that assertion. :-) My younger self spent hours on a bug I was  
sure was mine because it couldn't possibly be the API ... it was the  
API. :-)




 If you have an app where a column is a first-class conceptual
model, for example, you might need a more interactive header cell ...
There be dragons.


You mean like OmniOutliner?  :)


  I realize you work at Omni Group, so you see my point. :-) It's far  
from trivial to get this stuff heavily customized until you've spent a  
long time doing just that.


  Still - I own a copy of OmniOutliner registered to my real name - I  
see that the column headers (beyond a different drawing style) really  
only add right-click-to-show-context-menu action. That simple approach  
works perfectly for OmniOutliner, but I can think of more complicated  
scenarios where more direct interaction with the header itself would  
be the most natural approach ... *There* be dragons. :-D




This is where I was coming from.  Then I looked at the stack trace and
saw NSLayerKitGlue.  He might not be doing anything complicated, but
AppKit is.


  All I was saying there was that it's not really possible to assign  
a difficulty level as we don't really know what the OP is trying  
yet. :-)


  A note: Positively no disrespect intended.


--
I.S.


___

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: The iPhone SDK OpenGL ES Application template

2009-07-21 Thread Kyle Sluder
On Tue, Jul 21, 2009 at 10:18 AM, Wilson Chencanti.m...@gmail.com wrote:
 My question is: since an EAGLView is a subclass of UIView, is there a
 particular reason for the template to not follow the common pattern to
 adhere the beloved MVC?

Speed?  If you're using OpenGL, you're probably developing a game, and
are probably going to implement your own UI anyway.  The template sets
you up and gets out of your way.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [iPhone] CFAttributedStringRef autorelease - not possible?

2009-07-21 Thread Greg Guerin

Michael Hoy wrote:

I know it doesn't support NSAttributedString. However,  
CFAttributedStringRef is supported. (That's why I'm using it.) The  
documentation reads:


iPhone OS Note: While Core Foundation on iPhone OS contains  
CFAttributedString, there are no additions to the APIs in UIKit to  
add specific attributes such as font, style, or color, and there  
are no APIs to draw attributed strings.


My question is about casting CFAttributedStringRef to id, which  
appears not to work in certain circumstances. For example, adding  
an (id)CFAttributedStringRef to an NSMutableArray appears to work  
fine... CFGetRetainCount() reports an increase and decrease in the  
retain count after adding/removing.


Wrap CFAttributedStringRef (or CFMutableAttributedStringRef) in a  
class of your own making.  Then you can be sure it will autorelease  
correctly.


All it would need is a ref method/property that returns  
CFAttributedStringRef (or CFMutableAttributedStringRef), and a  
dealloc to call the appropriate CF function on the ref.  This seems  
almost trivial to write, and would probably take less time than it  
took to create the example showing the failure.


  -- GG

___

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


Responding to mouseDown in an NSImageView

2009-07-21 Thread Lynn Barton
My window has an NSImageView object within an NSScrollView. After  
setting the image and the image frame, I want to detect and respond to  
mouseDown on the image. The image appears in the view, but I found  
nothing responding to the mouseDown.


I tried subclassing NSImageView and putting a -(void)mouseDown: 
(NSEvent *)theEvent method in the subclass. That allowed me to get and  
process the event, but the image did not appear in the view. Can  
anyone help?


Lynn Barton

___

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


Expanding NSScrollView

2009-07-21 Thread Andrew Shamel

Hi All,

I've dug around through the archives, but couldn't turn anything up  
that addresses this question, so I turn to the collective wisdom of  
the list.


I'm trying to figure out how to create an NSScrollView subclass that  
expands vertically rather than scrolling, up to a certain height.  For  
instance, a scrollview containing an NSTextView would expand itself  
when the textview exceeded the visible  rect, until the textview  
reached a certain length, at which point normal scrolling behavior  
would commence.  Likewise, it would shrink back along the same  
parameters.


I am imagining that this might have something to do with the ClipView,  
but I may be way off.  Alternatively a scrollViewShouldScroll:  
delegate method would be convenient at this point.


If that wasn't coherent, or if anyone has any ideas, I would be  
sincerely grateful.


Peace,

Andy Shamel
___

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: The iPhone SDK OpenGL ES Application template

2009-07-21 Thread David Duncan

On Jul 21, 2009, at 10:18 AM, Wilson Chen wrote:


My question is: since an EAGLView is a subclass of UIView, is there a
particular reason for the template to not follow the common pattern to
adhere the beloved MVC?



There is really no difference in if you want to have the view  
controller or not. About the only thing to keep in mind is that if you  
do use a view controller, don't use the orientation change support.

--
David Duncan
Apple DTS Animation and Printing

___

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: Expanding NSScrollView

2009-07-21 Thread Quincey Morris

On Jul 21, 2009, at 11:55, Andrew Shamel wrote:

I'm trying to figure out how to create an NSScrollView subclass that  
expands vertically rather than scrolling, up to a certain height.


Expands vertically when what? When the window is resized? Or is it  
supposed to resize its window when it wants to expand?


Expands vertically into what? Are there other elements around it that  
have to be moved out of the way? Is it the sole content of the window?


If you can answer those questions, you'll know what to do with the  
scroll 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Expanding NSScrollView

2009-07-21 Thread Andrew Shamel

Thanks for the quick response!

I'm looking for it to expand as its documentView expands.

The scrollviews are contained in a custom view called CardView, which  
is itself inside a scrollview which I am happy to have act in the  
usual fashion as the CardView gets taller and shorter as a result of  
its expanding and contracting contents.  The custom scrollviews are  
arranged in a vertical stack within the CardView, and need to retain  
the same relative distance to one another as they expand and  
contract.  I believe I have this relative change in position handled.   
It's finer control over the expansion of the scrollview itself that  
I'm after.


I have two configurations: one containing an NSTextView, and one  
containing an NSTableView.


For the one containing the textview, i want the scrollView to expand  
as the textView does (rather than letting the textView become hidden  
inside the scrollView), up until the textView has four lines of text  
at which point, normal scrolling behavior starts (i.e., the content  
which will not be in view is hidden and the scrollbars activate).


For the one containing the tableview, I'm looking for similar  
behavior, only replacing four lines of text with four rows in the  
table.


I have managed to implement this behavior manually, based on checking  
the size of the content and the size of the scrollview each time the  
data is changed (i.e., implementing the textDidChange: delegate  
method, and monitoring the tableview's data source for new rows)


Where I am having trouble is in figuring out how to implement the  
behavior reliably when the CardView is automatically resized, for  
instance, as the window is resized.  I was hoping therefore, to figure  
out a more generalized method of getting the scrollview or some  
delegate to do it automatically, observing the size of its content as  
the content is resized, and resizing the content as it is resized by  
its superview.


As an example:

given:

CardView *card // assigned elsewhere
NSScrollView *scroller //assigned elsewhere

[card addSubview:scroller];

NSTextView *textView = [scroller documentView];

Say textView has a sentence of text in it that fits on one line when  
card is at a given width. In textView, I add another sentence,  
expanding to two lines of text.  At this point, scroller should get  
taller to accommodate the text.  When card shrinks as the window  
shrinks horizontally, scroller is resized as per its autosizing  
settings.  As card and scroller get narrower, what had once fit on two  
line is now forced onto three.  Normally, this would activate the  
scrollbars and all kinds of scrolling joy would commence.  I want to  
be able to control its vertical expansion relative to the needs of the  
text inside it.  As the views narrow, rather than expanding wantonly  
as they might with autosizing settings, I want to retain the fine  
control I have when new text is entered, so as to control when and how  
it grows and/or applies scrolling behavior.


Whew!  I hope that's clearer.

Thanks again for your help.

— a


On 21 Jul 2009, at 12:12 PM, Quincey Morris wrote:


On Jul 21, 2009, at 11:55, Andrew Shamel wrote:

I'm trying to figure out how to create an NSScrollView subclass  
that expands vertically rather than scrolling, up to a certain  
height.


Expands vertically when what? When the window is resized? Or is it  
supposed to resize its window when it wants to expand?


Expands vertically into what? Are there other elements around it  
that have to be moved out of the way? Is it the sole content of the  
window?


If you can answer those questions, you'll know what to do with the  
scroll 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:
http://lists.apple.com/mailman/options/cocoa-dev/mercator%40pileofdebris.com

This email sent to merca...@pileofdebris.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


SecRandom.h on iPhone OS 2.2.1?

2009-07-21 Thread Randall Meadows
I started working on a new project, and started out using the 3.0 SDK;  
I'm now far enough along to realize that I don't really need to  
eliminate older versions, so I switched the Base SDK to 2.2.1.


I do, however, use the Security framework, specifically  
SecRandomCopyBytes() to generate random numbers.  For 3.0, this simply  
required adding Security.framework to my project and #importing  
Security/Security.h.


However, when I switch to 2.2.1 and build the project,  
SecRandomCopyBytes and kSecRandomDefault are undeclared, even though  
they are documented as being Available in iPhone OS 2.0 and later.   
When I look at the Security.framework in my project, SecRandom.h  
(which is where those two things are documented as being declared in)  
is not included in the list of files.


I found it in the file system, at /Developer/Platforms/ 
iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/ 
Frameworks/Security.framework, but when I try to add *this* framework  
to the project, Xcode *actually* adds /Developer/Platforms/ 
iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/ 
System/Library/Frameworks/Security.framework instead.  This latter  
location is where all the other frameworks (Foundation.framework,  
CoreGraphics.framework, et al.) in the project live, but that  
Security.framework does not contain SecRandom.h.


Is this a situation where it works only on the device, not the  
simulator?  That would suck rocks.



Any suggestions are greatly appreciated...
randy

___

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


NSData dataWithBytes:Length: all 00

2009-07-21 Thread Chase Meadors
I have the following code, which is a category on NSData. It is always  
called on especially designated NSData objects with four bytes.


- (NSData *)resolve {

unsigned char *buf = [self bytes];

	const unsigned char *newBytes[4] = { (buf[3] - 0x08), buf[2], buf[1],  
buf[0] };


for (int i = 0;  i  4;  i ++) {
NSLog(@%02X, newBytes[i]);
}

NSData *ret = [NSData dataWithBytes:newBytes length:4];
return ret;

}

The for statement logging the individual bytes is exactly as expected.  
However, the new data object ret is . I couldn't really find  
an answer on google, probably because it's a simple answer I'm  
missing, so I asked here. Thanks for any help.

___

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: NSData dataWithBytes:Length: all 00

2009-07-21 Thread Stephen J. Butler
On Tue, Jul 21, 2009 at 3:38 PM, Chase Meadorsc.ed.m...@gmail.com wrote:
 I have the following code, which is a category on NSData. It is always
 called on especially designated NSData objects with four bytes.

 - (NSData *)resolve {

        unsigned char *buf = [self bytes];

        const unsigned char *newBytes[4] = { (buf[3] - 0x08), buf[2], buf[1],
 buf[0] };

When I compile this line, I get all kinds of warnings. Do you? And if
you do, why are you ignoring them? The warning helps point to what is
wrong.

You've allocated an array of four POINTERS, when what you want is an
array of four UNSIGNED CHARACTERS. So it should be:

const unsigned char newBytes[4] = { (buf[3] - 0x08), buf[2], buf[1], buf[0] };


        for (int i = 0;  i  4;  i ++) {
                NSLog(@%02X, newBytes[i]);
        }

        NSData *ret = [NSData dataWithBytes:newBytes length:4];
        return ret;

 }
___

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: NSData dataWithBytes:Length: all 00

2009-07-21 Thread James Walker

Chase Meadors wrote:
I have the following code, which is a category on NSData. It is always 
called on especially designated NSData objects with four bytes.


- (NSData *)resolve {

unsigned char *buf = [self bytes];

const unsigned char *newBytes[4] = { (buf[3] - 0x08), buf[2], 
buf[1], buf[0] };



You've declared an array of pointers to bytes, not an array of bytes. 
Take out that asterisk.




for (int i = 0;  i  4;  i ++) {

NSLog(@%02X, newBytes[i]);
}

NSData *ret = [NSData dataWithBytes:newBytes length:4];

return ret;

}


The for statement logging the individual bytes is exactly as expected. 
However, the new data object ret is . I couldn't really find 
an answer on google, probably because it's a simple answer I'm missing, 
so I asked here. Thanks for any help.

___




--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.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: SecRandom.h on iPhone OS 2.2.1?

2009-07-21 Thread David Duncan

On Jul 21, 2009, at 1:28 PM, Randall Meadows wrote:

I started working on a new project, and started out using the 3.0  
SDK; I'm now far enough along to realize that I don't really need to  
eliminate older versions, so I switched the Base SDK to 2.2.1.


You don't actually need to use the 2.2.1 SDK to target 2.2.1 users –  
just set your deployment target appropriately and ensure you don't use  
any 3.0 only features when running on 2.2.1.


Is this a situation where it works only on the device, not the  
simulator?  That would suck rocks.



I'm not familiar with that particular framework, but it is possible –  
there are a lot of things that only work on the device.

--
David Duncan
Apple DTS Animation and Printing

___

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: The iPhone SDK OpenGL ES Application template

2009-07-21 Thread Alexander Spohr


Am 21.07.2009 um 21:11 schrieb David Duncan:

There is really no difference in if you want to have the view  
controller or not. About the only thing to keep in mind is that if  
you do use a view controller, don't use the orientation change  
support.


Could you please elaborate on this?

I am very interested to know
- why it should be faster to do it in OpenGL
- how you do it in OpenGL

Thanx,

atze

___

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: The iPhone SDK OpenGL ES Application template

2009-07-21 Thread David Duncan

On Jul 21, 2009, at 2:01 PM, Alexander Spohr wrote:


I am very interested to know
- why it should be faster to do it in OpenGL


If you use the built in orientation support, then we place a transform  
on the view's layer. A transform on OpenGL content will force your  
rendering onto a slower path on some devices.



- how you do it in OpenGL



You need to register for UIDevice orientation notifications and use  
those notifications to rotate your modelview matrix.

--
David Duncan
Apple DTS Animation and Printing

___

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: Expanding NSScrollView

2009-07-21 Thread Quincey Morris

On Jul 21, 2009, at 12:55, Andrew Shamel wrote:


I'm looking for it to expand as its documentView expands.

The scrollviews are contained in a custom view called CardView,  
which is itself inside a scrollview which I am happy to have act in  
the usual fashion as the CardView gets taller and shorter as a  
result of its expanding and contracting contents.  The custom  
scrollviews are arranged in a vertical stack within the CardView,  
and need to retain the same relative distance to one another as they  
expand and contract.  I believe I have this relative change in  
position handled.  It's finer control over the expansion of the  
scrollview itself that I'm after.


I have two configurations: one containing an NSTextView, and one  
containing an NSTableView.


For the one containing the textview, i want the scrollView to expand  
as the textView does (rather than letting the textView become hidden  
inside the scrollView), up until the textView has four lines of text  
at which point, normal scrolling behavior starts (i.e., the content  
which will not be in view is hidden and the scrollbars activate).


For the one containing the tableview, I'm looking for similar  
behavior, only replacing four lines of text with four rows in the  
table.


I have managed to implement this behavior manually, based on  
checking the size of the content and the size of the scrollview each  
time the data is changed (i.e., implementing the textDidChange:  
delegate method, and monitoring the tableview's data source for new  
rows)


Ack! That seems far too complicated.

You can have your window controller (or whatever equivalent controller  
you're using) register via 'addObserver:selector:name:object:' to be  
notified when the NSTextView or NSTableView frame changes. (Note that  
you have to call 'setPostsFrameChangedNotifications:YES' on those  
views to be able to get these notifications.)


When you get a notification, compare the frame of the NSTextView or  
NSTableView with the bounds of the scroll view's clip view (the  
documentView frame and the clipView bounds are in the same coordinate  
system) to determine whether the clip view is too big, too small or  
just right.


If the clip view is the wrong size, you need to resize the view  
containing the scroll view (so that the things adjacent to the scroll  
view move out of its way) by the amount that the clip view is wrong.  
Autoresizing should then trickle down and produce the results you want.


There are a few things to be careful of:

-- resizing view while you're in the notification handler method may  
cause additional notifications, and you need to handle that


-- if you want the number of line/rows to change for other reasons  
(e.g. when you resize the window), you might have to observe the clip  
view frame too


-- if you have autohiding vertical scroll bars on you NSTextView or  
NSTableView, you may end up in a situation where the scroll view size  
change bounces up and down, and you need to handle that


HTH

___

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: Borderless window and focus

2009-07-21 Thread Ricky Sharp


On Jul 21, 2009, at 4:56 PM, ss2 cire wrote:

I have the following code to initialize a borderless window for  
fullscreen


- (void)initFullScreenWindow
{
NSScreen *theScreen = [[NSScreen screens] objectAtIndex:0];
	NSRect screenRect = NSMakeRect(0, 0, [theScreen frame].size.width,  
[theScreen frame].size.height);


fullScreenWindow = [[NSWindow alloc] initWithContentRect:screenRect

   styleMask:NSBorderlessWindowMask

 backing:NSBackingStoreBuffered

   defer:YES];
}


I would recommend creating a subclass of NSWindow.  In its designated  
initializer, call initWithContentRect as above.  You may also want  
to set the following properties:


[self setMovableByWindowBackground:NO];
[self setHasShadow:NO];
[self useOptimizedDrawing:YES];


Also provide these in your subclass:

- (BOOL)canBecomeKeyWindow
{
return YES;
}

- (BOOL)canBecomeMainWindow
{
return YES;
}


In your code that creates the instance of this custom window, issue a  
makeKeyAndOrderFront on that instance.  Things should then work a-ok.



then i have this code to show/hide the menubar and do my  
fullscreen window magic:


- (IBAction)showHideMenubar:(id)sender
{
if(fullScreenWindow == nil) {
[self initFullScreenWindow];
}
if([NSMenu menuBarVisible]) {
[NSMenu setMenuBarVisible:NO];
[RSCWindow orderOut:self];
[fullScreenWindow setContentView:rsWebView];
[fullScreenWindow makeKeyAndOrderFront:self];
} else {
[fullScreenWindow orderOut:self];
[RSCWindow setContentView:rsWebView];
[RSCWindow makeKeyAndOrderFront:self];
[rsWebView setFrame:rsWebViewNormalWindowFrame];
[NSMenu setMenuBarVisible:YES];
}
}


You can also use the SetSystemUIMode API to control the visibility of  
menu bar and/or dock.



___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.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


List FAQ and Cocoa learning resources

2009-07-21 Thread Erik Buck

Didn't there used to be a FAQ list for Cocoa-Dev?

Several people recently asked me for links to introductory Cocoa and  
Cocoa Touch information.  I pointed iPhone folks to http://developer.apple.com/iphone/library/navigation/GettingStarted.html 
 and the others to http://developer.apple.com/referencelibrary/GettingStarted/GS_Cocoa/index.html 
.   The Cocoa Getting Started link was actually hard to find.  It is  
buried under Reference Library and then Cocoa.  I seem to remember it  
being on the front page of Mac Dev Center the way the similar link is  
on the front page of iPhone Dev Center.


Anyway, I didn't find a FAQ for this list.  Does one exist?  Did I  
miss it because I always read through Cocoabuilder ?


Do any of you recommend technical conferences or training for  
introductory Cocoa developers?  At least one person asked me to  
recommend training that his company could reimburse.  I have always  
heard great things about the Big Nerd Ranch and enjoy Aaron Hillegass'  
books.  Are there other formal training opportunities outside of full  
blown university courses?  Are there informal courses beyond the  
fabulous university pod casts on iTunes?


There is the annual WWDC.  Isn't there a conference in Chicago too?  I  
think MacHack in Flint MI is defunct - right?  I know about http://www.voicesthatmatter.com/iphone2009/ 
 in Boston because I will be speaking at it (blatant plug - contact  
me for attendee discounts...)  Are there any other conferences?  Are  
there any in Europe, Asia, or Australia?


Is the http://www.cocoadev.com/ Wiki a good place to send newbies in  
your opinion?  I used to think so, but the site seems chaotic and  
stale now... I would love to be corrected though.


___

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


Found Re: List FAQ and Cocoa learning resources

2009-07-21 Thread Erik Buck

Sorry.  Right after I posted, I found http://www.cocoadev.com/index.pl?FAQs


On Jul 21, 2009, at 6:07 PM, Erik Buck wrote:


Didn't there used to be a FAQ list for Cocoa-Dev?

Several people recently asked me for links to introductory Cocoa and  
Cocoa Touch information.  I pointed iPhone folks to http://developer.apple.com/iphone/library/navigation/GettingStarted.html 
 and the others to http://developer.apple.com/referencelibrary/GettingStarted/GS_Cocoa/index.html 
.   The Cocoa Getting Started link was actually hard to find.  It is  
buried under Reference Library and then Cocoa.  I seem to remember  
it being on the front page of Mac Dev Center the way the similar  
link is on the front page of iPhone Dev Center.


Anyway, I didn't find a FAQ for this list.  Does one exist?  Did I  
miss it because I always read through Cocoabuilder ?


Do any of you recommend technical conferences or training for  
introductory Cocoa developers?  At least one person asked me to  
recommend training that his company could reimburse.  I have always  
heard great things about the Big Nerd Ranch and enjoy Aaron  
Hillegass' books.  Are there other formal training opportunities  
outside of full blown university courses?  Are there informal  
courses beyond the fabulous university pod casts on iTunes?


There is the annual WWDC.  Isn't there a conference in Chicago too?   
I think MacHack in Flint MI is defunct - right?  I know about http://www.voicesthatmatter.com/iphone2009/ 
 in Boston because I will be speaking at it (blatant plug - contact  
me for attendee discounts...)  Are there any other conferences?  Are  
there any in Europe, Asia, or Australia?


Is the http://www.cocoadev.com/ Wiki a good place to send newbies in  
your opinion?  I used to think so, but the site seems chaotic and  
stale now... I would love to be corrected though.




___

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


change color on a NSButton

2009-07-21 Thread David Alter
I have a Gradient button. An NSButton with Bezel Style set to
NSShadowlessSquareBezelStyle. I would like to make the button appear with
the blue highlight at times. The best way for me to describe this is if look
at the segment control. It has three states on a segment, not selected,
mouse down on a segment, and selected. The selected states is a gradient
blue. I would like to have these same three states for my NSButton. Is there
a way to do this?

thanks for the help.

enjoy
-dave
___

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: Missing vertical scroll bar - resolved

2009-07-21 Thread Dale Miller
My error was that I changed a frame origin and forgot to accommodate  
the change by increasing the frame size of the superview, thereby  
clipping off the vertical scroll bar.


Ok - IB is a great tool with a few flaws. I love my new little compact  
car, but I use my Eurovan when I go camping, or need to have more than  
4 people in the car, or need to bring something 6 feet long home from  
the store. Using IB requires a lot of coding effort to handle a  
dynamic number of subviews, and my experience was better with the  
programmatic approach. Dynamic sizes is beyond the scope of IB. It was  
suggested that I build the view tree with IB, but
there is no tree until run-time when the number of windows and the  
numbers of tabs for the tab views are supplied. Also, I indicated that  
the frame of the workspace (the scroll view clip view is specified at  
run-time (or defaults-setting time) by the user. The Cocoa view  
hierarchy AP (and hence, IB) does not accommodate resizing from inside  
out without doing the same calculations I was doing.


I've successfully done before what I was trying to do here. I've also  
experimented with multiple instantiation of NIB's, and my experience  
was that it was harder to do and took longer to debug, especially with  
the undocumented side-effects I experienced.


A theological insistence on using IB where it is awkward to use is a  
kind of blind spot, too.


Long ago, when I was an electrical engineering student, a prof gave an  
exam with a problem which involved solving for the roots of a  
quadratic equation.
We dutifully attacked the problem with our slide rules (no HP300's  
yet). We got bad answers because we failed to realize that the  
solution involved the difference of two nearly identical numbers which  
could not be entered with enough precision using results from our  
slide rules. We should have used a different technique in this case,  
but we were bent on using that wondrous tool - the slide rule.


Dale Miller
dalelmil...@cableone.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: AppleScript Record and NSDictionary

2009-07-21 Thread Jim Correia

On Jul 21, 2009, at 6:51 PM, Steve Cronin wrote:

From my Cooca app I want to call an AppleScript with several  
parameters one of which is an AppleScript record.


[...]

When I look at the docs for -recordDescriptor and I see the 4  
character code business - I get the ugly sinking feeling but maybe  
that's the only way...


I've tried to move the coercion into AppleScript but there is  
nothing that will do that except the magic 'user record fields'.

But there are warnings about resouce use for the 'magic' values
(And anyway while seated in front of this machine, I don;t really  
like magic!!)


- (NSAppleEventDescriptor) coerceDictionary(NSDictioanary  
*)dictionary {
	NSAppleEventDescriptor *result = [NSAppleEventDescriptor  
recordDescriptor];

NSArray *keysArray  = [dictionary allKeys];
NSArray *valuesArray = [dictionary allValues];
unsigned int keyCoount = [keysArray count];
for ( i = 0; i  keyCount; i++) {

//the good stuff happens here

}
return result;
}

So  is there an exprienced soul out there who might share a snippet  
of code or a an illuminating link?


Since you omitted // the good stuff happens here it isn't clear to  
me what, if anything, you've already tried.


An AE record is keyed by four character codes. There is a special key  
- keyASUserRecordFields - which is an AEList of sequential keys and  
values. When this is present in the record, these appear as string  
keys to AppleScript.


So, create an AE record, and add an appropriate list to the record  
with the key of keyASUserRecordFields. Whether you write this code  
using the C API or the Foundation NSAppleEventDescriptor API is now  
just an implementation detail :-)


Jim

___

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: Responding to mouseDown in an NSImageView

2009-07-21 Thread John C. Randolph


On Jul 21, 2009, at 11:35 AM, Lynn Barton wrote:

My window has an NSImageView object within an NSScrollView. After  
setting the image and the image frame, I want to detect and respond  
to mouseDown on the image. The image appears in the view, but I  
found nothing responding to the mouseDown.


I tried subclassing NSImageView and putting a -(void)mouseDown: 
(NSEvent *)theEvent method in the subclass. That allowed me to get  
and process the event, but the image did not appear in the view. Can  
anyone help?


Not with the minimal information you've given.  Show us the code.

-jcr

___

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


Confirm bug with [NSColor colorWithPatternImage:]?

2009-07-21 Thread Graham Cox
Using [NSColor colorWithPatternImage:] appears to ignore the  
resolution of the image. For example if I have a 100 x 100 pixel 600  
dpi image, the pattern is rendered with 100 x 100 point tiles at 72  
dpi, rather than 12 x 12 point tiles at 600 dpi. Is this intentional,  
or is it a bug?


Also, when the same pattern is printed rather than drawn on screen, it  
still has 72 dpi resolution, which is very pixellated and looks nasty  
(jn my test case the pattern consists of many fine dots).


I'm creating the pattern like this:

		NSImage* image = [[NSImage alloc] initWithContentsOfFile:[sheet  
filename]];

[image setCacheMode:NSImageCacheNever];
[image setScalesWhenResized:YES];
[image recache];

NSColor* patColour = [NSColor colorWithPatternImage:image];
[image release];


(the cache never setting was an attempt to avoid this problem but it  
has no effect).


--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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