Changing color in NSColorWell

  • In the "DrawerController" files below, the code...

    float aRed = .7581, aGre = 1., aBlu = 0, aAlp = 1;
    [chosenColorWell setColor:[NSColor
    colorWithCalibratedRed:aRed green:aGre blue:aBlu
    alpha:aAlp]];

    ...works correctly. It Changes the color in a
    ColorWell.
    In the "Space" files also below the same code does not
    work.
    Any ideas Why?
    The ColorWells were both created in IB and then set up
    as outlets and connected.

    Thanks Rick T.
    //////////////////////////

    #import <Cocoa/Cocoa.h>

    @interface DrawerController :    NSObject
    {
    IBOutlet NSColorWell *aChosenColorWell;
    }

    - (float)processLeftDrawer;

    @end

    //////////////////////////

    #import "DrawerController.h"

    @implementation DrawerController

    - (float)processLeftDrawer{
    float aRed = .7581, aGre = 1., aBlu = 0, aAlp = 1;
    [aChosenColorWell setColor:[NSColor
    colorWithCalibratedRed:aRed green:aGre blue:aBlu
    alpha:aAlp]];
    }

    @end

    //////////////////////////
    /* Space */

    #import <Cocoa/Cocoa.h>

    @class DrawerController;

    @interface Space : NSView
    {

    IBOutlet NSColorWell *anotherChosenColorWell;
    }

    - (void) mouseUp:(NSEvent *) theEvent;

    @end

    //////////////////////////

    #import "Space.h"
    #import "DrawerController.h"

    @implementation Space

    - (void) mouseUp:(NSEvent *) theEvent
    {
    float gPriRed = .7581, gPriGre = 1., gPriBlu = 0,
    gPriAlp = 1;
    [anotherChosenColorWell setColor:[NSColor
    colorWithCalibratedRed:gPriRed green:gPriGre
    blue:gPriBlu alpha:gPriAlp]];
    }

    @end

    __________________________________________________
    Do You Yahoo!?
    Tired of spam?  Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
  • Check anotherChosenColorWell outlet points to ColorWell or not. My
    assumption is, it points to nil.

    On 12-Oct-06, at 8:44 AM, R T wrote:

    > In the "DrawerController" files below, the code...
    >
    > float aRed = .7581, aGre = 1., aBlu = 0, aAlp = 1;
    > [chosenColorWell    setColor:[NSColor
    > colorWithCalibratedRed:aRed green:aGre blue:aBlu
    > alpha:aAlp]];
    >
    > ...works correctly. It Changes the color in a
    > ColorWell.
    > In the "Space" files also below the same code does not
    > work.
    > Any ideas Why?
    > The ColorWells were both created in IB and then set up
    > as outlets and connected.
    >
    > Thanks Rick T.
    > //////////////////////////
    >
    >
    > #import <Cocoa/Cocoa.h>
    >
    > @interface DrawerController :    NSObject
    > {
    > IBOutlet NSColorWell *aChosenColorWell;
    > }
    >
    > - (float)processLeftDrawer;
    >
    > @end
    >
    > //////////////////////////
    >
    > #import "DrawerController.h"
    >
    > @implementation DrawerController
    >
    > - (float)processLeftDrawer{
    > float aRed = .7581, aGre = 1., aBlu = 0, aAlp = 1;
    > [aChosenColorWell    setColor:[NSColor
    > colorWithCalibratedRed:aRed green:aGre blue:aBlu
    > alpha:aAlp]];
    > }
    >
    > @end
    >
    > //////////////////////////
    > /* Space */
    >
    > #import <Cocoa/Cocoa.h>
    >
    > @class DrawerController;
    >
    > @interface Space : NSView
    > {
    >
    > IBOutlet NSColorWell *anotherChosenColorWell;
    > }
    >
    > - (void) mouseUp:(NSEvent *) theEvent;
    >
    > @end
    >
    > //////////////////////////
    >
    > #import "Space.h"
    > #import "DrawerController.h"
    >
    > @implementation Space
    >
    > - (void) mouseUp:(NSEvent *) theEvent
    > {
    > float gPriRed = .7581, gPriGre = 1., gPriBlu = 0,
    > gPriAlp = 1;
    > [anotherChosenColorWell    setColor:[NSColor
    > colorWithCalibratedRed:gPriRed green:gPriGre
    > blue:gPriBlu alpha:gPriAlp]];
    > }
    >
    > @end
    >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Tired of spam?  Yahoo! Mail has the best spam protection around
    > http://mail.yahoo.com
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/apparao%
    > 40effigent.net
    >
    > This email sent to <apparao...>
    >
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today