0

I am trying to change the image of my nsbutton for my application. I have searched and found a couple of ways to do so but none of them are working for me at the moment.

I have looked at the following solutions :

How to set NSButton background image Using -setImage on NSButton

I have a routine that is called when I click the button :

- (IBAction)pauseResumeButtonAction:(id)sender

{ IAgentInterface* agentInterface = ioc::Container::Resolve();

if (self.pauseResumeSwitch == PauseResumeSwitch::PAUSE)
{
    //if ready to pause do this
    AgentCommand cmd( AGENT_CMD_PAUSE_SERVICE);
    agentInterface->sendAgentCommand( cmd );
    self.pauseResumeSwitch = PauseResumeSwitch::RESUME;

    [self.pauseResumeButton setImage:[NSImage imageNamed:@"pause.png"]];
}
else if (self.pauseResumeSwitch == PauseResumeSwitch::RESUME)
{
    //else if ready to resume do this
    AgentCommand cmd( AGENT_CMD_RESUME_SERVICE);
    agentInterface->sendAgentCommand( cmd );
    self.pauseResumeSwitch = PauseResumeSwitch::PAUSE;

    [self.pauseResumeButton setImage:[NSImage imageNamed:@"resume.png"]];
}

}

enter image description here

enter image description here

can someone please help me find my mistake ? it will be of great help

thanks in advance :)

Community
  • 1
  • 1
Tanzeel
  • 455
  • 6
  • 16
  • the style changes the way that the button's image works, it may only just display an image if it is in custom style – Grady Player May 15 '14 at 21:23
  • the style drop down includes different styles such as a radio button or a checkbox button – Tanzeel May 15 '14 at 23:00
  • self.pauseResumeButton <- did you checked this is not null? – 9dan May 16 '14 at 04:25
  • I am not sure but I tired to debug. Placed a breakpoint at this code and clicked the button. when I reach this place, inside the debug area I try to expand the self variable but nothing shows inside that variable. then I try to print the self variable in the console and I get the following outputs : – Tanzeel May 16 '14 at 13:28
  • (lldb) p self error: cannot define category for undefined class 'PanelController' error: cannot find interface declaration for 'PanelController' note: forward declaration of class here note: forward declaration of class here error: 2 errors parsing expression – Tanzeel May 16 '14 at 13:30
  • (lldb) p self.pauseResumeButton error: cannot define category for undefined class 'PanelController' error: cannot find interface declaration for 'PanelController' error: member access into incomplete type 'PanelController' note: forward declaration of class here note: forward declaration of class here note: forward declaration of class here error: 3 errors parsing expression – Tanzeel May 16 '14 at 13:43

0 Answers0