cocoa bindings and strings shown in 2 different lines of the same table column and row delay in displaying
cocoa bindings and strings shown in 2 different lines of the same table column and row delay in displaying
- Subject: cocoa bindings and strings shown in 2 different lines of the same table column and row delay in displaying
- From: "vibhatha v" <email@hidden>
- Date: Mon, 27 Nov 2006 12:08:16 +0530
Hi,
i have an NSTableView where i have 2 strings shown in 2 different lines of
the same table column and row. i have to put different fonts to these two
stings.
In order to do this, i am using NSMutableAttributedString.
string1 is the object of type NSMutableAttributedString.
i am now using,
[string1 addAttribute:NSFontAttributeName value:systemFont
range:NSMakeRange(0,[normalText length])];
This adds the required font to string1.
Similarly, i have another string NSMutableAttributedString string2 to which
i am assigning a different font.
i now append a '\r' character and then try to get a string of kind
"string1|rstring2".
Now, i get a single string which is a combination of two different strings
with different fonts and also displayed in 2 different lines of the same
table column and row.
i display this in
-(void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn*)aTableColumn row:(int)rowIndex
function by identifying the table column identifier in the below mentioned
manner.
[[aTableColumn dataCellForRow:rowIndex]
setAttributedStringValue:[attrStringArray objectAtIndex:rowIndex]];
[Note that attrStringArray is my array which contains all the strings of
type NSMutableAttributedString.]
Also, i am planning to use the concepts of cocoa bindings, so i have bound
the initial string what i got i.e. string1|rstring2 to the nib.
My problem is now, when the table selection changes, since i have bound that
particular table column, my table view cell displays "string1|rstring2"
intially and after some time gap,
goes to -(void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn*)aTableColumn row:(int)rowIndex
function and then displays the string as expected with different fonts.
Can anyone suggest me a better method to do this? How can i program so that
this delay does not happen and my strings are displayed properly?
Or can i use any other function instead of -(void)tableView:(NSTableView
*)aTableView willDisplayCell:(id)aCell
forTableColumn:(NSTableColumn*)aTableColumn row:(int)rowIndex
to display my strings properly?
Thanks and Regards,
Vibhatha.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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