iup, IupParamBox 问题
iup, IupParamBox problems
首先抱歉我的英语不好。我对 IupParamBox 有疑问,我想在可以更改设置的程序中使用 IupParamBox 创建一个设置列表。我尝试使用 IupGetParam 函数,但我无法将 IupGetParam 放入 Vbox,因为它有自己的 window。网上没有 IupParamBox 的例子,只有 IupGetParam。这是我编写的代码:
int main(int argc, char **argv){
int pboolean = 1;
Ihandle *dlg, *box, *hbox2;
IupOpen(&argc, &argv);
hbox2 = IupHbox(IupLabel("Settings"), IupButton("Button D", ""), NULL);
box = IupVbox(
IupParamBox(param,
"Boolean: %b[No,Yes]\n" ,
&pboolean,
NULL),
hbox2,
NULL);
dlg = IupDialog(box);
IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop ();
IupClose ();
}
我得到一个window但是它是空白的,按钮也是不可见的。
我做错了什么,我该如何解决?
这是 IupParamBox 的示例代码:
int main(int argc, char **argv)
{
int pboolean = 1;
int pinteger = 3456;
float preal = 3.543f;
int pinteger2 = 192;
float preal2 = 0.5f;
float pangle = 90;
char pstring[100] = "string text";
char pcolor[100] = "255 0 128";
int plist = 2;
char pfile_name[500] = "test.jpg";
Ihandle *dlg, *box, *hbox2, *param1, *param2, *param3, *param4, *param5, *param6, *param7, *param8, *param9, *param10, *param11, *param12, *parambox;
IupOpen(&argc, &argv);
IupSetLanguage("ENGLISH");
param1 = IupParam("Boolean: %b[No,Yes]{Boolean Tip}\n");
param2 = IupParam("Integer: %i{Integer Tip}\n");
param3 = IupParam("Real 1: %r{Real Tip}\n");
param4 = IupParam("Sep1 %t\n");
param5 = IupParam("Integer: %i[0,255]{Integer Tip 2}\n");
param6 = IupParam("Real 2: %r[-1.5,1.5]{Real Tip 2}\n");
param7 = IupParam("Sep2 %t\n");
param8 = IupParam("Angle: %a[0,360]{Angle Tip}\n");
param9 = IupParam("String: %s{String Tip}\n");
param10 = IupParam("List: %l|item1|item2|item3|{List Tip}\n");
param11 = IupParam("File: %f[OPEN|*.bmp;*.jpg|CURRENT|NO|NO]{File Tip}\n");
param12 = IupParam("Color: %c{Color Tip}\n");
IupSetInt(param1, "VALUE", pboolean);
IupSetInt(param2, "VALUE", pinteger);
IupSetFloat(param3, "VALUE", preal);
IupSetInt(param5, "VALUE", pinteger2);
IupSetFloat(param6, "VALUE", preal2);
IupSetFloat(param8, "VALUE", pangle);
IupSetAttribute(param9, "VALUE", pstring);
IupSetInt(param10, "VALUE", plist);
IupSetAttribute(param11, "VALUE", pfile_name);
IupSetAttribute(param12, "VALUE", pcolor);
hbox2 = IupHbox(IupLabel("Settings"), IupButton("Extra Button", NULL), NULL);
box = IupVbox(
parambox = IupParamBox(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, NULL),
hbox2,
NULL);
// IupSetCallback(parambox, "PARAM_CB", (Icallback)param_action);
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "IupParamBox Example");
IupPopup(dlg, IUP_CENTER, IUP_CENTER);
if (IupGetInt(parambox, "STATUS") == 1)
{
pboolean = IupGetInt(param1, "VALUE");
pinteger = IupGetInt(param2, "VALUE");
preal = IupGetFloat(param3, "VALUE");
pinteger2 = IupGetInt(param5, "VALUE");
preal2 = IupGetFloat(param6, "VALUE");
pangle = IupGetFloat(param8, "VALUE");
strcpy(pstring, IupGetAttribute(param9, "VALUE"));
plist = IupGetInt(param10, "VALUE");
strcpy(pfile_name, IupGetAttribute(param11, "VALUE"));
strcpy(pcolor, IupGetAttribute(param12, "VALUE"));
IupMessagef("IupGetParam",
"Boolean Value: %d\n"
"Integer: %d\n"
"Real 1: %g\n"
"Integer: %d\n"
"Real 2: %g\n"
"Angle: %g\n"
"String: %s\n"
"List Index: %d\n"
"FileName: %s\n"
"Color: %s\n",
pboolean, pinteger, (double)preal, pinteger2, (double)preal2, (double)pangle, pstring, plist, pfile_name, pcolor);
}
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}
首先抱歉我的英语不好。我对 IupParamBox 有疑问,我想在可以更改设置的程序中使用 IupParamBox 创建一个设置列表。我尝试使用 IupGetParam 函数,但我无法将 IupGetParam 放入 Vbox,因为它有自己的 window。网上没有 IupParamBox 的例子,只有 IupGetParam。这是我编写的代码:
int main(int argc, char **argv){
int pboolean = 1;
Ihandle *dlg, *box, *hbox2;
IupOpen(&argc, &argv);
hbox2 = IupHbox(IupLabel("Settings"), IupButton("Button D", ""), NULL);
box = IupVbox(
IupParamBox(param,
"Boolean: %b[No,Yes]\n" ,
&pboolean,
NULL),
hbox2,
NULL);
dlg = IupDialog(box);
IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop ();
IupClose ();
}
我得到一个window但是它是空白的,按钮也是不可见的。
我做错了什么,我该如何解决?
这是 IupParamBox 的示例代码:
int main(int argc, char **argv)
{
int pboolean = 1;
int pinteger = 3456;
float preal = 3.543f;
int pinteger2 = 192;
float preal2 = 0.5f;
float pangle = 90;
char pstring[100] = "string text";
char pcolor[100] = "255 0 128";
int plist = 2;
char pfile_name[500] = "test.jpg";
Ihandle *dlg, *box, *hbox2, *param1, *param2, *param3, *param4, *param5, *param6, *param7, *param8, *param9, *param10, *param11, *param12, *parambox;
IupOpen(&argc, &argv);
IupSetLanguage("ENGLISH");
param1 = IupParam("Boolean: %b[No,Yes]{Boolean Tip}\n");
param2 = IupParam("Integer: %i{Integer Tip}\n");
param3 = IupParam("Real 1: %r{Real Tip}\n");
param4 = IupParam("Sep1 %t\n");
param5 = IupParam("Integer: %i[0,255]{Integer Tip 2}\n");
param6 = IupParam("Real 2: %r[-1.5,1.5]{Real Tip 2}\n");
param7 = IupParam("Sep2 %t\n");
param8 = IupParam("Angle: %a[0,360]{Angle Tip}\n");
param9 = IupParam("String: %s{String Tip}\n");
param10 = IupParam("List: %l|item1|item2|item3|{List Tip}\n");
param11 = IupParam("File: %f[OPEN|*.bmp;*.jpg|CURRENT|NO|NO]{File Tip}\n");
param12 = IupParam("Color: %c{Color Tip}\n");
IupSetInt(param1, "VALUE", pboolean);
IupSetInt(param2, "VALUE", pinteger);
IupSetFloat(param3, "VALUE", preal);
IupSetInt(param5, "VALUE", pinteger2);
IupSetFloat(param6, "VALUE", preal2);
IupSetFloat(param8, "VALUE", pangle);
IupSetAttribute(param9, "VALUE", pstring);
IupSetInt(param10, "VALUE", plist);
IupSetAttribute(param11, "VALUE", pfile_name);
IupSetAttribute(param12, "VALUE", pcolor);
hbox2 = IupHbox(IupLabel("Settings"), IupButton("Extra Button", NULL), NULL);
box = IupVbox(
parambox = IupParamBox(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, NULL),
hbox2,
NULL);
// IupSetCallback(parambox, "PARAM_CB", (Icallback)param_action);
dlg = IupDialog(box);
IupSetAttribute(dlg, "TITLE", "IupParamBox Example");
IupPopup(dlg, IUP_CENTER, IUP_CENTER);
if (IupGetInt(parambox, "STATUS") == 1)
{
pboolean = IupGetInt(param1, "VALUE");
pinteger = IupGetInt(param2, "VALUE");
preal = IupGetFloat(param3, "VALUE");
pinteger2 = IupGetInt(param5, "VALUE");
preal2 = IupGetFloat(param6, "VALUE");
pangle = IupGetFloat(param8, "VALUE");
strcpy(pstring, IupGetAttribute(param9, "VALUE"));
plist = IupGetInt(param10, "VALUE");
strcpy(pfile_name, IupGetAttribute(param11, "VALUE"));
strcpy(pcolor, IupGetAttribute(param12, "VALUE"));
IupMessagef("IupGetParam",
"Boolean Value: %d\n"
"Integer: %d\n"
"Real 1: %g\n"
"Integer: %d\n"
"Real 2: %g\n"
"Angle: %g\n"
"String: %s\n"
"List Index: %d\n"
"FileName: %s\n"
"Color: %s\n",
pboolean, pinteger, (double)preal, pinteger2, (double)preal2, (double)pangle, pstring, plist, pfile_name, pcolor);
}
IupMainLoop();
IupClose();
return EXIT_SUCCESS;
}