Gap above NSMenuItem custom view

2010-12-26 Thread Joshua Garnham
I am using the setView: method on an NSMenuItem to set a custom view. In this 
custom view there is an image which takes the whole of the view. The NSMenuItem 
with this custom view is the first in the menu but the problem is it  doesn't 
sit flush with the top of the menu, there is a big gap as you  can see here:

http://i.imgur.com/jIWQD.png

Why is this happening and how can I stop it?

Thanks.




___

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

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

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

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


Re: Gap above NSMenuItem custom view

2010-12-26 Thread Kyle Sluder
On Dec 26, 2010, at 11:07 AM, Joshua Garnham  wrote:

> Why is this happening and how can I stop it?

You can't. Search the archives and you'll see other people have had this same 
problem.

There needs to be a bot that autoreplies to NSView-in-NSMenu questions: "If 
you're trying to mimic Spotlight, don't use an NSMenu."

--Kyle Sluder___

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

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

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

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


Re: Gap above NSMenuItem custom view

2010-12-26 Thread Josh
I am sure there is a way, I have been looking in the archives and found mention 
of changing the metrics for the top of the menu with Carbon. How would they of 
done this?

On 26 Dec 2010, at 17:11, Kyle Sluder  wrote:

> On Dec 26, 2010, at 11:07 AM, Joshua Garnham  
> wrote:
> 
>> Why is this happening and how can I stop it?
> 
> You can't. Search the archives and you'll see other people have had this same 
> problem.
> 
> There needs to be a bot that autoreplies to NSView-in-NSMenu questions: "If 
> you're trying to mimic Spotlight, don't use an NSMenu."
> 
> --Kyle Sluder
___

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

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

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

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


Re: Gap above NSMenuItem custom view

2010-12-26 Thread Kyle Sluder
On Dec 26, 2010, at 12:19 PM, Josh  wrote:

> I am sure there is a way, I have been looking in the archives and found 
> mention of changing the metrics for the top of the menu with Carbon. How 
> would they of done this?

You have no access to the Menu Manager on the modern runtime.

Spotlight doesn't use NSMenu. Neither should you.

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


Search with a UIWebView (iOS 4.2)

2010-12-26 Thread Philip Vallone
Hi List,

In iOS 4.2, you can search within a webpage in Safari. Is there a search bar 
object that can do this in a UIWebView?

Thanks,

Phil

___

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: Gap above NSMenuItem custom view

2010-12-26 Thread Joshua Garnham
I see your point but I just found this post on Stack Overflow detailing how 
someone else has done it. 

http://stackoverflow.com/questions/4064386/reverse-engineering-an-nsmenu-for-a-status-bar-item

However I am having dificulty compiling the code as I get EXC_BAD_ACCESS on the 
line where the event handler is installed. Can you shed any light on the code 
in that question?




___

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: Gap above NSMenuItem custom view

2010-12-26 Thread Kyle Sluder
On Sun, Dec 26, 2010 at 4:16 PM, Joshua Garnham
 wrote:
>
> I see your point but I just found this post on Stack Overflow detailing how 
> someone else has done it.
>
> http://stackoverflow.com/questions/4064386/reverse-engineering-an-nsmenu-for-a-status-bar-item
>
> However I am having dificulty compiling the code as I get EXC_BAD_ACCESS on 
> the line where the event handler is installed. Can you shed any light on the 
> code in that question?

1. Your question has nothing to do with compiling code. EXC_BAD_ACCESS
is a runtime exception caused by a bad pointer dereference.
2. Nobody can debug anything like this without your exact source code
and a stack trace leading up to the exception, at a bare minimum.
3. The code you posted relies on private API.
4. None of this will work on 64-bit Mac OS X.

So the answer is to stop beating this dead horse and do it the right
way. File a bug asking for support for this in NSMenu in a future
version of OS X if you like, but in the meantime your one, single,
solitary, only option is to forsake NSMenu and use a borderless
NSWindow.

--Kyle Sluder
___

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

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

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

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


Re: Strange error solved by turning off "Non-contiguous Layout"

2010-12-26 Thread Brad Stone
Ken - I never knew how to take a sample of the processes.  It's given me some 
visibility into the spinning beach ball.  I still get the deadlock in the 
commitEditing which is in saveDocumentWithDelegate only on some documents when 
I edit text that requires me to scroll an NSTextView.  Does anything jump out 
at you in this call graph?  What is NSOperation waiting for?

Call graph:
2761 Thread_118   DispatchQueue_1: com.apple.main-thread  (serial)
  2761 start
2761 main
  2761 NSApplicationMain
2761 -[NSApplication run]
  2761 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
2761 _DPSNextEvent
  2761 BlockUntilNextEventMatchingListInMode
2761 ReceiveNextEventCommon
  2761 RunCurrentEventLoopInMode
2761 CFRunLoopRunSpecific
  2761 __CFRunLoopRun
2761 __NSFireTimer
  2761 -[SRMainWindowController 
checkToSaveDirtyDoc:]
2761 -[PNDocument 
saveDocumentWithDelegate:didSaveSelector:contextInfo:]
  2761 
-[NSManagedObjectContext(NSEditorAndEditorRegistration) commitEditing]
2761 -[NSController commitEditing]
  2761 -[NSValueBinder commitEditing]
2761 -[NSValueBinder discardEditing]
  2761 -[_NSTextPlugin 
showValue:inObject:]
2761 -[NSTextStorage endEditing]
  2761 -[NSTextStorage 
processEditing]
2761 -[NSTextStorage 
_notifyEdited:range:changeInLength:invalidatedRange:]
  2761 -[NSLayoutManager 
textStorage:edited:range:changeInLength:invalidatedRange:]
2761 
-[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:]
  2761 
-[NSTextView(NSPrivate) _setFrameSize:forceScroll:]
2761 -[NSView 
setFrameSize:]
  2761 -[NSView 
_postFrameChangeNotification]
2761 -[NSClipView 
_reflectDocumentViewFrameChange]
  2761 -[NSClipView 
_scrollTo:animate:]
2761 
-[NSScrollView scrollClipView:toPoint:]
  2761 
-[NSClipView scrollToPoint:]
2761 
-[NSClipView _immediateScrollToPoint:]
  2761 
-[NSView displayIfNeeded]
2761 
-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
  2761 
-[NSOperationQueue waitUntilAllOperationsAreFinished]

2761 -[NSOperation waitUntilFinished]
  
2761 -[__NSOperationInternal waitUntilFinished]

2761 _pthread_cond_wait

  2761 __semwait_signal
2761 Thread_1166672   DispatchQueue_2: com.apple.libdispatch-manager  
(serial)
  2761 start_wqthread
2761 _pthread_wqthread
  2761 _dispatch_worker_thread2
2761 _dispatch_queue_invoke
  2761 _dispatch_mgr_invoke
2761 kevent
2761 Thread_1166673   DispatchQueue_6: com.apple.root.default-priority  
(serial)
  2761 start_wqthread
2761 _pthread_wqthread
  2761 _dispatch_worker_thread2
2761 _dispatch_call_block_and_release
  2761 __doStart2
2761 -[__NSOperationInternal start]
  2761 -[_NSViewDrawOperation main]
2761 -[NSTextView _drawRect:clip:]
  2761 -[NSTextView drawRect:]
2761 -[NSConcreteTextStorage _lockForReading]
  2761 -[NSViewHierarchyLock 
lockForReadingWithExceptionHandler:]
2761 _pthread_cond_wait
  2761 __semwait_signal



On Dec 22, 2010, at 12:37 AM, Ken Thomases wrote:

> On Dec 21, 2010, at 10:08 PM, Brad Stone wrote:
> 
>> I have an NSTextView that has about 1,900

Re: Strange error solved by turning off "Non-contiguous Layout"

2010-12-26 Thread Nick Zitzmann

On Dec 26, 2010, at 5:00 PM, Brad Stone wrote:

> Ken - I never knew how to take a sample of the processes.  It's given me some 
> visibility into the spinning beach ball.  I still get the deadlock in the 
> commitEditing which is in saveDocumentWithDelegate only on some documents 
> when I edit text that requires me to scroll an NSTextView.  Does anything 
> jump out at you in this call graph?  What is NSOperation waiting for?

Did you turn on the "can draw concurrently" option on the text view or its 
scroll view? If so, then turn that off. That option will not work, except in 
views that specifically support threaded drawing. IIRC, none of the AppKit's 
views support this (except for NSButton and NSProgressIndicator, but they have 
separate APIs for this for historical reasons).

Nick Zitzmann




___

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