[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug with NSTextAttachment ?
From: |
Nicolas Roard |
Subject: |
Bug with NSTextAttachment ? |
Date: |
Tue, 23 Jul 2002 19:23:19 +0100 |
Hello,
I want to use and attachment in a NSMutableAttributedString; it's working, but
if I try to center
this attributed string in a NSTextView, it doesn't works well;
What I do is :
NSTextAttachment* BR = [NSTextAttachment alloc];
NSImage* img_br = [[NSImage alloc] initWithSize: NSMakeSize (200,0.1)];
NSTextAttachmentCell* attachCell = [[NSTextAttachmentCell alloc]
initImageCell: img_br];
NSMutableParagraphStyle* paragraphStyle = [NSMutableParagraphStyle
defaultParagraphStyle];
NSMutableAttributedString* AS;
[attachCell setBezeled: YES];
[BR setAttachmentCell: attachCell];
AS = [NSMutableAttributedString attributedStringWithAttachment: BR];
[paragraphStyle setAlignment: NSCenterTextAlignment];
[AS addAttribute: @"NSParagraphStyleAttributeName"
value: paragraphStyle
range: NSMakeRange(0,[AS length])];
printf ("longueur de l'AS : %d , taille de l'AS : %d\n", [AS length],
[AS size].width);
What the printf return is :
longueur de l'AS : 1 , taille de l'AS : 0
In the text view, the attachment cell is visible, but not rightly centered; it
starts from
the center of the textview, so it's too much on the right, like if the size of
the attachment
wasn't considered. As [AS size].width return 0 I think it's perhaps a bug ?
By the way, I'm not sure my way of doing that is the right one so tell me if
I'm wrong :)
--
Nicolas Roard <nicolas@witbe.net>
One Unix to rule them all, One Resolver to find them,
One IP to bring them all and in the zone bind them.
- Bug with NSTextAttachment ?,
Nicolas Roard <=
- NSStringDrawing Bug correction (was Bug with NSTextAttachment ?), Nicolas Roard, 2002/07/25
- Status of the GNU 3DKit, Philippe C.D. Robert, 2002/07/26
- Re: Status of the GNU 3DKit, Pete French, 2002/07/26
- Re: Status of the GNU 3DKit, Philippe C.D. Robert, 2002/07/26
- Re: Status of the GNU 3DKit, Pete French, 2002/07/26
- Re: Status of the GNU 3DKit, Philippe C.D. Robert, 2002/07/26
- Re: Status of the GNU 3DKit, Pete French, 2002/07/26