Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rethish

macrumors member
Original poster
Oct 16, 2008
41
0
Hi all,


Please help ...

I use nscolorwell to set the backgroundcolor of the textview. It works with the code [textview setBackgroundColor:[colorwel color]];

But there is some problem .

The problem is,

I have a textview and if I click the colorwell , the text which is to be typed appear in the that color, which is currently active in the colorwel. ie ., background and foreground colors become the same.

Whenever I activate the colorwell by clicking the nscolorwell instance these things happen.

After activating the colorwell ,if we select any colors from that colorwell
The backgroundcolor changes and the foregroundcolor changes to the same color if we type.

Here is the code:

-(IBAction)colorwellaction:(id)sender
{



NSTextStorage *store =[textview textStorage];
NSRange range=[ textview selectedRange];



if([textview shouldChangeTextInRange:range replacementString:nil])
{
[store addAttribute:NSBackgroundColorAttributeName value:nil
range:range];

[textview setBackgroundColor:[colorwell color]];
[textview didChangeText];
}



}


I want the colorwell to act ,only when any color from it is selected,
Not at the time of activation .


Please help..

searching for an answer for it, for weeks
I am really fedup withit....


Thanks inadvance

regards
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.