#includeusing namespace cppfe; void buttonClicked(CppFE_Widget *button) { cout << "Button was clicked!" << endl; } int main() { // create the button widget CppFE_Widget *button = new CppFE_Button("Click me!"); // set the callback function button->setCallback(buttonClicked); // add the button to a frame CppFE_Frame *frame = new CppFE_Frame(); frame->addWidget(button); // start the event loop CppFE_Application::getInstance()->run(frame); return 0; }
#includeThis example uses the cpp Frame editor library to create a slider, set its range, and add it to a frame. When the slider's value changes, the callback function is called, and it prints the new value to the console. The package library used in these examples is cppfe, which is the cpp Frame editor library.using namespace cppfe; void sliderMoved(CppFE_Widget *slider, int value) { cout << "Slider value: " << value << endl; } int main() { // create the slider widget CppFE_Widget *slider = new CppFE_Slider(0, 100); // set the callback function slider->setCallback(sliderMoved); // add the slider to a frame CppFE_Frame *frame = new CppFE_Frame(); frame->addWidget(slider); // start the event loop CppFE_Application::getInstance()->run(frame); return 0; }