//	M160 : Generate / delete check box

define	mode = 1;
define	chk_no = 0;

function main()
{
	_Cls();

	_PrintF("Position and size of this window: x=%d, y=%d, cx=%d, cy=%d\n", _GetWndPosX(), _GetWndPosY(), _GetWndWidth(), _GetWndHeight());
	_PrintF("Text size: cx=%d, cy=%dCs=%d\n\n", _GetCharWidth(), _GetCharHeight(), _GetCharHeight());

	_PrintF("Create sequential checkboxes, then invalidate the checkboxes sequentially and delete them\n\n");

	_TimerStart(1, 1000);

	_Stop();
}

//	Timer event
function _OnTimer(tid)
{
	define	$txt;

	$txt = $_SPrintF("CHK-%d", chk_no);
	if		(mode == 1) _ChkBoxOpen  (chk_no, $txt);
	else if (mode == 2) _ChkBoxEnable(chk_no, _FALSE);
	else if (mode == 3) _ChkBoxClose (chk_no);
	
	if (++chk_no > 7) {
		chk_no = 0;
		if (++mode > 3) {
			_Restart();
		}
	}
}

//	Checkbox event
function _OnChkBox(ChkBoxNo, status)
{
	_PrintF("CheckBox %d, status=%d\n", ChkBoxNo, status);
}
