PushMenuCheck
//---------------------------------------------------------
// PushMenuRadio & PushMenuCheck example
// LABPP 2023
//---------------------------------------------------------
int iMenu1, iMenu11, iIconPushRadio, iMenu2, iIconPushCheck;
int main()
{
int ires;
ac_request("clearmessagewindow");
// Create Dialog
var_by_txt("init", "iDialog_DS", "int", "global", 0);
int x, y, w, h, offset;
object("create", "ts_dialog", iDialog_DS);
x = 0; y = 0; w = 250; h = 160;
ts_dialog(iDialog_DS, "init_dialog", "palette", x, y, w, h);
ts_dialog(iDialog_DS, "eventreaction", "Event_PanelCloseRequested", "Event_PanelCloseRequested_DS");
ts_dialog(iDialog_DS, "set_as_main_panel");
ts_dialog(iDialog_DS, "SetGrowType", 3);
ts_dialog(iDialog_DS, "SetTitle", "PushMenuRadio & PushMenuCheck Test");
x = 10; w = 40; y = 10; h = 40;
object("create", "ts_dialogcontrol", iMenu1);
ts_dialogcontrol(iMenu1, "init_control", "PushMenuRadio", iDialog_DS, x, y, w, h, 1);
ts_dialogcontrol(iMenu1, "SetItemCount", 3);
string iconpath = "c:\\";
ts_dialogcontrol(iMenu1, "SetItemIcon", 1, iconpath + "files\\outlineonleft.png");
ts_dialogcontrol(iMenu1, "settooltip", "Задание линии ячейки:");
ts_dialogcontrol(iMenu1, "SetToolTipItem", 1, "Левый край");
ts_dialogcontrol(iMenu1, "SetItemIcon", 2, iconpath + "files\\outlineontop.png");
ts_dialogcontrol(iMenu1, "SetToolTipItem", 2, "Верхний край");
ts_dialogcontrol(iMenu1, "SetItemIcon", 3, iconpath + "files\\outlineonright.png");
ts_dialogcontrol(iMenu1, "SetToolTipItem", 3, "Правый край");
ts_dialogcontrol(iMenu1, "eventreaction", "Event_PushMenuChanged","Event_PushMenuChanged_DCName_DS");
ts_dialogcontrol(iMenu1, "SetAnchorToPanelResize", 0, 1, 0, 0);
x = 50; w = 40; y = 10; h = 40;
object("create", "ts_dialogcontrol", iMenu11);
ts_dialogcontrol(iMenu11, "init_control", "PushMenuRadio", iDialog_DS, x, y, w, h, 1);
ts_dialogcontrol(iMenu11, "SetItemCount", 3);
ts_dialogcontrol(iMenu11, "settooltip", "Выборка по цвету пола:");
ts_dialogcontrol(iMenu11, "SetItemIcon", 1, iconpath + "files\\floor.png");
ts_dialogcontrol(iMenu11, "SetToolTipItem", 1, "Светлый пол");
ts_dialogcontrol(iMenu11, "SetItemIcon", 2, iconpath + "files\\floors.png");
ts_dialogcontrol(iMenu11, "SetToolTipItem", 2, "Средние тона");
ts_dialogcontrol(iMenu11, "SetItemIcon", 3, iconpath + "files\\floors_group.png");
ts_dialogcontrol(iMenu11, "SetToolTipItem", 3, "Темный пол");
ts_dialogcontrol(iMenu11, "SetAnchorToPanelResize", 0, 1, 0, 0);
x = 90; w = 40; y = 10; h = 40;
object("create", "ts_dialogcontrol", iIconPushRadio);
ts_dialogcontrol(iIconPushRadio, "init_control", "IconPushRadio", iDialog_DS, x, y, w, h, 1);
ts_dialogcontrol(iIconPushRadio, "settooltip", "Задать высоту ячейки");
ts_dialogcontrol(iIconPushRadio, "SetIcon", iconpath + "files\\cell_height.png");
ts_dialogcontrol(iIconPushRadio, "SetAnchorToPanelResize", 0, 1, 0, 0);
x = 140; y = 18; w = 100; h = 24;
var_by_txt("init", "iRadioButton_DCName_DS", "int", "global", 0);
object("create", "ts_dialogcontrol", iRadioButton_DCName_DS);
int igroup = 1;
ts_dialogcontrol(iRadioButton_DCName_DS, "init_control", "RadioButton", iDialog_DS, x, y, w, h, 1);
ts_dialogcontrol(iRadioButton_DCName_DS, "settooltip", "Пропустить выполнение команды");
ts_dialogcontrol(iRadioButton_DCName_DS, "SetText", "Пропустить");
ts_dialogcontrol(iRadioButton_DCName_DS, "Select");
x = 10; w = 40; y = 85; h = 40;
object("create", "ts_dialogcontrol", iMenu2);
ts_dialogcontrol(iMenu2, "init_control", "PushMenuCheck", iDialog_DS, x, y, w, h);
ts_dialogcontrol(iMenu2, "SetItemCount", 4);
ts_dialogcontrol(iMenu2, "settooltip", "Показать отчет в:");
ts_dialogcontrol(iMenu2, "SetItemIcon", 1, iconpath + "files\\edit.png");
ts_dialogcontrol(iMenu2, "SetToolTipItem", 1, "Редактор текста");
ts_dialogcontrol(iMenu2, "SetItemIcon", 2, iconpath + "files\\EditPRGitem.png");
ts_dialogcontrol(iMenu2, "SetToolTipItem", 2, "Редактор программ");
ts_dialogcontrol(iMenu2, "SetItemIcon", 3, iconpath + "files\\пути_excel.png");
ts_dialogcontrol(iMenu2, "SetToolTipItem", 3, "Excel");
ts_dialogcontrol(iMenu2, "SetItemIcon", 4, iconpath + "files\\LABPP_BIM_Master.png");
ts_dialogcontrol(iMenu2, "SetToolTipItem", 4, "BIM Master");
ts_dialogcontrol(iMenu2, "SetAnchorToPanelResize", 0, 1, 0, 0);
ts_dialogcontrol(iMenu2, "eventreaction", "Event_PushMenuChanged", "Event_PushMenuChanged_DCName_DS");
x = 50; w = 40; y = 84; h = 41;
object("create", "ts_dialogcontrol", iIconPushCheck);
ts_dialogcontrol(iIconPushCheck, "init_control", "IconPushCheck", iDialog_DS, x, y, w, h);
ts_dialogcontrol(iIconPushCheck, "settooltip", "Показать отчет в BIM Master");
ts_dialogcontrol(iIconPushCheck, "SetIcon", iconpath + "files\\LABPP_BIM_Master.png");
ts_dialogcontrol(iIconPushCheck, "SetAnchorToPanelResize", 0, 1, 0, 0);
bool bres;
bres = ts_dialog(iDialog_DS, "invoke", bres);
return 0;
}
int Event_PanelCloseRequested_DS(int iDescr, string sDescr)
{
int ires = tsalert(-3, "Message", "Are you sure you want to close the panel?", "", "Ok", "Cancel");
if (ires == 1)
{
return 0; // Allow panel to close;
}
else
{
return -1; // No close panel
}
}
// Events
int Event_PushMenuChanged_DCName_DS(int iDescr, string sDescr)
{
if (sDescr == "iMenu1"){
bool bSelected;
ts_dialogcontrol(iMenu1, "IsSelected", bSelected);
coutvar << bSelected;
bool bSelectionChanged;
ts_dialogcontrol(iMenu1, "GetNamedEventValue","WasSelectionChange", bSelectionChanged);
coutvar << bSelectionChanged;
int iPreviousMenuItem;
ts_dialogcontrol(iMenu1, "GetNamedEventValue","PreviousMenuItem", iPreviousMenuItem);
coutvar << iPreviousMenuItem;
}
if (sDescr == "iMenu2") {
bool bChecked;
ts_dialogcontrol(iMenu2, "GetCheck", bChecked);
coutvar << bChecked;
bool bStateChanged;
ts_dialogcontrol(iMenu2, "GetNamedEventValue", "WasStateChange", bStateChanged);
coutvar << bStateChanged;
int iPreviousMenuItem;
ts_dialogcontrol(iMenu2, "GetNamedEventValue", "PreviousMenuItem", iPreviousMenuItem);
coutvar << iPreviousMenuItem;
}
}