Show TOC Welcome to the QLIB 1.0 Online Reference
QLIB 

QButton Examples

Four different button resources are created in the example below. Each one is used to create a button control. From left to right: normal button, checkbox, web-button and signal.
 
// Create button resources
BUTTON   = new QButtonRes(QButton.NORMAL, 46, 29,
           "img/qlib/btn2n.gif", "img/qlib/btn2p.gif", "img/qlib/btn2d.gif");
CHECKBOX = new QButtonRes(QButton.CHECKBOX, 22, 21,
           "img/qlib/btn1n.gif", "img/qlib/btn1p.gif");
WEBBTN   = new QButtonRes(QButton.WEB, 46, 29,
           "img/qlib/btn2n.gif", "img/qlib/btn2p.gif", "img/qlib/btn2d.gif");
SIGNAL   = new QButtonRes(QButton.SIGNAL, 22, 21,
           "img/qlib/btn1n.gif", "img/qlib/btn1p.gif", "img/qlib/btn1d.gif");

// Define event handling function
function hitTest(value) {
    alert(this.name + " is clicked! value = " + value);
}

// Create button controls
btn1 = new QButton(null, "btn1", BUTTON, "Normal Button");
btn2 = new QButton(null, "btn2", CHECKBOX, "Checkbox");
btn3 = new QButton(null, "btn3", WEBBTN, "Web-button");
btn4 = new QButton(null, "btn4", SIGNAL);

// Assign event handling function to the buttons
btn1.onClick = btn2.onClick = btn3.onClick = hitTest;