changing background color of a textview using colorwel?l

Discussion in 'Mac Programming' started by rethish, Jun 2, 2009.

  1. macrumors member

    Joined:
    Oct 16, 2008
    #1
    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.
     
  2. macrumors regular

    Joined:
    May 27, 2009
    Location:
    Glasgow, Scotland
    #2
    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
     
  3. thread starter macrumors member

    Joined:
    Oct 16, 2008
    #3
    hi,

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

    Thankyou
     
  4. macrumors regular

    Joined:
    May 27, 2009
    Location:
    Glasgow, Scotland
    #4
    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
     

Share This Page