// C code generated by PanelToForm.exe from cgiDemo.uir, (c) 2000 Guillaume Dargaud
#include
#include "cgic.h"
#include "cgiDemo.h"// Link this file with CGIC.C, cgiDemo.UIR and the C file containing the callback functions
void InterpretPanel1(void) {
double D;
int i,I,Invalid;
char *Str, DefaultStr[255], CtrlConst[100];
char *Switch[2]={"0", "1"};
int hpnltest=LoadPanel(0, "cgiDemo.uir", PNLTEST);
char Str5[256]; // Move this line to the top of the function
char* Possible13[]={"0","1","2","3","4"}; // Move this line to the top of the function
int Choices[5]; // Move this line to the top of the function
// 2 Numeric PNLTEST_DIMENSIONS "Dimensions", hot
cgiFormDouble("PNLTEST_DIMENSIONS", &D, 123456);
SetCtrlVal(hpnltest, PNLTEST_DIMENSIONS, D);
CB_Dimensions(hpnltest, PNLTEST_DIMENSIONS, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nDimensions set to %g.
", D);
// 3 Numeric PNLTEST_TEMPERATURE "Temperature (°C)", hot
cgiFormDoubleBounded("PNLTEST_TEMPERATURE", &D, -100, 100, 22);
SetCtrlVal(hpnltest, PNLTEST_TEMPERATURE, D);
CB_Temperature(hpnltest, PNLTEST_TEMPERATURE, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nTemperature (°C) set to %g.
", D);
// 4 Numeric PNLTEST_CONNECTIONS "Connections", hot
cgiFormIntegerBounded("PNLTEST_CONNECTIONS", &I, 1, 10, 4);
SetCtrlVal(hpnltest, PNLTEST_CONNECTIONS, I);
CB_Connections(hpnltest, PNLTEST_CONNECTIONS, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nConnections set to %d.
", I);
// 5 String PNLTEST_NAME "Name", hot
cgiFormStringNoNewlines("PNLTEST_NAME", Str5, 255);
SetCtrlVal(hpnltest, PNLTEST_NAME, Str5);
CB_Name(hpnltest, PNLTEST_NAME, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nName set to \"%s\".
", Str5);
// 6 Textbox PNLTEST_ADDRESS "Address", hot
cgiFormStringSpaceNeeded("PNLTEST_ADDRESS", &I);
Str=(char*)malloc(I);
cgiFormString("PNLTEST_ADDRESS", Str, I);
ResetTextBox(hpnltest, PNLTEST_ADDRESS, Str);
CB_Address(hpnltest, PNLTEST_ADDRESS, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nPNLTEST_ADDRESS set to \"
%s
\".
", Str);
free(Str); Str=NULL;
// 7 Checkbox PNLTEST_ACTIVE "Active", hot
I=(cgiFormCheckboxSingle("PNLTEST_ACTIVE") == cgiFormSuccess);
SetCtrlVal(hpnltest, PNLTEST_ACTIVE, I);
CB_Active(hpnltest, PNLTEST_ACTIVE, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nActive set to %d.
", I);
// 8 Checkbox PNLTEST_LED "Led", indicator
// I=(cgiFormCheckboxSingle("PNLTEST_LED") == cgiFormSuccess);
// SetCtrlVal(hpnltest, PNLTEST_LED, I);
// CB_Led(hpnltest, PNLTEST_LED, EVENT_COMMIT, NULL, 0, 0);
// fprintf(cgiOut, "\nLed set to %d.
", I);
// 9 Switch PNLTEST_STATUS "Status", hot
cgiFormRadio("PNLTEST_STATUS", Switch, 2, &I, 1);
SetCtrlIndex(hpnltest, PNLTEST_STATUS, I);
CB_Status(hpnltest, PNLTEST_STATUS, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nStatus set to %d.
", I);
// 10 Switch PNLTEST_STATE "State", hot
cgiFormRadio("PNLTEST_STATE", Switch, 2, &I, 1);
SetCtrlIndex(hpnltest, PNLTEST_STATE, I);
CB_State(hpnltest, PNLTEST_STATE, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nState set to %d.
", I);
// 12 Ring PNLTEST_MENU "Menu", hot
cgiFormInteger("PNLTEST_MENU", &I, 1436483587); // use index, not value, easier but less secure
SetCtrlIndex(hpnltest, PNLTEST_MENU, I);
CB_Menu(hpnltest, PNLTEST_MENU, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nMenu set to %d.
", I);
// 13 List PNLTEST_SHOPPING "Shoping List", hot
cgiFormCheckboxMultiple("PNLTEST_SHOPPING", Possible13, 5, Choices, &Invalid); // use index, not value
I=0;
for (i=0; i<5; i++) { CheckListItem(hpnltest, PNLTEST_SHOPPING, i, Choices[i]); if (Choices[i]) I++; }
CB_Shopping(hpnltest, PNLTEST_SHOPPING, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nShopping List has %d values selected.
", I);
// 11 Button PNLTEST_VERIFY "Verify", hot
cgiFormStringNoNewlines("PNLTEST_VERIFY", CtrlConst, 100);
CB_Verify(hpnltest, PNLTEST_VERIFY, EVENT_COMMIT, NULL, 0, 0);
fprintf(cgiOut, "\nSubmit button pressed: [Verify].
");
}
int cgiMain (void) {
#ifdef _CVI_DEBUG_
cgiReadEnvironment("capcgi.dat");
#endif
cgiHeaderContentType("text/html");
fprintf(cgiOut, "\n"
"\nPanelToForm and cgic test\n"
"\n\nPanelToForm and cgic test
"
"\nGenerated by PanelToForm.exe, (c) 2000 Guillaume Dargaud
");
InterpretPanel1();
fprintf(cgiOut, "\n\n\n");
return 0;
}