Re: why NSTrackingArea doesn't work?

2011-06-23 Thread Nick
Thanks a lot, It worked! :-)

I was creating a custom window, and wanted to make the close/minimize/zoom
buttons to behave naturally.
The only thing that isn't working in my custom window - is the
click-through on the [NSWindow standardWindowButton] button (I am using a
fake titlebar).
Whenever the window is not main/key and I click on the button, I get to
click twice -first to activate the window (make it main), second to actually
click on the, for example, close button.
Other ordinary cocoa buttons (NSPushButton) placed on this view allow
clicking on them directly when the view is not active.

These close/minimize/zoom buttons are placed on a view, that returns YES
in a -(BOOL)acceptsFirstMouse:(NSEvent *)theEvent
method.
Well this is ignored, and for some weird reason, by default, the  views,
returned by  [NSWindow standardWindowButton], return NO for
acceptsFirstMouse (since i need to click twice). And I can't even sublass
them to change what's happening.

Maybe you can suggest something? Should I build the buttons from scratch,
drawing all the icons by myself to make it behave real?
Thank you

2011/6/23 Ken Thomases k...@codeweavers.com

 On Jun 22, 2011, at 7:41 PM, Conrad Shultz wrote:

  On 6/22/11 5:04 PM, Nick wrote:
   NSTrackingArea* trackingArea = [[NSTrackingArea alloc]
 initWithRect:[self
  frame] options: (NSTrackingMouseEnteredAndExited |
 NSTrackingActiveAlways)
  owner:self userInfo:nil];
 
  Don't use [self frame]... that is in the superview's coordinate system,
  not the tracking area's view's coordinate space (which is expected).
 
  Use [self bounds] instead; depending on the absolute position of your
  view this might make a HUGE difference.

 I strongly recommend considering use of NSTrackingInVisibleRect, too.  If
 your view changes windows or moves within its window, this will make things
 a lot simpler.  It can be the wrong thing in rare cases, but I'd be
 surprised if you need one of those.

 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


Dragging from an NSBrowser to an NSTableView

2011-06-23 Thread Sandeep Mohan Bhandarkar
Hi All,

within my application i have a screen where exists and NSBrowser as well as an 
NSTableViews. can someone please let me know we can implement dragging items 
from the browser to the table view.
any source reference on this would be very helpful.

Thanks in Advance,
Sandeep.




___

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

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


Animating handwriting

2011-06-23 Thread Gustavo Adolfo Pizano
Hello all.

Im wondering if animating handwriting  is somehow possible to do, I
have been looking but I find only how to do it in flash.

Can somebody give me some headlights in the right direction so I can
start digging into?

Thanks a lot.

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: tooltips not firing on first try

2011-06-23 Thread Rick C.
I'll try to play with this a bit more using your suggestions.  My issue is I 
click a button and a panel with the tableview launches, and if my mouse if over 
where that tableview launches the tooltips will not show.  Even if I scroll 
around to different areas of the tableview the tooltip will not show.  If I 
exit my mouse from the tableview and go back then it seems to work.  Definitely 
if I make another app active (Finder for example) and then go back to my 
tableview it works...


On Jun 23, 2011, at 7:28 AM, Lee Ann Rucker wrote:

 
 On Jun 22, 2011, at 4:00 PM, Corbin Dunn wrote:
 
 
 On Jun 22, 2011, at 2:15 AM, Lee Ann Rucker wrote:
 
 Possibly Radar 5847161 - Tooltip on NSTableView does not appear on newly 
 selected cell
 
 Summary: 
 If an NSTableView has a delegate that implements 
 tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:, tooltips will 
 not appear when a cell is selected and the mouse is not moved.
 
 Apple's response:
 NSTableView doesn't know it should update anything, since the mouse has not 
 moved outside of the area it was tracking. 
 Calling updateTrackingAreas should solve the problem.
 
 Yeah, that was from me. When did you call -updateTrackingAreas? It should 
 work to reset tracking areas, but also -resetCursorRects might work too.
 
 The problem is that there is no way for the table to know that you are 
 returning a different value if you don't move out of the cell frame and back 
 in; it is only called after we get a new tracking area entered message.
 
 My reply 3 years ago was
 ---
 14-Apr-2008 02:13 PM Lee Ann Rucker:
 Not on Tiger, no, as it's a Leopard API, and when should it be called? ... I 
 did try putting it in my tableViewSelectionDidChange: method but it had no 
 effect.
 ---
 
 Never got anything back from that, and that NSTableView has long since been 
 replaced by an NSCollectionView (and I don't care about Tiger anymore 
 either). The table views we are using don't have tooltips.

___

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

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

2011-06-23 Thread Ken Tozier
If you're writing with the mouse the following might help. It isn't done, 
still needs some sort of check in the drawRect method to know when you've drawn 
all the segments and you;ll need to adjust x/y values to the view you're 
drawing in, but it will get you started.

- (void) mouseDown:(NSEvent *) inEvent
{
// allocate a mutable data to store event points and times
dragPoints  = [[NSMutableData alloc] init];

// save fetch time and location of click and store in dragPoints
NSTimeInterval  timestamp   = [inEvent timestamp];
NSPoint clickPoint  = [inEvent locationInWindow];

[dragPoints appendBytes: timestamp length: sizeof(NSTimeInterval)];
[dragPoints appendBytes: dragPoint length: sizeof(NSPoint)];
}

- (void) mouseDragged:(NSEvent *) inEvent
{
NSTimeInterval  timestamp   = [inEvent timestamp];
NSPoint dragPoint   = [inEvent locationInWindow];

// write interval and point to dragPoints mutable data object
[dragPoints appendBytes: timestamp length: sizeof(NSTimeInterval)];
[dragPoints appendBytes: dragPoint length: sizeof(NSPoint)];
}

- (void) mouseUp:(NSEvent *) inEvent
{
// save the recording, either in memory or to a file
[dragPoints writeToFile: @/path/to/some/file.bin];

[dragPoints release];
}


// In your draw method, you could fetch a timestamp/NSPoint pair from the 
recording like so

- (void) drawRect:(NSRect) inRect
{
CGContextRefcontext = [[NSGraphicsContext 
currentContext] graphicsPort];

// some instance variable indicating where you are in the recording
int frameOffset = 
currentIncrement * (sizeof(NSTimeInterval) + sizeof(NSPoint));
NSTimeInterval  time= 
*(NSTimeInterval*)[dragPoints bytes] + frameOffset;
NSPoint point   = 
*(NSPoint*)[dragPoints bytes] + frameOffset + sizeof(NSTimeInterval);

// draw line
CGContextAddLineToPoint(context, point.x, point.y);

// create a new NSTimer with the delay from time variable
[NSTimer scheduledTimerWithTimeInterval: time 
target: self 
selector: @selector(dearRect:) 
userInfo: nil 
repeats: NO];

// increment placeholder
currentIncrement++;
}

On Jun 23, 2011, at 5:21 AM, Gustavo Adolfo Pizano wrote:

 Hello all.
 
 Im wondering if animating handwriting  is somehow possible to do, I
 have been looking but I find only how to do it in flash.
 
 Can somebody give me some headlights in the right direction so I can
 start digging into?
 
 Thanks a lot.
 
 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/kentozier%40comcast.net
 
 This email sent to kentoz...@comcast.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: Dragging from an NSBrowser to an NSTableView

2011-06-23 Thread Mike Abdullah
Look at the datasource API for each view. They both have methods for writing 
and reading to/from the pasteboard.

On 23 Jun 2011, at 09:38, Sandeep Mohan Bhandarkar wrote:

 Hi All,
 
 within my application i have a screen where exists and NSBrowser as well as 
 an NSTableViews. can someone please let me know we can implement dragging 
 items from the browser to the table view.
 any source reference on this would be very helpful.
 
 Thanks in Advance,
 Sandeep.
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


UIScrollView zooming a rotated view

2011-06-23 Thread Brian Bruinewoud
Hi All,

I have a UIScrollView that contains a single UIView.
I have a couple of buttons in the toolbar that let me rotate the UIView in 90 
degree increments.

When the rotation is 0, zooming via the pinch mechanism works fine.
When the rotation is 90 or 270, zooming via pinch does nothing.
When the rotation is 180, zooming via the pinch works 'backwards', that is, 
what should expand the image, shrinks it and vice versa.

I've logged the values of the UIView's transform and I guess the issue is that 
UIScrollView directly manipulates A and D in this matrix.

For rotation = 0, A and B are both 1.
For rotation = 90 or 270, A and B are both 0 - hence nothing changes as 0 * x = 
0.
For rotation = 180, A and B are both -1. Not sure how this results in 
'backwards' pinches, though.

Is there something I need to do to get the ScrollView to work? Or is it a bug?

I thought I have seen apps where you can zoom and rotate with a single gesture- 
where those views hand coded?

Thanks,
Brian.___

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

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

2011-06-23 Thread Gustavo Adolfo Pizano
Helo Ken.

Thanks for answer,
I meant, I have some title string already, and I wish to be able to
animate as if its being written at the moment, also I forgot to
mention that this is for iOS.

Once again thanks for the reply.

I will still check your code and see how maybe I can apply what I
need. Maybe, and for sure I need to get the points of the path to be
done first somehow and then animate the creating of the path.

i dunno.


G.


On Thu, Jun 23, 2011 at 12:34 PM, Ken Tozier kentoz...@comcast.net wrote:
 If you're writing with the mouse the following might help. It isn't done, 
 still needs some sort of check in the drawRect method to know when you've 
 drawn all the segments and you;ll need to adjust x/y values to the view 
 you're drawing in, but it will get you started.

 - (void) mouseDown:(NSEvent *) inEvent
 {
        // allocate a mutable data to store event points and times
        dragPoints              = [[NSMutableData alloc] init];

        // save fetch time and location of click and store in dragPoints
        NSTimeInterval  timestamp       = [inEvent timestamp];
        NSPoint                 clickPoint      = [inEvent locationInWindow];

        [dragPoints appendBytes: timestamp length: sizeof(NSTimeInterval)];
        [dragPoints appendBytes: dragPoint length: sizeof(NSPoint)];
 }

 - (void) mouseDragged:(NSEvent *) inEvent
 {
        NSTimeInterval  timestamp       = [inEvent timestamp];
        NSPoint                 dragPoint       = [inEvent locationInWindow];

        // write interval and point to dragPoints mutable data object
        [dragPoints appendBytes: timestamp length: sizeof(NSTimeInterval)];
        [dragPoints appendBytes: dragPoint length: sizeof(NSPoint)];
 }

 - (void) mouseUp:(NSEvent *) inEvent
 {
        // save the recording, either in memory or to a file
        [dragPoints writeToFile: @/path/to/some/file.bin];

        [dragPoints release];
 }


 // In your draw method, you could fetch a timestamp/NSPoint pair from the 
 recording like so

 - (void) drawRect:(NSRect) inRect
 {
        CGContextRef            context                 = [[NSGraphicsContext 
 currentContext] graphicsPort];

        // some instance variable indicating where you are in the recording
        int                                     frameOffset             = 
 currentIncrement * (sizeof(NSTimeInterval) + sizeof(NSPoint));
        NSTimeInterval          time                            = 
 *(NSTimeInterval*)[dragPoints bytes] + frameOffset;
        NSPoint                         point                   = 
 *(NSPoint*)[dragPoints bytes] + frameOffset + sizeof(NSTimeInterval);

        // draw line
        CGContextAddLineToPoint(context, point.x, point.y);

        // create a new NSTimer with the delay from time variable
        [NSTimer scheduledTimerWithTimeInterval: time
                        target: self
                        selector: @selector(dearRect:)
                        userInfo: nil
                        repeats: NO];

        // increment placeholder
        currentIncrement++;
 }

 On Jun 23, 2011, at 5:21 AM, Gustavo Adolfo Pizano wrote:

 Hello all.

 Im wondering if animating handwriting  is somehow possible to do, I
 have been looking but I find only how to do it in flash.

 Can somebody give me some headlights in the right direction so I can
 start digging into?

 Thanks a lot.

 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/kentozier%40comcast.net

 This email sent to kentoz...@comcast.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/gustavxcodepicora%40gmail.com

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


about tiling images.

2011-06-23 Thread Gustavo Adolfo Pizano
Hello all.

I have been checking 2010 video about using UIScrollView with images,
zooming etc. Thye use CATiledLayer and doing some calculations they
now what tile to load depending on the scale, so the performance its
quite good and memory usage its as low as possible.

Now Im wondering,  if I have my app which has a lot of images to
display, kinda on the same way the example does,  do I have to cut
each image in its respective tiles @ their respective scale?, or
If so then whats the best approach to do this?


Best Regards

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


Using NSScrollView to scroll Infinitely

2011-06-23 Thread bmaclist
I'm running into a problem in 32bit builds with NSScrollView scrolling past the 
24 bits of CGFloat (float in 32bit, double in 64bit builds).

Is there any way to specify a 'Screen Sized' (ie. float range) documentView and 
an int64 offset (or something similar), so that my drawing of the 
documentVisibleRect is always using valid coordinates?

...or am I missing something really basic 
here?___

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

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


Menu item enabling

2011-06-23 Thread Daniel Luis dos Santos
Hello,

I have a submenu of the File menu that gets loaded with menu items on 
awakeFromNib().
Problem is that the method that does the menu item enabling is not being called 
on the submenu's items and so they are not enabled.

I implemented the validateUserInterfaceItem() method in a class and have set 
the target of the created menu items to that class.
It gets called for every menu item except the one with the submenu. If I expand 
the submenu it doesn't get called.
What am I missing ?

Regards
Daniel

___

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

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

2011-06-23 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 6/23/11 6:50 AM, Gustavo Adolfo Pizano wrote:
 Helo Ken.
 
 Thanks for answer,
 I meant, I have some title string already, and I wish to be able to
 animate as if its being written at the moment, also I forgot to
 mention that this is for iOS.

Sorry, do you mean that you have an NSString and a handwriting font,
and you wish to animate the rendering of the string in that font?

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOA2r9aOlrz5+0JdURAj75AJ9caJFWiklpYPCugSc0DkSyn5/ReACggouj
F8Ua3YVVIWpGvZ1EDK159FA=
=TmNr
-END PGP 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: Animating handwriting

2011-06-23 Thread Gustavo Pizano
Hello.

Yes kinda.

G.
On Jun 23, 2011, at 6:34 PM, Conrad Shultz wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 6/23/11 6:50 AM, Gustavo Adolfo Pizano wrote:
 Helo Ken.
 
 Thanks for answer,
 I meant, I have some title string already, and I wish to be able to
 animate as if its being written at the moment, also I forgot to
 mention that this is for iOS.
 
 Sorry, do you mean that you have an NSString and a handwriting font,
 and you wish to animate the rendering of the string in that font?
 
 - -- 
 Conrad Shultz
 
 Synthetiq Solutions
 www.synthetiqsolutions.com
 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.7 (Darwin)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iD8DBQFOA2r9aOlrz5+0JdURAj75AJ9caJFWiklpYPCugSc0DkSyn5/ReACggouj
 F8Ua3YVVIWpGvZ1EDK159FA=
 =TmNr
 -END PGP 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: Animating handwriting

2011-06-23 Thread Steve Christensen
Is this a correct interpretation of what you're trying to do? You have a title 
string that will be drawn in a handwriting font. You wish to reveal each of the 
letter strokes over time as if someone were actually writing the title on a 
piece of paper.


On Jun 23, 2011, at 9:45 AM, Gustavo Pizano wrote:

 Hello.
 
 Yes kinda.
 
 G.
 On Jun 23, 2011, at 6:34 PM, Conrad Shultz wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 6/23/11 6:50 AM, Gustavo Adolfo Pizano wrote:
 Helo Ken.
 
 Thanks for answer,
 I meant, I have some title string already, and I wish to be able to
 animate as if its being written at the moment, also I forgot to
 mention that this is for iOS.
 
 Sorry, do you mean that you have an NSString and a handwriting font,
 and you wish to animate the rendering of the string in that font?
 
 - -- 
 Conrad Shultz
 
 Synthetiq Solutions
 www.synthetiqsolutions.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: Animating handwriting

2011-06-23 Thread Gustavo Pizano
YES.

:D

On Jun 23, 2011, at 7:10 PM, Steve Christensen wrote:

 Is this a correct interpretation of what you're trying to do? You have a 
 title string that will be drawn in a handwriting font. You wish to reveal 
 each of the letter strokes over time as if someone were actually writing the 
 title on a piece of paper.
 
 
 On Jun 23, 2011, at 9:45 AM, Gustavo Pizano wrote:
 
 Hello.
 
 Yes kinda.
 
 G.
 On Jun 23, 2011, at 6:34 PM, Conrad Shultz wrote:
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 6/23/11 6:50 AM, Gustavo Adolfo Pizano wrote:
 Helo Ken.
 
 Thanks for answer,
 I meant, I have some title string already, and I wish to be able to
 animate as if its being written at the moment, also I forgot to
 mention that this is for iOS.
 
 Sorry, do you mean that you have an NSString and a handwriting font,
 and you wish to animate the rendering of the string in that font?
 
 - -- 
 Conrad Shultz
 
 Synthetiq Solutions
 www.synthetiqsolutions.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: about tiling images.

2011-06-23 Thread Matt Neuburg


 Message: 6
 Date: Thu, 23 Jun 2011 16:18:25 +0200
 From: Gustavo Adolfo Pizano gustavxcodepic...@gmail.com
 Subject: about tiling images.

 I have been checking 2010 video about using UIScrollView with images,
 zooming etc. Thye use CATiledLayer and doing some calculations they
 now what tile to load depending on the scale, so the performance its
 quite good and memory usage its as low as possible.
 
 Now Im wondering,  if I have my app which has a lot of images to
 display, kinda on the same way the example does,  do I have to cut
 each image in its respective tiles @ their respective scale?, or

Yes, that's pretty much the point of the example, isn't it?

Think of it this way: what they're saying is, these images are so big you can't 
even load one on the device. So if you can't load it it on the device, you 
can't load it and cut it up into rectangles on the device. So it follows as the 
night the day that you have to cut it up into rectangles beforehand on your 
computer.

Take a look at Apple's PhotoScroller example.

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/archive%40mail-archive.com

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


Re: Menu item enabling

2011-06-23 Thread Nick Zitzmann

On Jun 23, 2011, at 10:17 AM, Daniel Luis dos Santos wrote:

 Hello,
 
 I have a submenu of the File menu that gets loaded with menu items on 
 awakeFromNib().
 Problem is that the method that does the menu item enabling is not being 
 called on the submenu's items and so they are not enabled.
 
 I implemented the validateUserInterfaceItem() method in a class and have set 
 the target of the created menu items to that class.
 It gets called for every menu item except the one with the submenu. If I 
 expand the submenu it doesn't get called.
 What am I missing ?

That message will be sent to the menu item's target if it implements 
-validateMenuItem: or -validateUserInterfaceItem: (to be pedantic, they are 
methods and not functions). Are you sure the target  action of the menu items 
are being set correctly? If the action wasn't set, then they won't be enabled. 
If the target wasn't set, and nothing in the responder chain implements the 
action, then they won't be enabled. If the target  action were set, then they 
should be enabled by default, but maybe the target implemented one of those 
methods and returned NO, which would explain why they're off.

Also, did you ensure -autoenablesItems is turned on in the submenu? It should 
be by default...

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: Cocoa-dev Digest, Vol 8, Issue 462

2011-06-23 Thread Ken Victor
ken,
thanx for your responses. i had already discovered and tried 
addLocalMonitorForEventsMatchingMask:handler: and as you point out in your 
second reply, it does not work because live resizing is running its own event 
loop.

overriding sendEvent would work if i detect a mouse down in the resize “box” 
and run my own event loop but:
a) i’m not aware of a documented size for the resize “box”; and
b) this would involve my re-implementing all the notifications and 
method calls associated with live resize drawing, and i don’t really want to 
have to do this.

so… anyone have any other ideas as to how to get called for a modifier key 
change will in the midst of a live resize?

thanx,
ken


On Jun 23, 2011, at 2:24 AM, Ken Tozier kentoz...@comcast.net wrote:

 Date: Wed, 22 Jun 2011 17:48:20 -0400
 From: Ken Tozier kentoz...@comcast.net
 Subject: Re: constrained window resizing
 To: Cocoa Dev List List cocoa-dev@lists.apple.com
 Message-ID: 93f00017-e4df-4638-9b44-ca558d1ad...@comcast.net
 Content-Type: text/plain; charset=windows-1252
 
 In NSEvent docs, there's a section on Monitoring Application Events 
 (http://tinyurl.com/6enhj2g) and it looks like there is a flag you can set 
 (explained here: http://tinyurl.com/6jky52c) to receive notifications for 
 this sort of thing
 
 
 On Jun 22, 2011, at 5:21 PM, Ken Victor wrote:
 
 i‚ve got a subclass of NSWindow (MagneticWindow) that provides:
  - (NSSize) windowWillResize: (NSWindow*) sender toSize: (NSSize) 
 frameSize;
 i use this to provide constrained live resizing of the window, i.e., if the 
 shift key is down, the window will only resize in the horizontal or vertical 
 direction (based on the mouse‚s position relative to where it was at mouse 
 down time), and if the shift and control keys are both down, then the window 
 will maintain its aspect ratio as it is resized.
 
 this is all working fine except for one minor point: i don‚t get called if 
 any of the keys change their state (e.g., when the shift is let up) until 
 the user moves the mouse. since the framework is running its own runloop for 
 resizing, i don‚t see how to „hook in‰. and while this class has overridden 
 sendEvent to provide its own runloop for dragging windows around (to provide 
 similar constraining), i don‚t really want to have to do this for resizing 
 as i‚m not sure of all the methods i would have to call to get live resizing 
 drawing working properly.
 
 can anyone suggest a way i can get informed when any of the modifier keys 
 change their state while in the midst of live resizing (without requiring 
 mouse movement)?
 
 thanx,
 ken
 

and

 Date: Wed, 22 Jun 2011 17:15:38 -0500
 From: Ken Thomases k...@codeweavers.com
 Subject: Re: constrained window resizing
 To: Ken Tozier kentoz...@comcast.net
 Cc: Cocoa Dev List List cocoa-dev@lists.apple.com
 Message-ID: de6da287-f4cd-45d6-a743-a31f8e58b...@codeweavers.com
 Content-Type: text/plain; charset=us-ascii
 
 On Jun 22, 2011, at 4:48 PM, Ken Tozier wrote:
 
 In NSEvent docs, there's a section on Monitoring Application Events 
 (http://tinyurl.com/6enhj2g) and it looks like there is a flag you can set 
 (explained here: http://tinyurl.com/6jky52c) to receive notifications for 
 this sort of thing
 
 I don't think that will work because (from your first link):
 
 Your handler will not be called for events that are consumed by nested 
 event-tracking loops such as control tracking, menu tracking, or window 
 dragging; only events that are dispatched through the applications 
 sendEvent: method will be passed to your handler.
 
 Window resizing is just such a nested event-tracking loop.  (Which is also 
 why the OP's thought of using -sendEvent: wouldn't help either.)
 
 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


tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Sandeep Mohan Bhandarkar
Hi All,

Any reasons why this method will not get called. Please find below the list of 
steps that i have taken

1) Connected the dataSource outlet of the Table View to my files owner.
2) Registered the dragTypes for the Table View
3) Did the delegate bindings for the Table
4) Implemented numberOfRowsInTableView: (this is getting called);

Have i missed anything else...??


Thanks and Regards,
Sandeep.

___

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

Please do not post 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: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Jens Alfke

On Jun 23, 2011, at 2:23 PM, Sandeep Mohan Bhandarkar wrote:

 3) Did the delegate bindings for the Table

Do you mean that you set up Cocoa bindings? Generally if you use bindings to 
the table columns, those are used instead of the data source. You wouldn’t want 
to do both. (Or do you just mean that you wired up the delegate outlet?)

 4) Implemented numberOfRowsInTableView: (this is getting called);

Does it return a number greater than zero? If not, there will be no rows.

—Jens

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: constrained window resizing

2011-06-23 Thread Ken Thomases
Hi Ken,

On Jun 23, 2011, at 4:12 PM, Ken Victor wrote:

 so… anyone have any other ideas as to how to get called for a modifier key 
 change will in the midst of a live resize?

I'm a bit confused as to why this would be helpful?  Why is 
-windowWillResize:toSize: too late for your needs?  Your original message said 
everything was working except you couldn't get the modifier changes, but you 
didn't explain why that prevents you from doing what you want.

That said, you may be able to override 
-nextEventMatchingMask:untilDate:inMode:dequeue:.  Call super, examine the 
event that was returned to see if it is NSFlagsChanged, and then return it.  
That is, your override would not reimplement or otherwise interfere with 
-nextEvent..., it would just monitor what it's returning.

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: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Greg Guerin

Sandeep Mohan Bhandarkar wrote:


Have i missed anything else...??


All the protocol's methods are declared @optional.  That means the  
compiler won't check whether you've spelled your implementation's  
method-name correctly.  I have seen more than one case where it was  
misspelled, despite an absolute certainty it was correct.


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


Re: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Sandeep Mohan Bhandarkar
Hi Jens,

I have just wired up the delegate outlet and for the second query. The count 
shows up as zero but will this be the reason for the method not getting 
called...?

Regards,
Sandeep.

On Jun 23, 2011, at 2:34 PM, Jens Alfke wrote:

 
 On Jun 23, 2011, at 2:23 PM, Sandeep Mohan Bhandarkar wrote:
 
 3) Did the delegate bindings for the Table
 
 Do you mean that you set up Cocoa bindings? Generally if you use bindings to 
 the table columns, those are used instead of the data source. You wouldn’t 
 want to do both. (Or do you just mean that you wired up the delegate outlet?)
 
 4) Implemented numberOfRowsInTableView: (this is getting called);
 
 Does it return a number greater than zero? If not, there will be no rows.
 
 —Jens

___

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

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

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

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


Re: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Jens Alfke

On Jun 23, 2011, at 2:46 PM, Sandeep Mohan Bhandarkar wrote:

 I have just wired up the delegate outlet and for the second query. The count 
 shows up as zero but will this be the reason for the method not getting 
 called…?

Yes. If there aren’t any rows, the table view won’t need to ask for what 
objects to put in them.

—Jens

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: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Sandeep Mohan Bhandarkar
Yeah. checked it out by hardcoding a value of 2 in the rows returned now the 
method seems to be getting called. Thank you for your assistance jens.

Regards,
Sandeep.
On Jun 23, 2011, at 2:49 PM, Jens Alfke wrote:

 
 On Jun 23, 2011, at 2:46 PM, Sandeep Mohan Bhandarkar wrote:
 
 I have just wired up the delegate outlet and for the second query. The count 
 shows up as zero but will this be the reason for the method not getting 
 called…?
 
 Yes. If there aren’t any rows, the table view won’t need to ask for what 
 objects to put in them.
 
 —Jens

___

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

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

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

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


Re: constrained window resizing

2011-06-23 Thread Ken Victor

On Jun 23, 2011, at 2:40 PM, Ken Thomases wrote:

 Hi Ken,
 
 On Jun 23, 2011, at 4:12 PM, Ken Victor wrote:
 
 so… anyone have any other ideas as to how to get called for a modifier key 
 change will in the midst of a live resize?
 
 I'm a bit confused as to why this would be helpful?  Why is 
 -windowWillResize:toSize: too late for your needs?  Your original message 
 said everything was working except you couldn't get the modifier changes, but 
 you didn't explain why that prevents you from doing what you want.


lets say the user had been resizing the window without any modifier keys 
pressed, but then realized what s/he really wanted was to resize in only one 
dimension or to maintain the window’s aspect ratio, so now s/he presses either 
shift or shift and control. i would like to be able to resize the window at 
this time to show the proper effect, but i can’t do this until the user moves 
the mouse AFTER changing the modifier keys.

 
 That said, you may be able to override 
 -nextEventMatchingMask:untilDate:inMode:dequeue:.  Call super, examine the 
 event that was returned to see if it is NSFlagsChanged, and then return it.  
 That is, your override would not reimplement or otherwise interfere with 
 -nextEvent..., it would just monitor what it's returning.

two immediate comments though:
in the override you suggest, i will have to “or” in the 
NSFlagsChangedMask to make sure i get the changes as the framework’s event loop 
may (i don’t know) be only looking for mouse down or mouse moved events. and 
the framework may be using -nextEventMatchingMask: instead of 
-nextEventMatchingMask:untilDate:inMode:dequeue:

i will experiment and report back.

thanx for the suggestion,
ken

 
 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: constrained window resizing

2011-06-23 Thread Quincey Morris
On Jun 23, 2011, at 14:55, Ken Victor wrote:

 lets say the user had been resizing the window without any modifier keys 
 pressed, but then realized what s/he really wanted was to resize in only one 
 dimension or to maintain the window’s aspect ratio, so now s/he presses 
 either shift or shift and control. i would like to be able to resize the 
 window at this time to show the proper effect, but i can’t do this until the 
 user moves the mouse AFTER changing the modifier keys.

Don't overlook the possibility of a low tech solution. How about starting a 
repeating timer with an interval of (say) 0.1 secs, and checking the flags when 
the time fires? You'd probably want to debounce the timer by preventing it 
from triggering another resize when resizing is already in progress, and 
possibly for a short time afterwards.


___

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

Please do not post 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: Dragging from an NSBrowser to an NSTableView

2011-06-23 Thread Sandeep Mohan Bhandarkar
HI Mike,


we have implemented the following delegate methods in our class for the Table 
view and the respective counter parts for NSBrowser have also been added. I 
tested by placing break points on these two methods but still was not able to 
see them getting hit when the drag and drop was performed.

- (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id 
NSDraggingInfo)info proposedRow:(int)row 
proposedDropOperation:(NSTableViewDropOperation)op
{

}

- (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id NSDraggingInfo)info 
row:(int)dropRow dropOperation:(NSTableViewDropOperation)op
{

}

PS: The dragTypes for both the browser as well as NSTableView have been set to 
NSStringPasteboardType

Please let me know if we are missing something. As of now it would be great if 
the control would just flow into these methods.


Thanks in Advance
Sandeep.

On Jun 23, 2011, at 4:03 AM, Mike Abdullah wrote:

 Look at the datasource API for each view. They both have methods for writing 
 and reading to/from the pasteboard.
 
 On 23 Jun 2011, at 09:38, Sandeep Mohan Bhandarkar wrote:
 
 Hi All,
 
 within my application i have a screen where exists and NSBrowser as well as 
 an NSTableViews. can someone please let me know we can implement dragging 
 items from the browser to the table view.
 any source reference on this would be very helpful.
 
 Thanks in Advance,
 Sandeep.
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post 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/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net
 

___

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

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

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

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


Re: constrained window resizing

2011-06-23 Thread Ken Victor
empirically, it appears that the event tracking loop for window resizing is 
calling 
-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
so i can’t simply override NSWindow’s matching method in my subclass. thus, 
while overriding NSApplication’s method is probably doable, i believe it would 
be “messier” than quincey’s low tech solution, which can be encapsulated in 
my subclass. i will now give this a try and report back.

thanx quincey,
ken


On Jun 23, 2011, at 3:21 PM, Quincey Morris wrote:

 On Jun 23, 2011, at 14:55, Ken Victor wrote:
 
 lets say the user had been resizing the window without any modifier keys 
 pressed, but then realized what s/he really wanted was to resize in only one 
 dimension or to maintain the window’s aspect ratio, so now s/he presses 
 either shift or shift and control. i would like to be able to resize the 
 window at this time to show the proper effect, but i can’t do this until the 
 user moves the mouse AFTER changing the modifier keys.
 
 Don't overlook the possibility of a low tech solution. How about starting a 
 repeating timer with an interval of (say) 0.1 secs, and checking the flags 
 when the time fires? You'd probably want to debounce the timer by 
 preventing it from triggering another resize when resizing is already in 
 progress, and possibly for a short time afterwards.
 
 

___

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

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


Add KVO for observing center property from a UIImageView

2011-06-23 Thread Tales Pinheiro de Andrade
Hi again.

I have a custom view (say ECGlassView), subclass from UIImageView, and this 
view has a subview (say ECNeedleView) that is subclass from UIImageView.

I'm trying to add viewA as observer for viewB center, as I can move viewB above 
viewA. When I try to tho this:


[self.needle addObserver:self forKeyPath:@needle.center 
options:NSKeyValueObservingOptionNew context:@needleCenter];

the program abort, with the message:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 
'[ECNeedleView 0x8b1cf30 addObserver:ECGlassView 0x8b1bac0 
forKeyPath:@needle.center options:0x1 context:0x21eec] was sent to an object 
that is not KVC-compliant for the needle property.'

In ECGlassView.h I have:

@interface ECGlassView : UIImageView {
ECNeedleView *needle;
}
@property (nonatomic, assign) ECNeedleView *needle;
@end

And have synthesized needle property in ECGlassView.m file.

Even if I try to declare center property in ECNeedleView.h and synthesize it, 
it doesn't work.

What I'm doing wrong?

___

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

Please do not post 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: Add KVO for observing center property from a UIImageView

2011-06-23 Thread Nick Zitzmann

On Jun 23, 2011, at 5:27 PM, Tales Pinheiro de Andrade wrote:

 Hi again.
 
 I have a custom view (say ECGlassView), subclass from UIImageView, and this 
 view has a subview (say ECNeedleView) that is subclass from UIImageView.
 
 I'm trying to add viewA as observer for viewB center, as I can move viewB 
 above viewA. When I try to tho this:
 
 
 [self.needle addObserver:self forKeyPath:@needle.center 
 options:NSKeyValueObservingOptionNew context:@needleCenter];
 
 the program abort, with the message:
 
 *** Terminating app due to uncaught exception 'NSUnknownKeyException', 
 reason: '[ECNeedleView 0x8b1cf30 addObserver:ECGlassView 0x8b1bac0 
 forKeyPath:@needle.center options:0x1 context:0x21eec] was sent to an 
 object that is not KVC-compliant for the needle property.'
 
 In ECGlassView.h I have:
 
 @interface ECGlassView : UIImageView {
ECNeedleView *needle;
 }
 @property (nonatomic, assign) ECNeedleView *needle;
 @end
 
 And have synthesized needle property in ECGlassView.m file.
 
 Even if I try to declare center property in ECNeedleView.h and synthesize it, 
 it doesn't work.
 
 What I'm doing wrong?

The program is attempting to make the object's needle value observe the key 
path needle.center, meaning the key path it's trying to observe looks like 
self.needle.needle.center from the perspective of your ECGlassView object. 
Unless your ECNeedleView has a property also called needle, then that won't 
work (and if it did, then it would observe the wrong object). If you drop the 
needle from the key path, then it'll probably work.

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: Menu item enabling

2011-06-23 Thread Daniel Luis dos Santos
Hello,

I thought that by implementing the validation method it wouldn't matter if the 
menu item has an action set on it. That was the problem. Once I set the action, 
the validation method started being called.

Thanks,
Daniel 

On Jun 23, 2011, at 5:42 PM, Nick Zitzmann wrote:

 
 On Jun 23, 2011, at 10:17 AM, Daniel Luis dos Santos wrote:
 
 Hello,
 
 I have a submenu of the File menu that gets loaded with menu items on 
 awakeFromNib().
 Problem is that the method that does the menu item enabling is not being 
 called on the submenu's items and so they are not enabled.
 
 I implemented the validateUserInterfaceItem() method in a class and have set 
 the target of the created menu items to that class.
 It gets called for every menu item except the one with the submenu. If I 
 expand the submenu it doesn't get called.
 What am I missing ?
 
 That message will be sent to the menu item's target if it implements 
 -validateMenuItem: or -validateUserInterfaceItem: (to be pedantic, they are 
 methods and not functions). Are you sure the target  action of the menu 
 items are being set correctly? If the action wasn't set, then they won't be 
 enabled. If the target wasn't set, and nothing in the responder chain 
 implements the action, then they won't be enabled. If the target  action 
 were set, then they should be enabled by default, but maybe the target 
 implemented one of those methods and returned NO, which would explain why 
 they're off.
 
 Also, did you ensure -autoenablesItems is turned on in the submenu? It should 
 be by default...
 
 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: constrained window resizing

2011-06-23 Thread Ken Victor
using a timer works just fine. and i don’t believe any “debouncing” is 
necessary as the timer can’t fire if i am already in the process of resizing.

thanx ken and quincey,
ken


On Jun 23, 2011, at 3:57 PM, Ken Victor wrote:

 empirically, it appears that the event tracking loop for window resizing is 
 calling 
   -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
 so i can’t simply override NSWindow’s matching method in my subclass. thus, 
 while overriding NSApplication’s method is probably doable, i believe it 
 would be “messier” than quincey’s low tech solution, which can be 
 encapsulated in my subclass. i will now give this a try and report back.
 
 thanx quincey,
 ken
 
 
 On Jun 23, 2011, at 3:21 PM, Quincey Morris wrote:
 
 On Jun 23, 2011, at 14:55, Ken Victor wrote:
 
 lets say the user had been resizing the window without any modifier keys 
 pressed, but then realized what s/he really wanted was to resize in only 
 one dimension or to maintain the window’s aspect ratio, so now s/he presses 
 either shift or shift and control. i would like to be able to resize the 
 window at this time to show the proper effect, but i can’t do this until 
 the user moves the mouse AFTER changing the modifier keys.
 
 Don't overlook the possibility of a low tech solution. How about starting a 
 repeating timer with an interval of (say) 0.1 secs, and checking the flags 
 when the time fires? You'd probably want to debounce the timer by 
 preventing it from triggering another resize when resizing is already in 
 progress, and possibly for a short time afterwards.
 
 
 

___

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

Please do not post 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: tableView: objectValueForTableColumn: row: method not getting called

2011-06-23 Thread Scott Anguish

On Jun 23, 2011, at 5:49 PM, Jens Alfke wrote:

 
 On Jun 23, 2011, at 2:46 PM, Sandeep Mohan Bhandarkar wrote:
 
 I have just wired up the delegate outlet and for the second query. The count 
 shows up as zero but will this be the reason for the method not getting 
 called…?
 
 Yes. If there aren’t any rows, the table view won’t need to ask for what 
 objects to put in them.
 

This may be happening because of timing of the NIB loading vs the data. make 
sure to reload the data at the right point (windowDidLoad or after your 
document does if you’re using documents, there is a special hook for that)



___

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

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

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

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


Re: Coalesced updates and refresh rate

2011-06-23 Thread Graham Cox
OK, I needed a diversion from serious work and was intrigued to find out how 
practical it is to animate many instances of an analogue meter and how far you 
can go with the standard view update mechanism. Think of it as putting my money 
where my mouth is. I claimed it should be possible to get smooth animation 
using the standard mechanism if you are careful and play by the rules.

So, here's an app project that attempts to do that.

http://apptree.net/code/LED3.zip

I hope this is reasonably realistic for your particular situation. I have two 
windows, one which has a bargraph display somewhat like a spectrum analyser and 
2 large VU meters, and a second which has 36 smaller instances of the same VU 
meters. Each of these is an autonomous view, and entirely looks after its own 
simulation, including the meter ballistics by simulating a RC circuit. These 
are all animated using a common timer instance running at 30 frames per second. 
You can opt to set the VU view to be layer backed as well if you want - the 
four instances on the far left are layer backed and the layer transform is 
additionally animated. To turn this on, just check the layer backing checkbox 
in IB - another motivation for this was to get some more experience of using 
Core Animation - but note that overall I'm not using Core Animation to perform 
the majority of the animation you see, just a standard timer which updates the 
view periodically using the standard update mechanism. No threads, no smoke and 
mirrors.

I measured the drawing time for rendering a single VU meter (large) and it 
settled down to an average of about 220 µS. This is on my fairly up to date mid 
range Mac - a 27 iMac with 3.2 GHz i3 CPU and ATI Radeon 5670 graphics, 64-bit 
debugging build. So, your mileage will vary. But at 220µS, I have time to 
render about 75 instances of the meter in the 16.7mS timeslot available at 60 
fps (though I animate these at only 30 fps which seems adequate for fluid 
movement). The image used to draw the meter background is a PDF and it does not 
seem to cache this within the NSImage in another form - whether there is some 
other caching going on behind the scenes I don't know, but the same image is 
used for all instances, scaled to fit. I also used a common timer for all 
instances; that did seem to make a difference - having one timer per instance 
was slower, with a noticeable slowing of the apparent framerate.

Is it good enough? I don't know. Maybe 36 instances is far fewer than you have 
- you can easily add more by simply duplicating them in IB. Maybe your hardware 
is much slower, and of course, this app is not doing anything else in between 
frames except going to sleep. A real audio processing app would have much more 
work to do, but in theory it should have plenty of time to do it.

Well, it might give you some starting point or something to compare against. 
Anyway, it was fun :)

--Graham




On 15/06/2011, at 11:42 PM, Wolfgang Kundrus wrote:

 Thanks for taking the time to respond. I am certainly not a newbie, being a 
 Mac programmer since 1987 having brought three major applications with 
 millions of customers to market that all run cross platform. 
 
 That aside, I am trying to understand, why Cocoa does not flush the graphics, 
 if there has been drawn something to the window with the a method that works 
 well otherwise. I understand coalescing updates and I want to stay away from 
 CGContextFlush as this would cause the application to block, if another flush 
 has to happen.
 
 We do use the invalidate/draw wherever appropriate. In this specific base, 
 invalidate does not help, because it is not a simple redraw operation, but 
 rather moving an object by a few pixel without tearing. The other case where 
 we use direct drawing is the potentially hundreds of meter object that need 
 to be updated in a very specific way at a rate that is perceived as fluent.
 
 All the best
 
 Wolfgang
 
 
 2011/6/15 Graham Cox graham@bigpond.com
 
 On 15/06/2011, at 10:30 PM, Wolfgang Kundrus wrote:
 
  We have to update a lot of small onscreen objects and performance is way 
  better, when we travers them outside the Cocoa view tree. If we would use 
  invalidating, we would have to go thru our complete view tree and check for 
  overlaps with the update rect.
 
 
 Does each object have its own view? If so, then that's definitely not a good 
 idea. If not, then there really shouldn't be a problem  - checking for 
 overlap with the update rect is a simple matter of a) invalidating the update 
 rect(s) and b) at DRAW time, call [NSView needsToDrawRect:] to test for 
 overlap. Invariably it is drawing that dominates performance for this type of 
 scenario, so a simple YES/NO test of this type is well worthwhile and is very 
 fast.
 
 If you have, say  1000 objects that need updating, a linear list of these 
 will probably suffice on a modern machine. If you have more, a spatial 
 hashing scheme such as BSP can give