Re: Enable a button once text is added to textfield

2011-05-04 Thread Kyle Sluder
On May 3, 2011, at 9:10 AM, Eric Williams wile...@gmail.com wrote:

 Any suggestions on how I can bind a button to a textfield so that the button 
 is disabled when the field is empty, and then enabled once text has been 
 entered in the field?

The typical MVC approach would be to bind your buttons enabled binding to a key 
on a controller object that, in turn, reflects the state of your text field.

Remember, the controller is where everything meets.

--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: Instruments and leaks in a DRM framework

2011-05-04 Thread Wim Lewis

On May 1, 2011, at 3:42 AM, Jose R.P. - Renacentist Software wrote:
 I've run Instruments in order to detect leaks in a sample xcodeproj 
 (RTestApp) for the framework I'm creating. There are leaks and the tool never 
 identifies my Framework as the responsible one, but there are at least fifty 
 Foundation (substringWithRange:) and libcrypto (CRYPTO_malloc) leaks.
 
 Is this result reliable? I mean, I don't want to be fooled by Instruments 
 into believing that I'm not the responsible of the leaks.


Instruments (or malloc_history or any of the similar tools) will tell you where 
the object was allocated, but that doesn't always tell you who should have 
freed it. For example, if you have code like this

NSString *blah = [otherString substringWIthRange: ... ];
[blah retain];
...
// never getting around to releasing it

will show the source of the leaked string as -substringWIthRange:, but the bug 
is in your code.

Most of the time the culprit is visible somewhere in the call stack above the 
malloc event that Instruments finds; that's why it records the call stack for 
you. In more complicated situations you may have to trace through multiple 
retains, releases, autoreleases, and the like to find the unbalanced call.


___

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

Please do not post 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: Vertical alignment in NSTextView

2011-05-04 Thread Rimas M.
Hello Andrew,

Nope - that will not going to work, because container inset is expressed as
a size and inset is set equally from both sizes: inset.width for left and
right margins, inset.height for top and bottom margins.

But overwriting NSTextView's -(NSPoint)textContainerOrigin might do the
trick. Going to try that.

Regards,

Rimas M.

On Tue, May 3, 2011 at 7:05 PM, Andrew Glushchenko nosetin...@gmail.com
wrote:
 Hello, Rimas
 You can change the inset of the NSTextContainer associated with the
 NSTextView for this purpose. See setTextContainerInset method of
NSTextView.
 2011/5/3 Rimas M. apple.list...@gmail.com

 Hello,

 I continue my fight with cocoa text system :)) At the moment I am
 loosing..

 Now I am trying to implement vertical text alignment in NSTextView. If
 I would need only drawing, would be quite easy. But I need to maintain
 an editing capability.

 The thing I am talking about is very similar (or even the same) to the
 text writing inside shape (rectangle) using Keynote: insert rectangle
 shape, double click it ant write some text. Using inspector (Text tab)
 you can choose between top, middle and bottom vertical alignment.

 I am almost sure, that I need to subclass and overwrite some stuff
 from either NSLayoutManager or NSATSTypesetter. Just not sure which
 exact... Any thoughts?

 Best Regards,

 Rimas M.
 ___

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

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

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

 This email sent to nosetin...@gmail.com


___

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

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

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

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


Re: Interruption of NSTreeController's selectionIndexPaths updating after mouseDown

2011-05-04 Thread Quincey Morris
On Apr 28, 2011, at 07:46, Kirill K wrote:

 the thread that adds nodes to TreeController interrupts the sequence
 (I guess) called by mouseDown event so insertObject:
 atArrangedObjectIndexPath: is called before
 thensetSelectionIndexPaths:.

If you guess the sequence of events when it fails, you may end up chasing the 
wrong problem. :) Better to actually find out what's going wrong. However ...

I think you have two fundamental flaws in your approach:

-- How well it works is going to depend on whether the NSOutlineView uses an 
event tracking loop or not, in response to 'super mouseDown:event:'. Predicting 
its behavior seems very fragile, and you'll need a deeper understanding of run 
loop modes to analyze the behavior.

-- You *think* you've solved a thread synchronization problem by pushing the 
'insertObject:...' calls into the main thread. You haven't. You've solved 2 
sub-problems: (1) preventing KVO notifications leading to UI updates on a 
background thread, and (2) preventing data corruption resulting from using 
non-thread-safe methods in multiple threads simultaneously.

Those are the easy things. The hard thing is to *design* a thread 
synchronization strategy that actually works.


___

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

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

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

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


Re: onSocketDidDisconnect in CocoaAsyncSocket

2011-05-04 Thread Bing Li
Dear Patrick,

Thanks so much for your reply!

I ever believed that TCP protocols handle everything on the connection. Only
UDP needs a lot of work to manage the connection. According to your
description, it is not like that?

I have not worked on a so low level network programming. Your email helps me
a lot. If you could take a look at the code, I appreciate so much!

Best,
Bing

On Wed, May 4, 2011 at 4:13 PM, Patrick Mau p...@me.com wrote:

 Hallo Bing

 The Networking API gives you choices to react. It was a good design to not
 specify automatic timeouts within TCP.

 Think about unplugging a network cable or even a 5 minute power outage. If
 you, as an application designer rely
 on a functional connection even afterthese events, you could do with TCP.
 Becuase no one but you is responsible
 to decide how to react. Therefore no-one has closed anything for you.

 Regarding timeouts, I think every networked client-server code has to
 handle timeouts on an application level to
 limit resource usage.

 You can even handle your client getting killed in Activity Monitor by
 writing a signal handler for SIGTERM.
 That is, by the way, the difference between the Quit and Force Quit
 action. One sends a SIGTERM, the
 other a SIGKILL. The last one can not be handled in code, per definition.

 You should not use socket I/O functions in signal handling code hoever, you
 should only set a flag and
 test for that in you main run loop.

 Regarding heartbeat, there's the SO_KEEPALIVE socket option, that is used
 to transmit packets of zero length
 on idle connections. This is useful to prevent hardware in your network,
 i.e firewalls or load-balancers to
 forget about NAT or dynamic rules. They do limit resources, too. By using
 timeouts.

 Instead of talking about TCP in general I will look at the sample code you
 mentioned in your first mail
 and code an example project if I have the time today.

 Best regards
 Patrick



 On 04.Mai.2011, at 05:52, Bing Li wrote:

 Dear Patrick,

 Thanks so much for your answer!

 I don't know the details of TCP. However, TCP should be a reliable
 protocol. Developers are not required to keep its connection state since TCP
 does that. That's one of the important differences between TCP and UDP,
 right? When using UDP, it is mandatory to keep the connection by developers
 themselves. Am I right?

 According to my experiences, when a TCP connection is disconnected without
 calling the relevant closing method, an exception should be thrown in the
 counterpart side. Do you think so? A heartbeat you mentioned should be
 handled by TCP not programmers.

 Best regards,
 Bing

 On Wed, May 4, 2011 at 2:08 AM, Patrick Mau p...@me.com wrote:

 Hallo Bing

 I saw your message and thought I share my ideas. Maybe it's of some use to
 you.

 TCP/IP is a state machine, meaning it can only react to state changes on a
 connection.

 When you kill a connected client, no packet is transmitted to your server
 anymore.
 That means that it has not received a FIN packet that would indicate your
 client
 has been killed.

 Your server will only know about your terminated client by the time it
 reads or writes
 to the socket, because it will no longer receive an ACK for these packets.

 That's where timeouts come into play. If you install some kind of timer
 that would fire
 after a certain time of inactivity, your server itself should close the
 connection.

 It will then timeout waiting for the ACK that it is waiting for in
 response to the
 FIN packet it has tried to send.

 That's all based on on my BSD socket programming knowlegde, I've not used
 the CocoaAsyncSocket API myself.

 I hope it gives you some idea.
 Patrick

 On 02.Mai.2011, at 18:16, Bing Li wrote:

  Dear all,
 
  Can anyone answer this question?
 
  Thanks so much!
  Bing
 
  On Fri, Apr 29, 2011 at 7:21 PM, Bing Li lbl...@gmail.com wrote:
 
  Dear Michael,
 
  Disgracefully means the client does not close normally. It might be
  crashed or closed by killing the relevant thread or process. I did that
 by
  clicking the red Tasks button in XCode. In this situation, the
 connection
  must not be closed properly with the socket methods.
 
  According to my test, [AsyncSocketDelegate onSocket:
  willDisconnectWithError:] is not called either.
 
  I got the sample code from
  http://www.macresearch.org/cocoa-scientists-part-xxix-message. I am
 still
  a new developer. I am not sure if the code has any problems.
 
  Thanks so much for your help!
 
  Best regards,
  BIng
 
 
  On Fri, Apr 29, 2011 at 6:56 AM, Michael Dautermann 
 dauterm...@mac.comwrote:
 
 
  I started to use CocoaAsyncSocket to establish TCP connections among
  iPads.
 
  I got a problem. According to the references (
  http://code.google.com/p/cocoaasyncsocket/wiki/Reference_AsyncSocket
 ),
  onSocketDidDisconnect would be invoked immediately if the connection
 is
  not
  already disconnected. I felt confused. What does not already
  disconnected
  mean? I think 

Best strategy of handling many separated text lines

2011-05-04 Thread Дмитрий Николаев
Hello!

Does using many NSTextView is good strategy for several separated text lines ?

I need draw text right-aligned and calculate width for each line.


___

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

Please do not post 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: Best strategy of handling many separated text lines

2011-05-04 Thread Graham Cox
Hard to say from the vague description, but I'd say that having one text view 
per line is probably a bad idea.

You could have one text view, set the text right-align (NSParagraphStyle on 
NSAttributesString/NSTextStorage) then set the line spacing to space the lines 
how you want, but on the other hand if it's more like a table perhaps a table 
view might be the way to go. Finally you could just draw the lines of text in a 
single view. It all depends...

--Graham




On 04/05/2011, at 7:06 PM, Дмитрий Николаев wrote:

 Hello!
 
 Does using many NSTextView is good strategy for several separated text lines ?
 
 I need draw text right-aligned and calculate width for each line.
 
 

___

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

Please do not post 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: block animation

2011-05-04 Thread Brian Bruinewoud
Ignore my parallel issue with loading views - they are not affecting this.

I've now made a simple project which exhibits this animation issue.

I create a view based ipad app
Add a toolbar to the top
and add two buttons to the main view: Animate and Nothing
The button that comes with the toolbar pops up a popover
The popover contains a single button, Animate, and some space.
Both Animate buttons are connected to a method of the main view controller 
(see below).
When I touch the Animate in the main view, both the touched Animate button 
and the Nothing button are animated.
When I touch the Animate in the popover, only the touched Animate button is 
animated, not the Nothing button.

Question is: Why doesn't the Nothing button animate in all calls to the method?

- (IBAction) animateStuff: (id) sender
{
UIButton *b = (UIButton*)sender; // either one of the Animate buttons

[ UIView animateWithDuration: 0.25 
   delay: 0.01
 options: UIViewAnimationOptionCurveEaseIn
  animations: ^{
  // move the Animate button
  CGRect r = b.frame;
  r.origin.x = r.origin.x + 10;
  r.origin.y = r.origin.y +  5;
  b.frame = r;
  
  // resize the Nothing button
  r = self.nothingButton.frame;
  if( r.size.width == 400 )
  {
  r.size.width  = 100;
  r.size.height = 100;
  }
  else
  {
  r.size.width  = 400;
  r.size.height = 400;
  }
  self.nothingButton.frame = r;
  }
  completion: nil
 ];
}

Full project available on request (33Kb zip)

On 04/05/2011, at 01:53 , David Duncan wrote:

 On May 3, 2011, at 3:40 AM, Brian Bruinewoud wrote:
 
 Hi All,
 
 self.view.alpha is animated but nothing at all happens to drawingVC.view.
 
 
 My guess would be that 'drawingVC.view' isn't actually in a window anywhere.
 
 Given your current and previous question however, I would posit that you are 
 mis-using UIViewControllers and possibly causing various other issues for 
 yourself (that said, I don't know why you get the results you do in your 
 other question).
 
 I would highly recommend that you read the View Controller Programming Guide, 
 especially the section on view controller containment (spoiler alert: what 
 you are doing is not supported). If you want to be able to load arbitrary 
 views from nibs to add to a view managed by a view controller, the 
 recommendation is to use an NSObject subclass to own the view and UINib to 
 load the nib.
 --
 David Duncan
 

___

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

Please do not post 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: image rotation

2011-05-04 Thread John C. Randolph
Several years ago, I wrote this sample code project:

http://developer.apple.com/samplecode/Transformed_Image/index.html

It demonstrates the use of NSAffineTransform to rotate, scale, and shear images.

-jcr


On Apr 29, 2011, at 7:48 AM, Amy Heavey wrote:

 Hi,
 
 I'm trying to generate a new image that is made up of a combination of other 
 images.
 
 As I iterate over the array holding the images I want to do is...
 - place the componant image in the new canvas at a certain point (150,187)
 - rotate the componant image by a certain value (calculated previously)
 
 I don't mind how the image fits in the new canvas, it doesn't have to be 
 completely within it.
 
 I think I need to use NSAffineTransform?
 
 I was using drawinrect previously for non-rotated movement.
 
 Do I need to draw the componant image to the canvas first then rotate it?
 
 The code I have at the moment is
 
 [code]
 //calc rotation
   double rotation = 360 / ki;
   double rotateby = rotation;
   
   //set coordinates to x,y - 150,187 to start
   float x = 150;
   float y = 187;
   
   //for each image
   NSEnumerator *imageLoop = [kitImages objectEnumerator];
   NSString *imgPath;
   
   while ((imgPath = [imageLoop nextObject])) {
   NSImage *img = [[NSImage 
 alloc]initWithContentsOfFile:imgPath];
 
   //rotate image
   
   
   //apply image to view
   [targetImage lockFocus];
   
   
   //[img drawInRect:NSMakeRect(x,y,xb,yb) 
 fromRect:NSMakeRect(150,150,0,0) operation:NSCompositeCopy fraction:1];
   
   //set new rotation
   rotation = rotation+rotateby;
 [/code]
 
 I've tried looking at some of the samples, but they seem to be cover rotating 
 in place and resizing which is more complicated than I'm looking for. I'm 
 expecting to effectively have the componant images fan out on the canvas.
 
 If anyone could help me with the process I'd be grateful, do I have to create 
 a intermediary image to make the rotated image square?
 
 Thanks,
 
 Amy
 
 
 
 Many Thanks
 
 Amy Heavey
 Willow Tree Crafts
 www.willowtreecrafts.co.uk
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jcr%40mac.com
 
 This email sent to j...@mac.com

___

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

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

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

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


Converting a large project to GC

2011-05-04 Thread Joao Manuel Da Silva Neves
Apple's documentation states: The process of migrating a large project that 
uses reference counting can be difficult and error-prone—some patterns that 
work correctly with manual memory management will be incorrect after 
translation. In general, it is recommended that you use garbage collection only 
in new projects. If you already have a well-architected, well-understood 
application that uses reference counting, there should be little reason to 
migrate to GC

Unfortunately we have a large project (think Apple's Aperture) that we're 
considering for migration to GC in order to reduce memory crashers and simplify 
memory management in the future. 
Has anyone tried converting a large project to GC? If YES was it successful and 
worth it? What were the main issues encountered during the conversion?
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


L-shaped custom view in Cocoa?

2011-05-04 Thread Vyacheslav Karamov

Hi All!

I need to make custom view in the form of letter L.
How to do it?

Thank you in advance,
Vyacheslav.
___

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

Please do not post 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


iOS nib weirdness...

2011-05-04 Thread Steve Christensen
I'm working on an app that uses a tab bar. I created a new nib to set up a 
view+controller and added a new tab item to the main nib that references the 
controller and the controller's nib, plus I filled in some basic functionality 
in the view controller. Since it's relevant, the controller's IBOutlets are

IBOutlet MyTableView* _resultsTable;
IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
IBOutlet UISearchBar* _searchBar;

When I ran the app and used the new view's UI, I got an unexpected 
unrecognized selector exception when trying to access a custom method in 
_resultsTable. When I looked at their values in the debugger, I found that 
_resultsTable was an instance of UITableView, not MyTableView; and 
_searchActivityIndicator and _searchBar were both nil.

I thought that there could be a missing class issue, but the MyTableView class 
is implemented since creating a test MyTableView instance in code works just 
fine. That still doesn't explain the other nil values since all three views 
were wired up in IB: the view controller shows the views connected to the 
outlets and the views show themselves as connected.

Grasping at straws, I trashed the build results and did a clean build, and even 
re-launched Xcode, with no difference in behavior. I could very well be doing 
something dumb but I'm not exactly sure where to look since I've (correctly) 
set up this same sort of thing before and it worked fine. BTW, I'm using Xcode 
3.2.6 + iOS SDK 4.3. Any ideas?

steve

___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Ken Thomases
On May 4, 2011, at 8:41 AM, Vyacheslav Karamov wrote:

 I need to make custom view in the form of letter L.
 How to do it?

You don't need to.  You may think you do, but you don't.  And you can't.  Just 
make a regular rectangular view and only draw in the parts you want to.

Regards,
Ken

___

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

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

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

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


Re: L-shaped custom view in Cocoa?

2011-05-04 Thread Steve Christensen
All views are rectangular in shape. You can restrict drawing and responding to 
events to an L-shaped area, but the view itself will still be a rectangle.


On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote:

 I need to make custom view in the form of letter L. How to do it?

___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Alexander Spohr
Is your viewController a subclass of UITableViewController?
Then your nib is not loaded.

UITableViewController is broken. It does not keep the contract of 
initWithNibName:bundle:

atze


Am 04.05.2011 um 16:00 schrieb Steve Christensen:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code works 
 just fine. That still doesn't explain the other nil values since all three 
 views were wired up in IB: the view controller shows the views connected to 
 the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
Yes, the table view is typed as MyTableView in the xib.


On May 4, 2011, at 7:21 AM, Evadne Wu wrote:

 Just a wild thought, but could you probably look into the (offending) XIB and 
 make sure that the table view is of a custom class?
 
 -ev
 
 On May 4, 2011, at 22:00, Steve Christensen wrote:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code 
 works just fine. That still doesn't explain the other nil values since all 
 three views were wired up in IB: the view controller shows the views 
 connected to the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve

___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
No, the view controller is a subclass of UIViewController and is being 
initialized via -initWithCoder:.


On May 4, 2011, at 7:47 AM, Alexander Spohr wrote:

 Is your viewController a subclass of UITableViewController?
 Then your nib is not loaded.
 
 UITableViewController is broken. It does not keep the contract of 
 initWithNibName:bundle:
 
   atze
 
 
 Am 04.05.2011 um 16:00 schrieb Steve Christensen:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code 
 works just fine. That still doesn't explain the other nil values since all 
 three views were wired up in IB: the view controller shows the views 
 connected to the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve

___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Fritz Anderson
On 4 May 2011, at 9:00 AM, Steve Christensen wrote:

 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.

Have you verified that

1) you are inspecting the outlets in the debugger at a time after the NIB has 
loaded and the connections are made? -viewDidLoad would be favorite.

2) Interface Builder knows that your table view is a MyTableView? Check the 
identity inspector (third tab in the Utility area of Xc4, last tab (as I 
remember it) in the floating inspector in IB/Xc3.

3) the other two outlets are actually connected?

4) File's Owner in the XIB for the controller is actually of the controller's 
class?

5) you are not instantiating your controller twice? The MainWindow.xib template 
for tab-based targets does it; do you do it elsewhere yourself?

6) the class of the controller for that tab (in MainWindow.xib) is declared to 
be of the right class?

— F

___

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

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

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

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


Request for beta testers/feedback for programmer utility [please reply off-list]

2011-05-04 Thread Jim Thomason
All,

I've written a small-ish mostly background clipboard/macro type
utility and was wondering if anyone would be interested in helping me
beta test/provide feedback.

It's simply a way to store and insert frequently used snippets of text
in a very fast manner. I wanted something to pop in, give me the
snippets of text I need, then vanish so I can get back to work. I know
there are existing utilities for this, but they didn't quite meet my
needs.

I know that it's general purpose, but it's most glaringly obvious as a
programmer utility tool, so I figured I'd go to the source and see if
I could recruit some more programmers to take a look at it. It's great
for stubbing out code and inserting frequently used blocks of text.

I'm intentionally being a bit vague here because I don't want to
accidentally clutter up the list with lots of discussion traffic on my
specific thing. But if anyone'd be interested in taking a look and
helping me make sure it's properly fleshed out, looks useful, etc,
then please reply off list and I'll hook you up.

Thanks,

-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: iOS nib weirdness...

2011-05-04 Thread glenn andreas

On May 4, 2011, at 9:00 AM, Steve Christensen wrote:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 


First step:  Don't prepend your ivars with underscores.

From 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html,
 and I quote:

   • Avoid the use of the underscore character as a prefix meaning 
private, especially in methods. Apple reserves the use of this convention. Use 
by third parties could result in name-space collisions; they might unwittingly 
override an existing private method with one of their own, with disastrous 
consequence.



You may be seeing one of those disastrous consequences



Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
On May 4, 2011, at 8:02 AM, Fritz Anderson wrote:

 On 4 May 2011, at 9:00 AM, Steve Christensen wrote:
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 Have you verified that
 
 1) you are inspecting the outlets in the debugger at a time after the NIB has 
 loaded and the connections are made? -viewDidLoad would be favorite.

Yes, I put a breakpoint in -viewDidLoad, as well as just letting it run and 
crash, and then look at the instance variables in the debugger. At both places, 
the table is a UITableView and the other two outlets are nil.

 2) Interface Builder knows that your table view is a MyTableView? Check the 
 identity inspector (third tab in the Utility area of Xc4, last tab (as I 
 remember it) in the floating inspector in IB/Xc3.

Yes, the Type field in the xib file's main window, as well as the Class field 
in the inspector window, show the type as MyTableView.

 3) the other two outlets are actually connected?

Yes, the outlets tab in the inspector window shows the file owner/view 
controller's outlets to be all wired up. And moving the mouse over those items 
highlights the corresponding views in the main xib window.

 4) File's Owner in the XIB for the controller is actually of the controller's 
 class?

Yes.

 5) you are not instantiating your controller twice? The MainWindow.xib 
 template for tab-based targets does it; do you do it elsewhere yourself?

No, my MainWindow.xib has a tab bar controller that has a tab item referencing 
this view controller and its corresponding nib file.

 6) the class of the controller for that tab (in MainWindow.xib) is declared 
 to be of the right class?

Yes, and the controller is being instantiated as expected.

___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Vyacheslav Karamov
Yes, I understand, I meant want to know how to restrict drawing and 
responding to events to L-shaped area.


04-May-11 17:38, Steve Christensen пишет:

All views are rectangular in shape. You can restrict drawing and responding to 
events to an L-shaped area, but the view itself will still be a rectangle.


On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote:


I need to make custom view in the form of letter L. How to do it?





___

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

Please do not post 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: iOS nib weirdness...

2011-05-04 Thread Steve Christensen
On May 4, 2011, at 8:17 AM, glenn andreas wrote:

 On May 4, 2011, at 9:00 AM, Steve Christensen wrote:
 
 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 First step:  Don't prepend your ivars with underscores.
 
 From 
 http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html,
  and I quote:
 
  • Avoid the use of the underscore character as a prefix meaning 
 private, especially in methods. Apple reserves the use of this convention. 
 Use by third parties could result in name-space collisions; they might 
 unwittingly override an existing private method with one of their own, with 
 disastrous consequence.
 
 You may be seeing one of those disastrous consequences

I did think about that. I renamed the ivars to something completely different, 
rewired the xib and tried it out with no difference in behavior.

___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Ken Thomases
On May 4, 2011, at 10:21 AM, Vyacheslav Karamov wrote:

 Yes, I understand, I meant want to know how to restrict drawing and 
 responding to events to L-shaped area.

You are responsible for writing the drawing code and the code which responds to 
events.  In your drawing code, just don't draw in the part which isn't in the L 
shape.  If you prefer, you can clip the graphics context to enforce that.  See 
the -[NSBezierPath addClip] method.

For events which have location associated with them, you should check the 
location and just invoke super for any which fall outside of the L shape.

Regards,
Ken

___

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

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

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

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


Nested NSCollectionView scroll weirdness

2011-05-04 Thread Half Activist
Hello all,

I'm having kind of troubles with embedded collection views.
I'm displaying a list of items vertically, each of these items may have 
subitems i list in another collection view, this time horizontally.
Everything fine so far, the NSCollectionViewItems get loaded well, for 
both the parent list and the child lists.
Now, a sublist's too long to be displayed, the horizontal  scroller 
appears but scrolling won't do anything on this sublist.
I subclassed NSScroller + NSScrollView and stepped the code, and all I 
can tell to this point, is that the embedded scrollview receives events 
(especially the scrollWheel: message),
but, it does nothing. The document rect is desperatly the same.
I tried to put an NSTextView instead of the nested collectionview and 
the same behaviour is shown. So i don't even know whether it's a scrollview or 
collection view issue.

I'd be ready to write a hand made collectionview if i was sure i won't 
get the same problem because of embedded scrollviews.

Thanks in advance.

___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Steve Christensen
You could either use a path or a pair of rectangles to clip drawing and test 
for events such as a mouseDown or tap. You'll need to calculate the dimensions 
based on the current size of the view.


On May 4, 2011, at 8:21 AM, Vyacheslav Karamov wrote:

 Yes, I understand, I meant want to know how to restrict drawing and 
 responding to events to L-shaped area.
 
 04-May-11 17:38, Steve Christensen пишет:
 All views are rectangular in shape. You can restrict drawing and responding 
 to events to an L-shaped area, but the view itself will still be a rectangle.
 
 
 On May 4, 2011, at 6:41 AM, Vyacheslav Karamov wrote:
 
 I need to make custom view in the form of letter L. How to do it?

___

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

Please do not post 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


NSClassFormString returning nil.

2011-05-04 Thread Gustavo Pizano
Hello all.

Im sorry if this isn't the right place to post this, I wasn't sure if xcode 
list obj-c list or this one, so I decided this one.

I have created a Static Library which makes use of another library (cocos2d to 
be more specific), then I created a project that will use that library i 
created. When I drag-drop the library to that project well I got linker errors. 
Finally after working a little bit with that problem I ended up creating a 
wrokspace and dragging there both projects (library and final project), then I 
configured the link libraries,  and voila it worked.

NOT JUST YET!, it was ok until in the library i created I needed to use a 
NSClassFromString, then nightmare began again. It returned me nil all the time. 
I checked that the class names were ok, but nothing.

So I did a research and found a technical ticket form apple saying that when 
using this class from within a static library there is a bug and I may need to 
add to the other linker flags a -all_load or -force_load

I checked my library build settings and I saw that -ObjC flag was there, so I 
added -all_load , recompile library, recompile final project test and 
nothing... So then I thought i may need to put those flag in the final product 
build settings, I did so and OMG again linker problems, file now founds etc.. 


What can I do? 

Thx in advance for any help provided and if this isn't the right list to post I 
apologize please let me know to which one should I write.


Gustavo ___

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

Please do not post 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: Enable a button once text is added to textfield

2011-05-04 Thread Peter Hudson

In IB set the button to be disabled.
Set yourself up a delegate for the text field and let the delegate  
respond to

-(void)controlTextDidChange:(NSNotification *)aNotification
It is also convenient if the delegate has a pointer to the button as  
well.


When the delegate receives this notification you can then inspect what  
the user has typed

and set the button state accordingly.

Peter
___

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

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

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

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


Re: NSClassFormString returning nil.

2011-05-04 Thread Quincey Morris
On May 4, 2011, at 09:12, Gustavo Pizano wrote:

  linker problems

Vagueness like this makes it hard to help you. Sometimes the actual error 
messages are important in deciding where to look for a solution.

 What can I do? 

I'd very seriously suggest you don't use a static library at all. It really 
doesn't provide you with any benefits, so you may as well include the source 
code directly instead.

The whole point -- well, *a* whole point -- of a static library (in traditional 
C terms) is to allow you to link just those parts that are referenced by your 
client application, without having to figure it out for yourself. This doesn't 
work very well in Objective-C, because the language's dynamism makes it 
impossible in general to determine what's referenced at link time.

If you have other reasons for library-izing your Objective-C code, a framework 
is a much better choice, probably.


___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Quincey Morris
On May 4, 2011, at 08:38, Ken Thomases wrote:

 For events which have location associated with them, you should check the 
 location and just invoke super for any which fall outside of the L shape.

There's also -[NSView hitTest] for customizing the behavior at a slightly 
higher lever than redirecting events. This might help an odd-shaped view be a 
better citizen when placed in a window with other views.


___

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

Please do not post 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: NSClassFormString returning nil.

2011-05-04 Thread Kyle Sluder
On Wed, May 4, 2011 at 10:11 AM, Quincey Morris
quinceymor...@earthlink.net wrote:
 I'd very seriously suggest you don't use a static library at all. It really 
 doesn't provide you with any benefits, so you may as well include the source 
 code directly instead.

Static ObjC libraries are still very useful on iOS, because you can't
load code dynamically. It's just so much easier and faster to split
our apps up into seven or eight static libraries rather than our old
method of compiling all the source into one binary at the same time.
Since we reuse frameworks on the desktop and on iOS, this is a much
more natural solution.

--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: NSClassFormString returning nil.

2011-05-04 Thread Gustavo Pizano
Quincey Hello and thx for the reply

I need to use the a library because its a iOS project so no framework, and also 
because I will be reusing the code in the lib for many other apps not just this 
one Im making.. 

So right now I have the following set up:

On my Library Project:

Note: By nothing I mean empty no value
2 Targets: 
-myLibrary :  
Library Search Paths : nothing
Other Link Flags : nothing

Copy Headers:  As Public : All my Headers. 
-cocos2d
cocos2d lib was easily configured I have done it before for 
other UIKit apps 

I compile this project without problem and it compiles.

Now I created my Final app that will use my library

I made a workspace where I put the project and the project that contains the 
library, both are there.
-Added the libraries (cocos, myLib) to the project and then link them 
to the app.

Header Search Path : Path to the headers of my library
Other Link Flags : -ObjC -all_Load


Now in my app delegate I have the line

#import IADTravelEngine.h

...

..

IADTEDirector * dir = [IADTEDirector sharedDirector]; 

and I get that IADTravelEngine.h No such a file.


I dunno what I did before to make it work  (Link) and it was working until I 
used the NSClassDFromString then I started modifying things and now it doesnt 
link again. :S

Any help?

Thx

Gustavo




On May 4, 2011, at 7:11 PM, Quincey Morris wrote:

 On May 4, 2011, at 09:12, Gustavo Pizano wrote:
 
 linker problems
 
 Vagueness like this makes it hard to help you. Sometimes the actual error 
 messages are important in deciding where to look for a solution.
 
 What can I do? 
 
 I'd very seriously suggest you don't use a static library at all. It really 
 doesn't provide you with any benefits, so you may as well include the source 
 code directly instead.
 
 The whole point -- well, *a* whole point -- of a static library (in 
 traditional C terms) is to allow you to link just those parts that are 
 referenced by your client application, without having to figure it out for 
 yourself. This doesn't work very well in Objective-C, because the language's 
 dynamism makes it impossible in general to determine what's referenced at 
 link time.
 
 If you have other reasons for library-izing your Objective-C code, a 
 framework is a much better choice, probably.
 
 

___

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

Please do not post 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: NSClassFormString returning nil.

2011-05-04 Thread Gustavo Pizano
I found why the file not found.. I had the header path wrong.. now its ok.. im 
gonna try to see if the NSClassFromString works or what... 



On May 4, 2011, at 7:31 PM, Gustavo Pizano wrote:

 Quincey Hello and thx for the reply
 
 I need to use the a library because its a iOS project so no framework, and 
 also because I will be reusing the code in the lib for many other apps not 
 just this one Im making.. 
 
 So right now I have the following set up:
 
 On my Library Project:
 
 Note: By nothing I mean empty no value
   2 Targets: 
   -myLibrary :  
   Library Search Paths : nothing
   Other Link Flags : nothing
   
   Copy Headers:  As Public : All my Headers. 
   -cocos2d
   cocos2d lib was easily configured I have done it before for 
 other UIKit apps 
 
 I compile this project without problem and it compiles.
 
 Now I created my Final app that will use my library
 
 I made a workspace where I put the project and the project that contains the 
 library, both are there.
   -Added the libraries (cocos, myLib) to the project and then link them 
 to the app.
 
   Header Search Path : Path to the headers of my library
   Other Link Flags : -ObjC -all_Load
 
 
 Now in my app delegate I have the line
 
 #import IADTravelEngine.h
 
 ...
 
 ..
 
 IADTEDirector * dir = [IADTEDirector sharedDirector]; 
 
 and I get that IADTravelEngine.h No such a file.
 
 
 I dunno what I did before to make it work  (Link) and it was working until I 
 used the NSClassDFromString then I started modifying things and now it doesnt 
 link again. :S
 
 Any help?
 
 Thx
 
 Gustavo
 
 
 
 
 On May 4, 2011, at 7:11 PM, Quincey Morris wrote:
 
 On May 4, 2011, at 09:12, Gustavo Pizano wrote:
 
 linker problems
 
 Vagueness like this makes it hard to help you. Sometimes the actual error 
 messages are important in deciding where to look for a solution.
 
 What can I do? 
 
 I'd very seriously suggest you don't use a static library at all. It really 
 doesn't provide you with any benefits, so you may as well include the source 
 code directly instead.
 
 The whole point -- well, *a* whole point -- of a static library (in 
 traditional C terms) is to allow you to link just those parts that are 
 referenced by your client application, without having to figure it out for 
 yourself. This doesn't work very well in Objective-C, because the language's 
 dynamism makes it impossible in general to determine what's referenced at 
 link time.
 
 If you have other reasons for library-izing your Objective-C code, a 
 framework is a much better choice, probably.
 
 
 

___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Bertil Holmberg
You can create it from two rectangular views, perhaps rotating the one, 
depending on your needs.

Regards,
Bertil___

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

Please do not post 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: NSClassFormString returning nil.

2011-05-04 Thread Gustavo Pizano
Hello again, im really wondering if this is the right list, but anyway if you 
don't mind  please dont kill me. :P

If I take out the linker flags it compiles bu the NSClassFromString doesn't work
if I put the flags -ObjC and -all_load the I get this problem:




ld: duplicate symbol _OBJC_IVAR_$_CCAction.originalTarget_ in 
/Users/GustavPicora/Library/Developer/Xcode/DerivedData/AfrikaWS-hbbkzgjulqurwhepbahwnbcsrcun/Build/Products/Debug-iphonesimulator/libcocos2d
 libraries.a(CCAction.o) and 
/Users/GustavPicora/Library/Developer/Xcode/DerivedData/AfrikaWS-hbbkzgjulqurwhepbahwnbcsrcun/Build/Products/Debug-iphonesimulator/libIADTravelEngine.a(CCAction.o)
 for architecture i386
collect2: ld returned 1 exit status
Command 
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 
failed with exit code 1


:S :S...

thx 

G.


On May 4, 2011, at 7:38 PM, Gustavo Pizano wrote:

 I found why the file not found.. I had the header path wrong.. now its ok.. 
 im gonna try to see if the NSClassFromString works or what... 
 
 
 
 On May 4, 2011, at 7:31 PM, Gustavo Pizano wrote:
 
 Quincey Hello and thx for the reply
 
 I need to use the a library because its a iOS project so no framework, and 
 also because I will be reusing the code in the lib for many other apps not 
 just this one Im making.. 
 
 So right now I have the following set up:
 
 On my Library Project:
 
 Note: By nothing I mean empty no value
  2 Targets: 
  -myLibrary :  
  Library Search Paths : nothing
  Other Link Flags : nothing
  
  Copy Headers:  As Public : All my Headers. 
  -cocos2d
  cocos2d lib was easily configured I have done it before for 
 other UIKit apps 
 
 I compile this project without problem and it compiles.
 
 Now I created my Final app that will use my library
 
 I made a workspace where I put the project and the project that contains the 
 library, both are there.
  -Added the libraries (cocos, myLib) to the project and then link them 
 to the app.
 
  Header Search Path : Path to the headers of my library
  Other Link Flags : -ObjC -all_Load
 
 
 Now in my app delegate I have the line
 
 #import IADTravelEngine.h
 
 ...
 
 ..
 
 IADTEDirector * dir = [IADTEDirector sharedDirector]; 
 
 and I get that IADTravelEngine.h No such a file.
 
 
 I dunno what I did before to make it work  (Link) and it was working until I 
 used the NSClassDFromString then I started modifying things and now it 
 doesnt link again. :S
 
 Any help?
 
 Thx
 
 Gustavo
 
 
 
 
 On May 4, 2011, at 7:11 PM, Quincey Morris wrote:
 
 On May 4, 2011, at 09:12, Gustavo Pizano wrote:
 
 linker problems
 
 Vagueness like this makes it hard to help you. Sometimes the actual error 
 messages are important in deciding where to look for a solution.
 
 What can I do? 
 
 I'd very seriously suggest you don't use a static library at all. It really 
 doesn't provide you with any benefits, so you may as well include the 
 source code directly instead.
 
 The whole point -- well, *a* whole point -- of a static library (in 
 traditional C terms) is to allow you to link just those parts that are 
 referenced by your client application, without having to figure it out for 
 yourself. This doesn't work very well in Objective-C, because the 
 language's dynamism makes it impossible in general to determine what's 
 referenced at link time.
 
 If you have other reasons for library-izing your Objective-C code, a 
 framework is a much better choice, probably.
 
 
 
 

___

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

Please do not post 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: NSClassFormString returning nil.

2011-05-04 Thread Quincey Morris
On May 4, 2011, at 10:19, Kyle Sluder wrote:

 Static ObjC libraries are still very useful on iOS, because you can't
 load code dynamically. It's just so much easier and faster to split
 our apps up into seven or eight static libraries rather than our old
 method of compiling all the source into one binary at the same time.
 Since we reuse frameworks on the desktop and on iOS, this is a much
 more natural solution.

iOS? Just a fad. No need to get excited about it.

;)

On May 4, 2011, at 10:31, Gustavo Pizano wrote:

 I need to use the a library because its a iOS project so no framework, and 
 also because I will be reusing the code in the lib for many other apps not 
 just this one Im making.. 


I think you missed my point. You can reuse the *source code* in all the apps, 
simply by dropping it into your Xcode projects much the same way you would 
otherwise drop a static library in.

Kyle makes a good point, though (which I meant to say in my previous post but 
forgot). If there are multiple developers working on multiple projects, it may 
be convenient for housekeeping reasons to package shared code as libraries.

If you're in a less complicated working environment (I note that Kyle says we 
but you say I), then the advantages aren't as clear.


___

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

Please do not post 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


[NSMenu _enableItem} crash

2011-05-04 Thread Tony Cate

Reliably:

Launch project and get first document window.
Close document
Main Menu file open second document.
Close document
Click anywhere on the main menu and the project crashes.

Most of the time the stack ends with:

0 objc_msgSend
1 stub helpers
2 [NSMenu _enableItem]

Occasionally it consists of
0 objc_msgSend
1 ??? (or a reasonable facsimile)

After reading through some threads on this I thought my validation stuff 
may be an issue, so I commented it out. It made no difference. Because 
the crash occurs no matter where on the menu I click, I wondered if I 
was accidentally releasing the mainMenu. I'm not.


Any help with this problem would be greatly appreciated.

Tony



___

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

Please do not post 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: [NSMenu _enableItem} crash

2011-05-04 Thread Martin Wierschin
 Most of the time the stack ends with:
 
 0 objc_msgSend
 1 stub helpers
 2 [NSMenu _enableItem]
 
 Occasionally it consists of
 0 objc_msgSend
 1 ??? (or a reasonable facsimile)
 
 After reading through some threads on this I thought my validation stuff may 
 be an issue

Likely menu validation is the problem- not your validation code itself, but the 
objects responsible. I bet one of your menus/items has a target or delegate 
that has deallocated (something set by the closed document/window). Try running 
your application with NSZombieEnabled=YES to check.

~Martin


___

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

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

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

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


Re: [NSMenu _enableItem} crash

2011-05-04 Thread Fritz Anderson
On 4 May 2011, at 3:36 PM, Tony Cate wrote:

 Most of the time the stack ends with:
 
 0 objc_msgSend
 1 stub helpers
 2 [NSMenu _enableItem]
 
 Occasionally it consists of
 0 objc_msgSend
 1 ??? (or a reasonable facsimile)
 
 After reading through some threads on this I thought my validation stuff may 
 be an issue, so I commented it out. It made no difference. Because the crash 
 occurs no matter where on the menu I click, I wondered if I was accidentally 
 releasing the mainMenu. I'm not.

You're most likely dealing with an already-released object that was expected to 
be alive still. Setting NSZombieEnabled to YES in your executable's environment 
variables will tell you what the problem object is, if that's the case. Or, run 
your application with the Object Allocations instrument in the Instruments 
profiling application, with zombie detection enabled. You can get a history of 
the pointer, which will tell you much more.

For deeper knowledge, see the famous blog post So you crashed in 
objc_msgSend(), 
http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

— F

___

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

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

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

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


how can I copy from another app?

2011-05-04 Thread Jim Thomason
I know this has been asked a bajillion times before, yet here we are.

So it turns out that my simple little applescript to copy in from
another app was ineffective. Lots more digging around led me to create
this:

tell application Xcode
activate
tell application System Events
tell application process Xcode
set frontmost to true
keystroke c using command down
end tell
end tell
display dialog (the clipboard)
set foo to path to frontmost application
display dialog foo
end tell

which is currently hardwired to Xcode and has a couple of dialogs for
debugging purposes. Yes, yes, I know that blissfully assuming that
command-C performs a copy operation is less than ideal. Best option
I've seen so far.

Here's the annoying bit - this works just fine when run from the
Script Editor. But when I run it within my app by firing it off via an
NSAppleScript call, it fails and copies no text. I even tried saving
it as a separate script and invoking it via osascript and had no luck.
Again, that works just fine on the command line calling it directly,
but not from within the app.

I'm utterly stumped. Is there something simple I'm missing? An option
to turn on?

Is there some other approach I should try instead?

-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: how can I copy from another app?

2011-05-04 Thread Shawn Bakhtiar

I have not been on this list that long to have heard this abajillion times

and without knowing what others have said, I can surmise that their replies 
where no less perplexed with the question but Why?

The copy and past function is a user interface object, designed to aid in 
process flow. It is not designed for any kind of IPC (Inter Process 
Communication) that one would want to use (unless your trying to make yourself 
go insane). In any case, if you REALLY want too...

You should write a program that uses the NSPasteboard object, and registers for 
types that you want to process. I bet there is an update signal you can 
callback on, so when anything gets pasted to the server you know about it, and 
from the code bellow it appears like you want to use text, which is a standard 
type.

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSPasteboard_Class/Reference/Reference.html
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PasteboardGuide106/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008099

But if you have asked this here before, I'm sure someone has already told you 
all this?



 Date: Wed, 4 May 2011 16:46:04 -0500
 From: j...@jimandkoka.com
 To: cocoa-dev@lists.apple.com
 Subject: how can I copy from another app?
 
 I know this has been asked a bajillion times before, yet here we are.
 
 So it turns out that my simple little applescript to copy in from
 another app was ineffective. Lots more digging around led me to create
 this:
 
 tell application Xcode
   activate
   tell application System Events
   tell application process Xcode
   set frontmost to true
   keystroke c using command down
   end tell
   end tell
   display dialog (the clipboard)
   set foo to path to frontmost application
   display dialog foo
 end tell
 
 which is currently hardwired to Xcode and has a couple of dialogs for
 debugging purposes. Yes, yes, I know that blissfully assuming that
 command-C performs a copy operation is less than ideal. Best option
 I've seen so far.
 
 Here's the annoying bit - this works just fine when run from the
 Script Editor. But when I run it within my app by firing it off via an
 NSAppleScript call, it fails and copies no text. I even tried saving
 it as a separate script and invoking it via osascript and had no luck.
 Again, that works just fine on the command line calling it directly,
 but not from within the app.
 
 I'm utterly stumped. Is there something simple I'm missing? An option
 to turn on?
 
 Is there some other approach I should try instead?
 
 -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/shashaness%40hotmail.com
 
 This email sent to shashan...@hotmail.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: how can I copy from another app?

2011-05-04 Thread Jim Thomason
 and without knowing what others have said, I can surmise that their replies
 where no less perplexed with the question but Why?

This gloriously ugly hack isn't the correct why question - the
correct why question is why do I even need to do it?

I want to be able to copy the current selection from another app so I
can use it in mine w/o requiring the user to do the copy first
themselves. The standard hacks when slogging through the net about
this are to either use an Apple Script along these lines (some
advocate opening up the Edit Menu then selecting the Copy item, which
is comparably fragile), or packing up and sending in Apple Events to
emulate the keypress. As I understand it, those are fragile for
different reasons.

But other than resorting to hacks like this there is, AFAIK, no way to
get the selected text from any other arbitrary app. If you have a
better solution, I'd love to hear it.

Using the pasteboard isn't the right approach at all, since there's no
data on the pasteboard as of yet. I'd need to get it onto there before
it can be copied off.

And no, before it's suggested, using a service isn't appropriate in
this case for several reasons, mainly that I want to invoke my app
with some input (or no input), and then conditionally provide output.
I'd love to use a service instead, but AFAIK it won't bend to those
constraints.

So back to my original question and issue - this hack works great when
run from Script Editor, but when invoked via NSAppleScript. It will
-sometimes- work if I embed a standalone script into my app and shell
out to it.

Oddly enough, I discovered quite by accident that if I left both in
there (both invoking via NSAppleScript AND shelling out to the
external one), it'll always work. But that's a hack bordering on the
insane.

I assumed that it was somehow a timing issue and that by doing it
twice I was slowing things down enough for it not to trigger, but I
wasn't able to fix it by adding delays into my app anywhere. The two
calls is the only approach I've got functional right now.

-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


update a tableView from a different class

2011-05-04 Thread Martin Batholdy
Hi,


I have a singleton class which manages a tableView.
In the UI everything works fine. I can delete entries, edit entries and the 
table gets updated properly.

Now I have another class which manages the entries of a dropdown menu.
Now when an item of this dropdown menu is getting pressed I want to change 
something in my tableView – so the table should get updated.

So the singleton class that manages my tableview has a method - 
(void)updateView:

- (void)updateView {
[content removeObjectAtIndex:1];
[table reloadData];
[table deselectAll:self];
}


and when the menuitem is pressed the following is invoked (in a different 
class):


prefShow = [Preferences sharedPrefsWindowController]; ( - this is my 
singleton)
[prefShow updateView];




Everything works fine – the updateView method is called and the NSMutableArray 
(content) is also updated properly.
However nothing changes in the table. 
[table reloadData] seems to have no effect.

But why?

It works for other methods that are linked to 
IBOutlets...___

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

Please do not post 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: L-shaped custom view in Cocoa?

2011-05-04 Thread Kyle Sluder
On Wed, May 4, 2011 at 1:09 PM, Shawn Bakhtiar shashan...@hotmail.com wrote:
 Actually you only need one view. Subclass it, and over ride the draw method



 [[NSColor clearColor] set]
 NSFillRect(...) - the size you want to clear out.


Don't do this. It doesn't do what you think it does.

The window only has one backing store bitmap. All normal views are
drawn into this bitmap in order. So filling a rect with clearColor
actually nukes the background of the window. It'll draw as a black
rectangle on your screen.

--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: update a tableView from a different class

2011-05-04 Thread Kyle Sluder
On Wed, May 4, 2011 at 5:52 PM, Martin Batholdy batho...@googlemail.com wrote:
 I have a singleton class which manages a tableView.
 In the UI everything works fine. I can delete entries, edit entries and the 
 table gets updated properly.

How is the table view getting its data. If it's through bindings, I
bet it's because you're not mutating the array in a KVO-compliant 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: how can I copy from another app?

2011-05-04 Thread Graham Cox

On 05/05/2011, at 10:01 AM, Jim Thomason wrote:

 This gloriously ugly hack isn't the correct why question - the
 correct why question is why do I even need to do it?


No, it is the right why question. When something is this hard, then you must 
clearly be fighting the designed architecture of the OS. And  the reason you're 
fighting it is because you have arrived at a use-case it wasn't designed to 
handle, and the reason it wasn't designed to handle it is because the use-case 
is wrongly conceived.

That's why you're being urged to go back to basics and reconsider that, rather 
than provided with a how-to for the case you HAVE proposed.


 I want to be able to copy the current selection from another app so I
 can use it in mine w/o requiring the user to do the copy first
 themselves


So why? If a service can't work (this is the designed-in solution in the 
architecture for what appears to be the use-case you've outlined) then 
certainly the solution you're looking at is wrong-headed at best.


 set frontmost to true
   keystroke c using command down

 Yes, yes, I know that blissfully assuming that
 command-C performs a copy operation is less than ideal. Best option
 I've seen so far.


This makes so many assumptions, it's not funny. Assuming that command-c does 
indeed pertain to the 'Copy' menu item, what does this even achieve? It merely 
sends a 'copy:' action to First Responder (even then that assumes that the 
'Copy' menu item hasn't been wired to a different target and action, which 
would be perfectly legitimate). The chain of response to command-c is assumed 
to be - with question marks where it quite reasonably might not - :

cmd-c - ? - Copy menu item - ? - [First Responder copy:] - ? - ( 
Implemented? Text object? valid selection? usable data type? )- ? - 
[NSPasteboard putData:]

First Responder could be any object whatsoever within your user-interface, and 
it changes over time. There is no general solution for forcing any particular 
object or type of object to be First Responder from outside the app, unless it 
supports explicit scripting to do so. FR could be an object that doesn't 
respond to -copy: (the menu item would be typically greyed out in this case). 
If it does respond to -copy:, the implementation of that method could be 
anything whatsoever. Again, typically, but by no means necessarily, it might 
ultimately respond by placing data on to the general NSPasteboard. But then 
again, it might not - an app is free to implement copy however it pleases 
(though admittedly NOT using NSPasteboard would usually be perverse, but an 
app's definition of what it means to 'Copy' is certainly its own).

The problem is, you need an app to put data onto a pasteboard (which from 
another apps perspective is at least sensible - pasteboards are an 
inter-application communication device), but between invoking the menu command 
'Copy' and putting data on the pasteboard is a potentially vast swamp of 
unknown code to cross with no known outcome. Put another way, you are using a 
View behaviour to trigger a distant Data Model response, with who-knows-what 
result?

The only reliable way to get an app to put data on a pasteboard is to invoke a 
service for which the app has opted in (even then, you can't push a service 
at an app, it has to pull the service into operation). So for the general 
case of any app, that isn't reliable. If an app is willing to share its data to 
the outside world, the best way for it to do that is to be scriptable, and to 
define specific script events to permit that in conjunction with other specific 
script events to determine exactly which object is being targeted. If the app's 
designer didn't build that in, you're stuck. There is no general solution for 
extracting data from an arbitrary app.

You simply cannot do what you are attempting, at least as far as the problem 
has been defined. So, the only fruitful way forward is to redefine the problem, 
or give up and work on something more productive.

--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: update a tableView from a different class

2011-05-04 Thread Martin Batholdy

On 05.05.2011, at 03:06, Kyle Sluder wrote:

 How is the table view getting its data. If it's through bindings, I
 bet it's because you're not mutating the array in a KVO-compliant way.


Well, I dont use an ArrayController or something like this in the interface 
builder.
and I implemented all the tableview methods manually.

So I think I still don't understand the concept of bindings.
Therefore I am not sure ...


___

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

Please do not post 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: update a tableView from a different class

2011-05-04 Thread Graham Cox

On 05/05/2011, at 10:52 AM, Martin Batholdy wrote:

 - (void)updateView {
   [content removeObjectAtIndex:1];
   [table reloadData];
   [table deselectAll:self];
 }
 
 
 and when the menuitem is pressed the following is invoked (in a different 
 class):
 
 
 prefShow = [Preferences sharedPrefsWindowController];   ( - this is my 
 singleton)
 [prefShow updateView];
 
 
 
 
 Everything works fine – the updateView method is called and the 
 NSMutableArray (content) is also updated properly.
 However nothing changes in the table. 
 [table reloadData] seems to have no effect.


Have you checked to see whether removeObjectAtIndex:1 actually succeeds? If the 
index is out of bounds, an exception will be thrown and -reloadData will never 
be reached. You can easily check that in the debugger. It looks suspicious that 
you are hard-coding an index value for an array whose contents are variable.

If you always want to remove the first object, the correct index is 0, but even 
that will fail if the array is empty. If you always want to remove the last 
object, use [NSArray lastObject], which will return nil if the array is empty. 
In general, naming a method -updateView that also removes an object from 
content is setting yourself up for buggy behaviour. Either separate out the 
removal from the update, or else rename the method so it's clear what it 
actually does.

--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: update a tableView from a different class

2011-05-04 Thread Martin Batholdy

On 05.05.2011, at 03:35, Graham Cox wrote:

 Have you checked to see whether removeObjectAtIndex:1 actually succeeds? If 
 the index is out of bounds, an exception will be thrown and -reloadData will 
 never be reached. You can easily check that in the debugger. It looks 
 suspicious that you are hard-coding an index value for an array whose 
 contents are variable.
 
 If you always want to remove the first object, the correct index is 0, but 
 even that will fail if the array is empty. If you always want to remove the 
 last object, use [NSArray lastObject], which will return nil if the array is 
 empty. In general, naming a method -updateView that also removes an object 
 from content is setting yourself up for buggy behaviour. Either separate 
 out the removal from the update, or else rename the method so it's clear what 
 it actually does.
 
 —Graham
 


Yes, I checked this with an NSLog statement. 
The 1 is also only for testing purpose and the array has always more than two 
entries.

So [table reloadData]; gets executed but has no effect ... 


___

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

Please do not post 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: update a tableView from a different class

2011-05-04 Thread Graham Cox

On 05/05/2011, at 11:40 AM, Martin Batholdy wrote:

 So [table reloadData]; gets executed but has no effect ... 


Well, it definitely does have an effect, just not the one that you are assuming.

Show the code for your data source. How does the table get its data from 
content? Set a breakpoint in -tableView:objectValueForTableColumn:row: and 
check it gets called after -reloadData has been called (it might be deferred 
until the next event cycle - I forget whether that's the case or whether the 
reload is synchronous with -reloadData).

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