• 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
Re: Addressbook style textfield
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressbook style textfield


  • Subject: Re: Addressbook style textfield
  • From: Ryan Bates <email@hidden>
  • Date: Fri, 5 Mar 2004 13:29:44 -0800

Although I don't have any code examples, I can tell you how I would accomplish a similar effect:

I would first subclass NSTextView and set it up as a custom class for a text view in Interface Builder (double click the text view so you aren't changing the NSScrollView). Override the "drawRect:" method in your subclass and pass it onto super so it draws all the text.

Next you need to find the rectangle where you want to draw the raised editor. To do this, first find out what characters you want to draw the raised editor around. Once you have the range of characters you can get the surrounding rectangle by converting the character range to a glyph range using NSLayoutManager's "glyphRangeForCharacterRange:actualCharacterRange:" method then calling NSLayoutManager's "boundingRectForGlyphRange:".

Now you can draw the raised editor around this rectangle. First draw the editor into an image so you can punch a whole through the middle before drawing so the text can show through. To draw the shadow, use NSShadow while drawing a white rectangle.

Well, this should help you get started. Let me know if you have any specific questions on how I would do it.

On a side note, keep an eye on Apple's sample code page. They recently released some WWDC 2003 presentation code for a full screen OpenGL view, and they may release others in the near future.

Ryan

On Mar 5, 2004, at 12:16 PM, Andrew Kazmierski wrote:

Hi there,

Sorry to bring this old topic up again, but I figured I'd do this instead of making a totally new topic. Anyway, I'm also in need of an address book style text view. I don't think that I want to buy an ADC premium account /just/ to get at this example -- does anyone have any example code to do this? Any help would be GREATLY appreciated! :-)

Thanks guys,

Andrew

On Jan 21, 2004, at 4:52 PM, Alexander Griekspoor wrote:

Hi!
I have exactly the same question as was brought up a while ago, and am looking for a pointer / some sample code that could get me started.
I have created a great new cocoa app for molecular biologists that displays sequence traces in a custom view.
Now I would like the user to edit a line of text that is drawn above the traces, using a similar input textfield address book uses and keynote. It should popup when the users clicks on the letter, allowing input, after which it disappears again and the letter is changed. Scott is referencing to the WWDC tips, but alas I'm not rich enough to visit the WWDC or buy a premium ADC membership. Are the WWDC examples (of last year and those before) available anywhere publicly? I guess I would manage with the source only, even if I did not see the accompanying section...
Again, any help, samples and/or pointers are very much appreciated!
Thanks!
Alex

Re: Addressbook style textfield

FROM: Scott Anguish
DATE: 2003-12-06 09:15

On Dec 6, 2003, at 2:57 AM, Francisco Tolmasky wrote:

> I'm attempting to implement (just started) an address book style text
> field (the one that pops up and auto expands). Before I begin
> however, I was wondering if there was already an implementation
> available or any attempts I could work off of. Any pointers would be
> great too. In particular, how does one make an nstextview that
> autoresizes itself?
>

this is done using an NSTextView (a single one for all the fields)

there is example code for this in the WWDC Tips
_______________________________________________

*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web: http://www.mekentosj.com

iRNAi, do you?
http://www.mekentosj.com/irnai

*********************************************************

*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web: http://www.mekentosj.com

EnzymeX - To cut or not to cut
http://www.mekentosj.com/enzymex

*********************************************************
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Addressbook style textfield
      • From: Andrew Kazmierski <email@hidden>
References: 
 >[?] Re: Addressbook style textfield (From: Andrew Kazmierski <email@hidden>)

  • Prev by Date: Making an NSDrawer transparent
  • Next by Date: Re: Passing C Style Function Callbacks in Cocoa
  • Previous by thread: Re: [?] Re: Addressbook style textfield
  • Next by thread: Re: Addressbook style textfield
  • Index(es):
    • Date
    • Thread