Search Results

Search found 7 results on 1 pages for 'nslayoutmanager'.

Page 1/1 | 1 

  • How to paint background of specific range of text in NSTextView

    - by Rui Pacheco
    Hi, This is not a specific bug, its more about not knowing how to do something. I've an NSTextView and I need to paint the background of specific ranges of text when the user clicks on a specific part of the text view. I've tried this but I just get erratic behaviour in the sense that sometimes text loses the foreground color or the background doesn't span the whole range: NSLayoutManager *layoutManager = [myTextView layoutManager]; [layoutManager removeTemporaryAttribute:NSBackgroundColorAttributeName forCharacterRange:range]; [[myTextView layoutManager] setTemporaryAttributes:attributes forCharacterRange:range]; For the sake of simplicity assume that range is always a valid string (it is in my testing environment).

    Read the article

  • How to create skype like message window?

    - by Miraaj
    Hi all, I am just trying to design skype like message window , for this I have taken the NSDrawer element. It contains : a table view on left, menu items on top, text field on right bottom and text view at central portion on right side. Using text view I can play with string being displayed but I cannot draw the line between messages or round rectangle surrounding user name and time stamp. Can anyone suggest me how can I achieve same look and feel for central message view as in skype?? or is there any better control then NSTextView to be used for it?? Thanks, for any suggestion... Miraaj

    Read the article

  • Sporadic EXC_BAD_INSTRUCTION (SIGILL) when in 64 bit mode

    - by Ger Teunis
    For some reason for a low-number of users (say 1 in a few hundred) the application seem to crash when run in 64bit mode on a Snow Leopard 10.6.3 I've attached the code, but please remind IT IS NOT A CODE issue. The crashed seem to be random in com.apple.AppKit at random locations and random moments. Anyone else had any experiences? Using GCC compiler of Xcode 3.2.2 Crash #1 of user Code Type: X86-64 (Native) Parent Process: launchd [90] Date/Time: 2010-05-02 04:12:59.708 -0500 OS Version: Mac OS X 10.6.3 (10D573) Report Version: 6 Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: objc[232]: alt handlers in objc runtime are buggy! Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff874dd8b7 _objc_fatal + 238 1 libobjc.A.dylib 0x00007fff874de57c objc_addExceptionHandler + 1026 2 com.apple.CoreFoundation 0x00007fff83914212 _CFDoExceptionOperation + 402 3 com.apple.AppKit 0x00007fff87afc55d _NSAppKitLock + 79 4 com.apple.AppKit 0x00007fff87bd1f93 +[NSColorList _findColorListNamed:forDeviceType:] + 86 5 com.apple.AppKit 0x00007fff87b9d304 -[NSCatalogColor colorUsingColorSpaceName:device:] + 255 6 com.apple.AppKit 0x00007fff87c985ad -[NSLayoutManager(NSPrivate) _drawGlyphsForGlyphRange:atPoint:parameters:] + 4764 7 com.apple.AppKit 0x00007fff87c5d79c -[NSTextView drawRect:] + 1839 8 com.apple.AppKit 0x00007fff87c5ce2e -[NSTextView _drawRect:clip:] + 2343 9 com.apple.AppKit 0x00007fff87be4485 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1325 10 com.apple.AppKit 0x00007fff87be47ef -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2199 11 com.apple.AppKit 0x00007fff87be2b57 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 767 12 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 13 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 14 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 15 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 16 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 17 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 18 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 19 com.apple.AppKit 0x00007fff87be3a23 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4555 20 com.apple.AppKit 0x00007fff87be2678 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 254 21 com.apple.AppKit 0x00007fff87bdef27 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2683 22 com.apple.AppKit 0x00007fff87b58777 -[NSView displayIfNeeded] + 969 23 com.apple.AppKit 0x00007fff87b53622 _handleWindowNeedsDisplay + 678 24 com.apple.Foundation 0x00007fff8600fa4d __NSFireTimer + 114 25 com.apple.CoreFoundation 0x00007fff83908708 __CFRunLoopRun + 6488 26 com.apple.CoreFoundation 0x00007fff839068df CFRunLoopRunSpecific + 575 27 com.apple.HIToolbox 0x00007fff821b5ada RunCurrentEventLoopInMode + 333 28 com.apple.HIToolbox 0x00007fff821b58df ReceiveNextEventCommon + 310 29 com.apple.HIToolbox 0x00007fff821b5798 BlockUntilNextEventMatchingListInMode + 59 30 com.apple.AppKit 0x00007fff87b28a2a _DPSNextEvent + 708 31 com.apple.AppKit 0x00007fff87b28379 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155 32 com.apple.AppKit 0x00007fff87d37060 -[NSTextView mouseDown:] + 8426 33 com.apple.AppKit 0x00007fff87c21f1b -[NSWindow sendEvent:] + 5409 34 com.apple.AppKit 0x00007fff87b57662 -[NSApplication sendEvent:] + 4719 35 com.apple.AppKit 0x00007fff87aee0aa -[NSApplication run] + 474 36 com.apple.AppKit 0x00007fff87ae6d7c NSApplicationMain + 364 37 com.NZBVortex.NZBVortex 0x0000000100000fe0 start + 52 Crash #2 from same user moments later Code Type: X86-64 (Native) Parent Process: launchd [76] Date/Time: 2010-05-02 11:59:33.226 +0200 OS Version: Mac OS X 10.6.3 (10D573) Report Version: 6 Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: objc[4360]: alt handlers in objc runtime are buggy! Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff8015d8b7 _objc_fatal + 238 1 libobjc.A.dylib 0x00007fff8015e57c objc_addExceptionHandler + 1026 2 com.apple.CoreFoundation 0x00007fff85367212 _CFDoExceptionOperation + 402 3 com.apple.AppKit 0x00007fff840b5f2f -[NSViewHierarchyLock lockForReadingWithExceptionHandler:] + 478 4 com.apple.AppKit 0x00007fff8420753e -[NSConcreteTextStorage _lockForReading] + 243 5 com.apple.AppKit 0x00007fff841e1449 -[NSLayoutManager(NSPrivate) _fillGlyphHoleForCharacterRange:startGlyphIndex:desiredNumberOfCharacters:] + 320 6 com.apple.AppKit 0x00007fff840e204a _NSFastFillAllGlyphHolesForGlyphRange + 719 7 com.apple.AppKit 0x00007fff841e10e2 _NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex + 653 8 com.apple.AppKit 0x00007fff841e0c72 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 243 9 com.apple.AppKit 0x00007fff840f6786 -[NSLayoutManager glyphRangeForTextContainer:] + 286 10 com.apple.AppKit 0x00007fff846664a9 -[NSToolTipStringDrawingLayoutManager _sizeWithSize:attributedString:] + 883 11 com.apple.AppKit 0x00007fff84665dad +[NSToolTipStringDrawingLayoutManager sizeForDisplayingAttributedString:] + 354 12 com.apple.AppKit 0x00007fff84667292 -[NSToolTipManager displayToolTip:] + 616 13 com.apple.AppKit 0x00007fff846657d4 toolTipTimerFired + 114 14 com.apple.CoreFoundation 0x00007fff8535b708 __CFRunLoopRun + 6488 15 com.apple.CoreFoundation 0x00007fff853598df CFRunLoopRunSpecific + 575 16 com.apple.HIToolbox 0x00007fff88510ada RunCurrentEventLoopInMode + 333 17 com.apple.HIToolbox 0x00007fff885108df ReceiveNextEventCommon + 310 18 com.apple.HIToolbox 0x00007fff88510798 BlockUntilNextEventMatchingListInMode + 59 19 com.apple.AppKit 0x00007fff840d1a2a _DPSNextEvent + 708 20 com.apple.AppKit 0x00007fff840d1379 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155 21 com.apple.AppKit 0x00007fff8409705b -[NSApplication run] + 395 22 com.apple.AppKit 0x00007fff8408fd7c NSApplicationMain + 364 23 com.NZBVortex.NZBVortex 0x0000000100000fe0 start + 52 Weirdly enough the crashes seem to go away for these users when running the code in 32 bit mode. Any suggestions other then running the application in 32 bit only? Please do not dilute the feedback by asking for or blaming the code, the code is 100% solid, guaranteed! No memory leaks, the crashes clearly are triggered in 32 bit mode only just after start inside the AppKit itself like deep inside NSThread sleep's callstack.

    Read the article

  • Draw text with in a rect with given width

    - by Forchita
    I'm trying to draw text on NSView subclass. I'm using an NSTextStorage, an NSLayoutManager, and an NSTextContainer. I followed Apple's doc and here's the method I use to calculate the necessary height for each text: NSSize newSize= NSMakeSize(width, 0.0); NSLayoutManager* layoutManager= [[textStorage layoutManagers] objectAtIndex:0]; NSTextContainer* textContainer= [[layoutManager textContainers] objectAtIndex:0]; [textContainer setContainerSize:newSize]; [textStorage addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [textStorage length])]; [textContainer setLineFragmentPadding:0.0]; [layoutManager glyphRangeForTextContainer:textContainer]; return [layoutManager usedRectForTextContainer:textContainer].size.height; The only problem is that I don't know how to draw in an NSRect with the layout manager. Can you help me please? Thanks in advance!

    Read the article

  • Switching textstorage of NSTextViews back and forth

    - by Jakob Dam Jensen
    I'm trying to make a feature in a product which gives the user the ability to split a textview into two. The way this is done is by removing the textview from it's superview, making a NSSplitView and adding the textview as well as a new NSTextView instance to this splitview. Lastly I make these two textviews share the same textstorage in order to make them share the same content. It works great. But the problem is when I want to make one of the two textviews change textstorage. The replaceTextStorage method in NSLayoutManager causes both NSTextView to change textStorage. The API documentation states: replaceTextStorage: All NSLayoutManager objects sharing the original NSTextStorage object then share the new one. This method makes all the adjustments necessary to keep these relationships intact, unlike setTextStorage:. So it makes sense that it would do this. But the question is how do I make it possible to have two (or more) textviews first share the same storage and after that having them using their own? I've tried replacing the layoutManager and even making new instances of NSTextViews but no luck... Any suggestions?

    Read the article

  • How do I locate the CGRect for a substring of text in a UILabel?

    - by bryanjclark
    For a given NSRange, I'd like to find a CGRect in a UILabel that corresponds to the glyphs of that NSRange. For example, I'd like to find the CGRect that contains the word "dog" in the sentence "The quick brown fox jumps over the lazy dog." The trick is, the UILabel has multiple lines, and the text is really attributedText, so it's a bit tough to find the exact position of the string. The method that I'd like to write on my UILabel subclass would look something like this: - (CGRect)rectForSubstringWithRange:(NSRange)range; Details, for those who are interested: My goal with this is to be able to create a new UILabel with the exact appearance and position of the UILabel, that I can then animate. I've got the rest figured out, but it's this step in particular that's holding me back at the moment. What I've done to try and solve the issue so far: I'd hoped that with iOS 7, there'd be a bit of Text Kit that would solve this problem, but most every example I've seen with Text Kit focuses on UITextView and UITextField, rather than UILabel. I've seen another question on Stack Overflow here that promises to solve the problem, but the accepted answer is over two years old, and the code doesn't perform well with attributed text. I'd bet that the right answer to this involves one of the following: Using a standard Text Kit method to solve this problem in a single line of code. I'd bet it would involve NSLayoutManager and textContainerForGlyphAtIndex:effectiveRange Writing a complex method that breaks the UILabel into lines, and finds the rect of a glyph within a line, likely using Core Text methods. My current best bet is to take apart @mattt's excellent TTTAttributedLabel, which has a method that finds a glyph at a point - if I invert that, and find the point for a glyph, that might work. Update: Here's a github gist with the three things I've tried so far to solve this issue: https://gist.github.com/bryanjclark/7036101

    Read the article

  • How do I use Core Data with the Cocoa Text Input system?

    - by the Joel
    Hobbyist Cocoa programmer here. Have been looking around all the usual places, but this seems relatively under-explained: I am writing something a little out of the ordinary. It is much simpler than, but similar to, a desktop publishing app. I want editable text boxes on a canvas, arbitrarily placed. This is document-based and I’d really like to use Core Data. Now, The cocoa text-handling system seems to deal with a four-class structure: NSTextStorage, NSLayoutManager, NSTextContainer and finally NSTextView. I have looked into these and know how to use them, sort of. Have been making some prototypes and it works for simple apps. The problem arrives when I get into persistency. I don't know how to, by way of Cocoa Bindings or something else, store the contents of NSTextStorage (= the actual text) in my managed object context. I have considered overriding methods pairs like -words, -setWords: in these objects. This would let me link the words to a String, which I know how to store in Core Data. However, I’d have to override any method that affects the text - and that seems a little much. Thankful for any insights.

    Read the article

1