XSCheck

SYNTAX

        wid=XSCheck(parent,x,y,width,height,name,data,mask)

        XSWidget *wid,*parent;
        int  x,y,width,height;
        char *name;
	int  *data,mask;

DESCRIPTION

XSCheck create a checkbox widget inside the selected parent, in the position x,y with size width,height and label name. When mouse button is pressed and released inside this widget, a internal status is inverted.

If internal status is true, all bits in mask will be actived in *data. If internal status is false, all bits in mask will be deactived in *data. If mask have a unique 1 bit value, you can share one single 32 bit integer with 32 checkbox widgets.

All operations of XSCheck in the X server are delayed until XSCheckEvent is executed.

Example

#include <xstep.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc,char **argv) {

	XSWidget *d1,*w1;

	int check=0;

	d1=XSDesktop(getenv("DISPLAY"),argv,argc);
	w1=XSWindow(d1,0,0,400,400,"check example");

	XSCheck(w1,8,8+0*24,200,21,"680x0",&check,1);
	XSCheck(w1,8,8+1*24,200,21,"80x86",&check,2);

	XSButton(w1,-8,-8,72,24,"Close",XSWindowClose);
	
	while(XSCheckEvent(d1,XS_BLOCK)) {

		if(check==0) printf("check value is ''\n");
		if(check==1) printf("check value is '680x0'\n");
		if(check==2) printf("check value is '80x86'\n");
		if(check==3) printf("check value is '680x0' and '80x86'\n");
	}
	return 0;
}