NSAnimation subclass calling display on a view

2008-11-24 Thread David Alter
I'm creating an animation using NSAnimation. I have created a subclass of
NSAnimation that over loads setCurrentProgress. The delegate is a subclass
of NSImageView. When setCurrentProgress gets called I call my delegate
display method. My drawRect method in my subclass of NSImageView identifies
if we are animating and draws accordingly.

//Here is where I create an instance of my animation subclass. I'm using the
default settings for blocking.
myAnimationSubclass = [[MyAnimation alloc] initWithDuration:0.5
animationCurve:NSAnimationEaseInOut];
[myAnimationSubclass setDelegate:delegate];
// Run the animation synchronously.
[myAnimationSubclass startAnimation];

//This is from my subclass of NSAnimation
- (void)setCurrentProgress:(NSAnimationProgress)progress {
[super setCurrentProgress:progress];

  [[self delegate] display];
}


//This is from my subclass of NSImageView
- (void)drawRect:(NSRect)rect {
if(![myAnimationSubclass isAnimating]) {
[super drawRect:rect];
} else {
//Do my drawing stuff
}
}

My drawRect method is not being called until the animation is complete. It
was my understanding that calling display would force an immediate redrawing
of the NSView, or subclass of NSImageView in this case. This would result in
calling drawRect. However setCurrentProgress is getting called several times
but drawRect is not being called. Resulting in no animation.

I'm clearly missing something but I'm not sure what it is. If you have any
ideas please let me know.

thanks
-dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSAnimation subclass calling display on a view

2008-12-02 Thread David Alter
I'm creating an animation using NSAnimation. I have created a subclass of
NSAnimation that over loads setCurrentProgress. The delegate is a subclass
of NSImageView. When setCurrentProgress gets called I call my delegate
display method. My drawRect method in my subclass of NSImageView identifies
if we are animating and draws accordingly.

//Here is where I create an instance of my animation subclass. I'm using the
default settings for blocking.
myAnimationSubclass = [[MyAnimation alloc] initWithDuration:0.5
animationCurve:NSAnimationEaseInOut];
[myAnimationSubclass setDelegate:delegate];
// Run the animation synchronously.
[myAnimationSubclass startAnimation];

//This is from my subclass of NSAnimation
- (void)setCurrentProgress:(NSAnimationProgress)progress {
[super setCurrentProgress:progress];

  [[self delegate] display];
}


//This is from my subclass of NSImageView
- (void)drawRect:(NSRect)rect {
if(![myAnimationSubclass isAnimating]) {
[super drawRect:rect];
} else {
//Do my drawing stuff
}
}

My drawRect method is not being called until the animation is complete. It
was my understanding that calling display would force an immediate redrawing
of the NSView, or subclass of NSImageView in this case. This would result in
calling drawRect. However setCurrentProgress is getting called several times
but drawRect is not being called. Resulting in no animation.

I'm clearly missing something but I'm not sure what it is. If you have any
ideas please let me know.

thanks
-dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Drawing in a NSView out side of drawRect

2008-12-19 Thread David Alter
I want to draw in a NSView but not when drawRect is called. To do this I
understand that I need to call lockFocus before drawing and unlockFocus
after. The drawing appears to happen but it is not until I deactivate the
window do I see my results. How can I get it to refresh once I have done my
drawing?
To test this out I have sub classed NSView and overloaded mouseDown. I added
the following code.

- (void)mouseDown:(NSEvent *)theEvent ;

{

NSPoint loc = [[self window] mouseLocationOutsideOfEventStream];

loc = [self convertPoint:loc fromView:[[self window] contentView]];

 CGContextRef myContext =
(CGContextRef)[[NSGraphicsContext currentContext]graphicsPort];

[self lockFocus];

CGContextSetRGBFillColor (myContext, 1, 0, 0, 1);

CGContextFillRect (myContext, CGRectMake (loc.x, loc.y, 10, 10 ));

[self unlockFocus];

}

This will draw a box for each mouse click, but not until I deactivate my
window.

thanks for the help
-dave
___

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

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

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

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


Re: Drawing in a NSView out side of drawRect

2008-12-22 Thread David Alter
>
> > CGContextRef myContext =
> > (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort];
>
> Right now you're getting the current graphics context, which is purely
> arbitrary. Nothing has set it yet, so you're getting whatever happened
> to be hanging around.


Is there a way to create a NSGraphicsContext for the view?

>
>
>
___

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

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

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

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


Re: Drawing in a NSView out side of drawRect

2008-12-23 Thread David Alter
Thanks to everyone that has responded to me. It has been a big help.


> > I want to draw in a NSView but not when drawRect is called.
>
> Others have pointed this out, but I want to reiterate: no you don't.
> Trying to draw outside of drawRect: will only lead to pain. (It is
> useful, on rare occasions. You are not experiencing one of them.) Work
> with the view machinery. Call -setNeedsDisplay:.
>

I understand that the preferred method of doing thing is do your drawing in
drawRect:. I would like to understand better what are the issues and draw
backs to using lockFocus and then drawing.

thanks
-dave
___

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

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

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

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


Finding and NSView in a window

2009-09-16 Thread David Alter
Is there and easy way to find the top most view for a given point in a
Window?
thanks for the help
-dave
___

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

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

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

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


Making a opaque copy of an NSImage

2009-10-01 Thread David Alter
*I have an NSImage that I would like to make a transparent version for
dragging. I have used - (void)dissolveToPoint:(NSPoint)aPoint
fraction:(CGFloat)delta to do this in the past. That appears to be getting
deprecated and I would like to update my code. What is the suggested way of
doing things. I still need to support 10.4 and up.

enjoy
-dave

*
___

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

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

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

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


Setting Application cursor

2009-10-14 Thread David Alter
I need to set a cursor for the application when it is in specific states. I
have been doing this by creating by cursor and calling set.

[[NSCursor crosshairCursor] set];

If the application is deactivated. When you activate the application the
cursor needs to be reset. I tried doing this in
NSApplicationDidBecomeActiveNotification and that is not working. I suspect
it is getting set but then it is getting set back to the pointer. Any
suggestions on when I should set this after my application becomes active.

thanks for the help
-dave
___

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

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

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

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


Re: Setting Application cursor

2009-10-14 Thread David Alter
I do need the cursor to be active everywhere on the screen. In other places
we are using NSTrackingArea and that works great.

On Wed, Oct 14, 2009 at 2:48 PM, Kyle Sluder  wrote:

> On Wed, Oct 14, 2009 at 2:42 PM, David Alter 
> wrote:
> > I need to set a cursor for the application when it is in specific states.
> I
> > have been doing this by creating by cursor and calling set.
>
> Do you need this cursor to be effective anywhere on the screen?  If
> not, use the NSTrackingArea API on whatever view you want to have the
> custom cursor.  This is what we do in OmniGraphSketcher (well, we
> don't use NSTrackingArea, but instead the older tracking rect event
> API, but the result is the same).
>
> --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


Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter
I'm a little confused on the mouse tracking. I have a view and I want  
to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will  
not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


thanks for the help
Dave



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter
I just realized that NSTrackingArea is 10.5 and up. I need to support  
10.4. mouseEntered and mouseExited have been part of NSResponder from  
10.0. To receive these events in 10.4 what should I do?


thanks
-dave

On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote:


On Aug 19, 2008, at 12:04, David Alter wrote:

I'm a little confused on the mouse tracking. I have a view and I  
want to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent  
will not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


Yes, create a tracking area, but *don't*  
setAcceptsMouseMovedEvents:YES.


Both mechanisms result in mouseMoved events, but you only want the  
events produced by the tracking area. (Well, you may not want  
mouseMoved events at all, just mouseEntered and mouseExited, but you  
tell the tracking area which of its possible events you want.)



___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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 [EMAIL PROTECTED]


Re: Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter

Figured it out. I just need to use

addTrackingRect:owner:userData:assumeInside

enjoy
-dave

On Aug 19, 2008, at 2:50 PM, David Alter wrote:

I just realized that NSTrackingArea is 10.5 and up. I need to  
support 10.4. mouseEntered and mouseExited have been part of  
NSResponder from 10.0. To receive these events in 10.4 what should I  
do?


thanks
-dave

On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote:


On Aug 19, 2008, at 12:04, David Alter wrote:

I'm a little confused on the mouse tracking. I have a view and I  
want to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent  
will not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


Yes, create a tracking area, but *don't*  
setAcceptsMouseMovedEvents:YES.


Both mechanisms result in mouseMoved events, but you only want the  
events produced by the tracking area. (Well, you may not want  
mouseMoved events at all, just mouseEntered and mouseExited, but  
you tell the tracking area which of its possible events you want.)



___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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 [EMAIL PROTECTED]


nibless applications

2008-09-02 Thread David Alter
I have a situation where it would make a lot of sense to have a  
nibless application. I think this situation is unique and would  
suspect that very few people would need to do this. There is some  
information on how to do this. Lap Cat Software has some good  
information on this . The example does a few things that makes me question if this is  
the way to go. That brings me to my question.


Is there a supported way to make nibless applications?

If someone from apple wants to comment of the solution provide by Lap  
Cat Software I would be very interested.


thanks for the help.

-dave


___

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

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

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

This email sent to [EMAIL PROTECTED]


issues with mainMenu and initialization timing

2008-09-23 Thread David Alter
I'm working on a x-platform application that is written in Carbon and  
we are moving it to cocoa. I have it using a native Cocoa run loop as  
the main event loop. It is a nibless application. I jump through a few  
hoops for that to work correctly. Now I'm experiencing some very  
strange behaviors with the main menu. None of the menus or keyboard  
equivalents will work until you have selected the application menu.  
You do not need to choose a menu option you just need to select the  
menu.


Suspecting this had something to do with the timing of the  
initialization I made a sample project and created the menu bar very  
early on. This resulted in the same issue. So I moved the creation of  
the main menu to when applicationWillFinishLaunching was called on my  
delegate. This fixed the issue on my sample project. On the main  
application I did the same thing. This did NOT fix the issue. There is  
a number of other things initializing very early on in this  
application, including some carbon events registering and even a  
window could potentially open.


I'm at a little bit of a loss on what to try next. Because it is cross  
platform it is not easy for me to change the initialization process.  
The code is very dependent on the initialization being sequential.  
Cocoa notifies me when it is ready for me to initialize things. ( i.e.  
applicationWillFinishLaunching ). If I created the main menu before  
NSApp run is called I have problems ( applicationWillFinishLaunching  
is called after run ). On the other hand it is problematic for me to  
drop into the run loop before initializing the the cross platform code.


One option would be to over ride the run in NSApp. I must admit that I  
would like to avoid that option if at al possible. Apple documentation  
highly discourages it.


Is there a way that I can force Cocoa to initialize before calling run?

Is there some good example code on overloading run?

thanks for the help
-dave


___

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

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

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

This email sent to [EMAIL PROTECTED]


get the drawing text height

2009-01-26 Thread David Alter
I'm drawing a string to screen and I want to get the height if I specify a
specific width. I'm drawing the string by using the NSString drawInRect:
withAttributes:. I do not see how I can get the height after the text has
wrapped. I have looked at  NSString sizeWithAttributes, but there does not
appear to be away to set the width so I can compute the height the text will
take up.
Any ideas?

thanks
-dave
___

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

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

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

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


Getting CGImage out of NSBitmapImageRep in 10.4

2009-02-23 Thread David Alter
I need to get a CGImage out of a NSBitmapImageRep. This needs to work in
10.4.
I tried doing this by setting the bitmap as the graphics context and then
creating the image form the context. This gives me an CGBitmapContextCreate:
unsupported parameter combination. Here is the code

NSGraphicsContext * context = [NSGraphicsContext
graphicsContextWithBitmapImageRep:offscreenRep];

CGContextRef bitmapContext = (CGContextRef)[context graphicsPort];

CGImageRef image = CGBitmapContextCreateImage (bitmapContext);

I suspect there is a better way to do this. Does anyone have any
suggestions.

enjoy
-dave
___

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

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

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

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


Re: Getting CGImage out of NSBitmapImageRep in 10.4

2009-02-24 Thread David Alter
On Mon, Feb 23, 2009 at 7:42 PM, Michael Ash  wrote:

> On Mon, Feb 23, 2009 at 4:51 PM, David Alter 
> wrote:
> > I need to get a CGImage out of a NSBitmapImageRep. This needs to work in
> > 10.4.
> > I tried doing this by setting the bitmap as the graphics context and then
> > creating the image form the context. This gives me an
> CGBitmapContextCreate:
> > unsupported parameter combination. Here is the code
> >
> > NSGraphicsContext * context = [NSGraphicsContext
> > graphicsContextWithBitmapImageRep:offscreenRep];
> >
> > CGContextRef bitmapContext = (CGContextRef)[context graphicsPort];
> >
> > CGImageRef image = CGBitmapContextCreateImage (bitmapContext);
> >
> > I suspect there is a better way to do this. Does anyone have any
> > suggestions.
>
> Just call CGImageCreate. Most of the parameters can be obtained by
> simply querying the NSBitmapImageRep, and the remainder are not
> terribly difficult to create yourself, being either constants or
> fairly easy to construct.
>
> That should work fine.

As I have progressed with this, I would like to do some additional drawing
in my  NSBitmapImageRep. Is there a way that I can set it as my
NSGraphicsContext. As I noted
earlier NSGraphicsContext graphicsContextWithBitmapImageRep: is giving me an
error.

What I want to do is create the NSBitmapImageRep from a jpg. Draw into the
image and extract a CGImageRef out. I need to be able to access
the individual pixels of the image. Maybe there is a better way to do this?

thanks for the help
-dave
___

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

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

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

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


Re: Getting CGImage out of NSBitmapImageRep in 10.4

2009-02-24 Thread David Alter
I removed the use of the NSBitmapImageRep as you suggested and it is working
much better now.
Thanks for the help
-dave


On Tue, Feb 24, 2009 at 10:10 AM, douglas welton <
douglas_wel...@earthlink.net> wrote:

> David,
>
> perhaps I'm missing something simple...  Is there some reason that you are
> using NSBitmapImageRep to handle the jpg file?
>
> why not use CGImageSource to read your jpg file, create a CGImage from the
> CGImageSource, draw the new CGImage into a CGBitmapContext, do your
> additional drawing; and then extract a final CGImage from the
> CGBitmapContext with CGBitmapContextCreateImage?
>
> regards,
>
> douglas
>
>
>
> On Feb 24, 2009, at 12:41 PM, David Alter wrote:
>
>  What I want to do is create the NSBitmapImageRep from a jpg. Draw into the
>> image and extract a CGImageRef out. I need to be able to access
>> the individual pixels of the image. Maybe there is a better way to do
>> this?
>>
>>
>
___

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

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

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

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


NSSlider changed notification

2009-03-10 Thread David Alter
Hi All,
I'm sure this is something basic that I'm just missing. For some reason I
can not find how to get a notification when my slider changes value. I want
to be able to subscribe to receive a notification if the slider value
changes. Is there a delegate method for this? What is the best way to get
this?

I guess one option would be to use KVO, but I suspect there is
a simpler solution.

thanks for the help
-dave
___

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

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

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

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


Intercepting events from a control

2009-03-10 Thread David Alter
I need to know about events destine for a specific control. Is there a way
to receive these events with out subclassing the control. All I have is a
reference to the control. I need events like MouseDown, MouseUp. It would
also be very helpful if I knew when the control became the first responder
and resigned first responder.

Is there a way to do this?

thanks for the help
-dave
___

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

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

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

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


Simulating a click in NSStepper

2009-04-16 Thread David Alter
I'm using a NSStepper with the little up and down arrows. I want to simulate
a click where the correct arrow will get highlighted as if someone clicked
into it. I'm unclear how I should do this. I can do a perform click but that
does not specify what arrow to click.
Any suggestions?

thanks for the help
-dave
___

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

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

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

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


custom field editor results in no focus ring

2009-04-23 Thread David Alter
I was looking at using a customer field editor for my NSTextField. I have
read over the docs at Text Editing Programming Guide for Cocoa: Working With
the Field 
Editor.
In my Window delegate I added the -(id)windowWillReturnFieldEditor:(NSWindow
*)sender toObject:(id)anObject method. If I create a custom field editor, my
NSTextField no longer get a focus ring. This happens even if my field custom
field editor is a NSTextView.
Here is my code from my window delegate

-(id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject
{
if ([anObject isKindOfClass:[NSTextField class]])
{
return [[[NSTextView alloc] initWithFrame:[anObject frame]]
autorelease];
}
   return nil;
}

I suspect that I'm not connecting something correctly, I'm jut not sure
what. Can someone help clarify what is happening here.

thank
-dave
___

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

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

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

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


NSTextField notification if selection changed

2009-04-27 Thread David Alter
How can I get notification if the Selection changed in a NSTextField. This
works with a NSTextView by setting up the delegate -
(void)textViewDidChangeSelection:(NSNotification *)aNotification

A NSTextField uses a NSTextView for its editing. And the NSTextField is the
delegate to the NSTextView. If I need to get the selection changed should I
be subclassing NSTextField and placing the textViewDidChangeSelection
delegate method in there. Or is there a simpler solution to this.

thanks for the help
-dave
___

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

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

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

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


NSTextField notification if selection changed

2009-04-27 Thread David Alter
How can I get notification if the Selection changed in a NSTextField. This
works with a NSTextView by setting up the delegate -
(void)textViewDidChangeSelection:(NSNotification *)aNotification

A NSTextField uses a NSTextView for its editing. And the NSTextField is the
delegate to the NSTextView. If I need to get the selection changed should I
be subclassing NSTextField and placing the textViewDidChangeSelection
delegate method in there. Or is there a simpler solution to this.

thanks for the help
-dave
___

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

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

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

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


Calling a super call method from and instance

2009-05-07 Thread David Alter
In Objective-C 1.0 (not 2.0 ) is there a way to call a super class method if
I have a reference to the class
See bellow
@interface MyClassA : NSObject {
}
-(void) aboutMe ;
@end
@implementation MyClassA

-(void) aboutMe ;
{
NSLog(@"I'm Class A");
}
@end

@interface MyClassB :MyClassA {
}
-(void) aboutMe ;
@end
@implementation MyClassB
-(void) aboutMe ;
{
NSLog(@"I'm Class B");
}
@end

-(void) someMethod:(MyClassB*) myClass
{

//I want to call MyClassB's super of aboutMe. This should output "I'm Class
A"

}
 thanks for the help

-dave
___

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

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

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

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


Interpreting action from NSStepper

2009-05-12 Thread David Alter
When a user clicks on my stepper my action method gets called. How can I
identify if the user is clicking the up arrow or the down arrow
Thanks for the help
-dave
___

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

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

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

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


Underlining a Tab item label

2009-05-25 Thread David Alter
With NSTabView I can set the font of the NSTabViewItem label. Is there a way
to make it underlined? I have always done this with the NSAttributeString in
the past. However I do not see how I can get access to the attribute string
for the NSTabViewItem label.
thank for the help
-dave
___

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

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

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

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


setting a CGContextRef to the current Context

2009-07-08 Thread David Alter
I have CGContextRef that I use for some quartz calls. It is a bitmap
context. I would like to set it as the current context so that I can use
NSString drawAtPoint: withAttributes:. I do not see how to do this.
NSGraphicContext setCurrentContext: takes a NSGraphicContext and not an
CGContextRef. I do not see a way to create a NSGraphicContext with a
CGContextRef. Nor do I see anything in the C API. So I'm a little unclear
how I can set my bitmap Context to the current context so I can draw my
string. Anyone have any ideas.
thanks for the help.

-dave
___

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

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

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

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


change color on a NSButton

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

thanks for the help.

enjoy
-dave
___

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

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

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

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


Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
Is there a way to lookup what and NString constant is at runtime? I want to
know what the string is for a given constant. For example I would like to
pass in the constant name ( i.e. NSDeviceResolution) and get back
the NSString that constant represents. I know in this case that the Constant
name and the string are the same but I suspect that is not always true. Any
ideas?

thanks
-dave
___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
This would work for finding out what the name is as well as logging it.

What if I'm getting a string passed in that is the name of the constant and
I want to return the constants string value. Is there a way to do that?

something like...
NSString * constValue = [SomeToolToLookupConstants constant:@
"NSDeviceResolution'];

any idea?
-dave


On Mon, Jan 4, 2010 at 2:19 PM, Oftenwrong Soong
wrote:

> On Mon, Jan 4, 2010 at 4:56 PM, David Alter 
> wrote:
> > Is there a way to lookup what and NString constant is at runtime?
>
>
>
> Have you tried
>
> [NSDeviceResolution description]
>
> or
>
> [NSString stringWithString:NSDeviceResolution]
>
> ?
>
> Soong
>
>
>
> ___
>
> 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/alterconsulting%40gmail.com
>
> This email sent to alterconsult...@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: Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
I can open a library and lookup a function by name using dlsym. These
constants are EXTERN. It seams there should be away to look these up as
well.

-dave


On Mon, Jan 4, 2010 at 3:39 PM, Scott Ribe wrote:

> > What if I'm getting a string passed in that is the name of the constant
> and
> > I want to return the constants string value. Is there a way to do that?
>
> This is C, and just as with variables, the names are not there at runtime.
> If you really need to do this, you'll have to build your own lookup table,
> possibly using some macro magic to avoid having to type the name twice for
> each entry.
>
> --
> Scott Ribe
> scott_r...@killerbytes.com
> http://www.killerbytes.com/
> (303) 722-0567 voice
>
>
>
___

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


Image of minimized window using 10.4 APIs

2010-01-13 Thread David Alter
I want to get the image of a minimized window that is in the dock and modify
it. But here is the catch. I need this to work on 10.4 and up. The API
miniwindowImage from NSWindow will only return something if you have
modified the image. Is there a way to do this?

Another way to do this is if I could create an image of a Window. I know how
I would do that with the contentView but not the entire window. Any ideas on
that?

thanks
-dave
___

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

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

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

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


inspecting return data from NSPasteboard propertyListForType:

2010-01-25 Thread David Alter
I have some generic code for when data is dragged into my application. I
wanted to do something like this

id data = [[sender draggingPasteboard] propertyListForType:type];

if ( [NSArray isSubclassOfClass:[data class]] or [NSDictionary
isSubclassOfClass:[data class]]) {
//do a list thing
} else {
//do a single thing
}

What I'm finding is that when the data type is NSCFArray it is not being
identified by [NSArray isSubclassOfClass:. Why is that? Is there something I
can do it identify what the Data type is?

thanks for the help
-dave
___

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

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

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

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