Image within Textfield - Show Editor at correct position
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