/* 按下按钮后将调用的回调函数 */ void switch_style(LCUI_Widget *widget, LCUI_WidgetEvent *event) { /* 找到被选中的单选框,并设置相应视频模式 */ if(RadioButton_IsOn(rdbtn[0])) { LCUIScreen_SetMode( 0, 0, LCUI_INIT_MODE_AUTO ); } if(RadioButton_IsOn(rdbtn[1])) { LCUIScreen_SetMode( 800, 600, LCUI_INIT_MODE_FULLSCREEN ); } if(RadioButton_IsOn(rdbtn[2])) { LCUIScreen_SetMode( 800, 600, LCUI_INIT_MODE_WINDOW ); } }
/* 按下按钮后将调用的回调函数 */ void switch_style(LCUI_Widget *widget, LCUI_WidgetEvent *event) { /* 找到被选中的单选框,并为窗口设定相应风格 */ if(RadioButton_IsOn(rdbtn[0])) { Widget_SetStyleID( main_window, WINDOW_STYLE_PURE_BLUE ); } if(RadioButton_IsOn(rdbtn[1])) { Widget_SetStyleID( main_window, WINDOW_STYLE_PURE_GREEN ); } if(RadioButton_IsOn(rdbtn[2])) { Widget_SetStyleID( main_window, WINDOW_STYLE_PURE_RED ); } if(RadioButton_IsOn(rdbtn[3])) { Widget_SetStyleID( main_window, WINDOW_STYLE_PURE_ORANGE ); } if(RadioButton_IsOn(rdbtn[4])) { Widget_SetStyleID( main_window, WINDOW_STYLE_PURE_PURPLE ); } }
static void show_msgbox( LCUI_Widget *widget, LCUI_WidgetEvent *unused ) { int i, ret; MB_BTN_TYPE btn_type; MB_ICON_TYPE icon_type; /* 根据所选中的单选框,得出参数 */ for(i=0,btn_type=0; i<6; ++i,++btn_type) { if( RadioButton_IsOn(rb_btn[i]) ) { break; } } for(i=0,icon_type=0; i<5; ++i,++icon_type) { if( RadioButton_IsOn(rb_icon[i]) ) { break; } } /* 调用LCUI_MessageBox函数,显示消息框 */ ret = LCUI_MessageBox( icon_type, "这是一条消息文本。", "消息框", btn_type); printf("clicked button: %d\n", ret); }
static void view_result(LCUI_Widget *widget, LCUI_WidgetEvent *unused) { char str[256]; strcpy(str, "你的年龄段是: "); if(RadioButton_IsOn(age_rb[0])) { strcat(str, "15岁以下"); } if(RadioButton_IsOn(age_rb[1])) { strcat(str, "15-20岁"); } if(RadioButton_IsOn(age_rb[2])) { strcat(str, "21-25岁"); } if(RadioButton_IsOn(age_rb[3])) { strcat(str, "26-30岁"); } if(RadioButton_IsOn(age_rb[4])) { strcat(str, "31-40岁"); } if(RadioButton_IsOn(age_rb[5])) { strcat(str, "40岁以上"); } strcat(str, "。"); Label_Text(age_label, str); Widget_Disable(button); }