• 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
Image within Textfield - Show Editor at correct position
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Image within Textfield - Show Editor at correct position


  • Subject: Image within Textfield - Show Editor at correct position
  • From: Heukamp Stefan <email@hidden>
  • Date: Fri, 27 Mar 2009 11:21:18 +0100

Hi,

I want to implement a Textfield that shows an image at the left side, just like the addressbar in Safari. Therefore I subclassed NSTextFieldCell and overrode
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView.
It draws the image and then calls super with a frame somewhat further on the right. All this works just fine, but when I am going to edit the TextFiled, the overridden Function is not called and teh Text is edited on the very left of the Textfield, above the Image.


I further tried overriding
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength
and
- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent.
In the Implementation I moved the aRect somwhat left. The editor now is shown at the correct position but the FocusRing does not cover the complete textfield but it is somewhat shorter on the left side.


Can anybody help me with this issue?

Thanks in advance,
Stefan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: NSFileManager: can't set group ID on 10.4
  • Next by Date: Processing data maintained with Core Data
  • Previous by thread: Re: Confused about superclass initializers
  • Next by thread: Processing data maintained with Core Data
  • Index(es):
    • Date
    • Thread