PDA

View Full Version : changing background color of a textview using colorwel?l




rethish
Jun 2, 2009, 02:23 AM
Hi,

I use a nscolorwell to change the back ground color of a nstextview.
I use an action method to do this task.

When I click the colorwell for the first time, the color panel window opens
and if I type in textview , the text color will be of the colorwell’s default color.

Is this colorwell default behaviour?

And if I select any color from the color panel the background color changes and if type
In textview, the text will also appear in the same color., which makes the text invisible.


I only want to change the back ground color of the textview.

Here is what I did:

-(IBAction)bgColwelaction:(id)sender
{

[textView setBackgroundColor:[bgColorwell color]];

}

Is anything missing?

Thank you in advance..

Rethish.



SRossi
Jun 2, 2009, 05:36 AM
I had exactly the same problem as you just last week.

I figured out that you cannot have the background change colour when the notification from the colorWell changes because it will also change the text colour.

Where is your colourWells set up? In a panel or the same window as the textView?

Stephen

rethish
Jun 3, 2009, 04:27 AM
Where is your colourWells set up? In a panel or the same window as the textView?

Stephen

hi,

I use the colorwell and the textview in the same window.

Thankyou

SRossi
Jun 3, 2009, 12:04 PM
The way I ended up changing the background colour was placing the NSColorWell in a panel like "Preferences" and changing the colour from there.

Thats the only way that I got it to change the background without changing the text.

Although I'm sure there's someone with a easier solution.

Stephen