Currently, my OS X 10.9 project is configured with a graphical interface in Objective-C and all processing in the C ++ class. This does not seem to be the best way, but it has been given to me, and I have to work with these restrictions. Cocoa's GUI currently has NSSlider . I want this NSSlider control the variable x in a C ++ class.
Currently, the tolerance panel works when I run the program (the working sense of it is constantly updating its value in my rolling manner).
NSSlider Header ( Slider.h ):
@interface Slider : NSObject { @private __weak IBOutlet NSTextField *sliderValue; __weak IBOutlet NSSlider *slider; } - (IBAction)updateSliderValue:(id)sender; @end
Implementation for NSSlider ( Slider.mm ):
#import "Slider.h" // The NSSlider object
Here is the corresponding snippet from Main.h :
class CMain(){ public: CMain(); void setValueofX(int number); int getValueofX(); private: int x; };
How to include CMain.h in Objective-C++ (which, .h file or .mm file? And how?) So that it can call methods in CMain.h ? How would I formulate a method call in Objective-C to set the value of x using setValueofX(sliderValue) ?
Please let me know if you need more information! Any help or thoughts appreciated!
Thanks!
source share