• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Views within NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Views within NSTextView


  • Subject: Views within NSTextView
  • From: Sean Willson <email@hidden>
  • Date: Sat, 28 Jan 2006 18:56:01 -0600

I've been digging through the archive and haven't found any solution to this
problem nor have I found it elsewhere online. I am yet another person
attempting to create an AddressBook style editor or some semblance of that
behavior of a smooth layout with autoresizing textfields. So here is my
problem ... I have a custom NSTextAttachmentCell that I am using to forward
on events to NSButtons, NSTextFields, etc. I can get the widgets to display
in the NSTextView fine BUT I can't for the live of me get it to make the
widgets usable. What I mean by this is that I can't click in the TextField
and get focus and I can't click the button. Here is how I am setting them
up:

    WATextAttachmentCell *attachmentCell = [[[WATextAttachmentCell alloc]
init] autorelease];
    NSTextField *textFieldCell = [[NSTextField alloc]
initWithFrame:NSMakeRect(0.0, 0.0, 200.0, 19.0)];
    [textFieldCell setEditable:YES];
    [textFieldCell setStringValue:@"test string"];
    [textFieldCell sizeToFit];
    [attachmentCell setCell:textFieldCell];
    NSTextAttachment *attachment = [[[NSTextAttachment alloc] init]
autorelease];
    [attachment setAttachmentCell:attachmentCell];
    [[textView textStorage] appendAttributedString:[NSAttributedString
attributedStringWithAttachment:attachment]];

I have tried multiple ways to set the first responder to that text field but
I can't get it to work. It seems like there is almost a pane above it
interrupting the mouse events. I've made sure to forward on all of the mouse
events from the NSTextAttachmentCell protocol and those are indeed making it
to the text field.

As an aside, it seems like there are a lot of people who have started a
similar project of getting this editor working but there are no examples
online and the people that are working on it seem to just stop of move on to
other things. I can usually find samples to most things online but this
custom text code is a endangered species.

If anyone has any ideas I would greatly appreciate it.

Thanks,
Sean
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: IMService not defined
  • Next by Date: Using Evan Schoemberg's Custom tabs
  • Previous by thread: Re: scrolling with MightyMouse
  • Next by thread: Using Evan Schoemberg's Custom tabs
  • Index(es):
    • Date
    • Thread