Code Sample
Here is a very basic program that displays a container with a button. Clicking on the button exits the program.
#include <ilviews/gadgets/button.h>
#include <ilviews/gadgets/gadcont.h>
 
void Quit(IlvGraphic*, IlAny arg)
{
IlvDisplay* display = (IlvDisplay*)arg;
delete display;
IlvExit(0);
}
 
int main(int argc, char* argv[])
{
// Create the display.
IlvDisplay* display = new IlvDisplay("Hello", "", argc, argv);
if(!display)
return 0;
if(display->isBad()){
delete display;
return 1;
}
 
// Create the container.
IlvGadgetContainer* cont =
new IlvGadgetContainer(display, "Hello", "Hello", IlvRect(0,0,100,100));
cont->moveToScreen(IlvCenter);
 
// Add the button.
IlvButton* button = new IlvButton(display, IlvPoint(30, 30), "Click Me !");
button->addCallback(Quit, display);
cont->addObject(button);
 
// Show the container and run the event loop.
cont->show();
IlvMainLoop();
 
return 0;
}
Published date: 05/24/2022
Last modified date: 02/24/2022