⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check.c

📁 这是一个支持"微型嵌入式 GUI" 的 SDK For Linux 版,其 GUI 核心可于 Linux, DOS 16/32 Bit, uC/OS-II及Windows 等平台工作,支持常用
💻 C
字号:
/*
CheckBox  - 多选框
www.ecub2006.com
*/
#include "gui.h" /* GUI 的头文件 */

typedef struct
{
HAND xlinux;
HAND windows;
HAND mac;
HAND dos;
}MyWinHand,*PMyWinHand;

void MyWin(HAND hd,MESSAGE msg) /* 窗口的消息处理函数 */
{
PMyWinHand winhand;
if(msg.type == GM_SYSTEM)/* 判断消息类型,消息类型全部为大写  */
	switch(msg.message)/* 判断消息 */
	{
	case GM_Create:/* 对象被创建后产生该消息,一般情况下,收到该消息时,
                对象还没有显示。可以在这里进行一些初始化工作。
				如果是窗口的GM_Create消息,可以创建新的对象,如 BUTTON 等 */
		winhand=(PMyWinHand)Gmalloc(sizeof(MyWinHand),"");
		winhand->xlinux=CreateObject(hd,CHECKBOX,1,1,"Linux",10,50,100,70,0,0);
        winhand->windows=CreateObject(hd,CHECKBOX,2,1,"Windows",10,75,100,95,0,0);
        winhand->mac=CreateObject(hd,CHECKBOX,3,1,"Mac OS X",10,100,100,120,0,0);
        winhand->dos=CreateObject(hd,CHECKBOX,4,1,"DOS",10,125,100,145,0,0);

		CreateObject(hd,BUTTON,5,1,"统计",10,160,100,180,0,0);
		SetObjVar(hd,winhand);
		return;
   case GM_Destroy:/* 对象将要被销毁时,产生该消息。 */
      /* 窗口中的Button等控件对象,系统会自动销毁 */
	   winhand=GetObjVar(hd);
       Gfree(winhand,sizeof(MyWinHand));
	   return;
	default:
		return;
	}
winhand=GetObjVar(hd);
if(msg.type == GM_COMMAND)/* 按钮被按下后产生的消息 */
	switch(msg.message)/* message 为按钮的ID */
	{
	case 5:
		{
		char buf[256];
		int n=0;
        memset(buf,0,256);
		if(efCheckBox->Get(winhand->xlinux)) n++;
        if(efCheckBox->Get(winhand->windows)) n++;
		if(efCheckBox->Get(winhand->mac)) n++;
		if(efCheckBox->Get(winhand->dos)) n++;
		sprintf(buf,"您选择了%d个操作系统",n);
		MessageBox(hd,"Message",buf,0);
		}
		return;
	default:
		return;
	}
	
}
int gmain(void *data)
{
	/* 创建窗口 */
	CreateObject(0,MAINWINDOW,1,1,"CheckBox",10,10,630,300,MyWin,0);
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -