vg4->canvas->switch_get()
Get whether switch is ON or OFF.
SYNTAX
VG_BOOL
vg4->canvas->switch_get(struct VG_Canvas *cvas, const char *iname)
FUNCTION PARAMETERS
cvas | Canvas |
iname | Name of switch |
RETURN VALUE
Returns boolean:
- VG_TRUE: is ON
- VG_FALSE: is OFF
DESCRIPTION
Get whether switch is ON or OFF.
See section CV-SWITCH in vg4->canvas->load().
EXAMPLE
/* execute canvas, check for clicking the OK-button and get value of the switch */ struct VG_Canvas *cvas; const char *selname; VG_BOOL bval; /* load canvas containing a switch named "sw1" and an OK-button named "apply" */ [...] for (;;) { /* execute canvas */ if (!vg4->canvas->exec(cvas, NULL, &selname)) { VG_dest(); exit(1); } if (selname == NULL) { break; } /* cancelled */ /* act according to selection */ if (strcmp(selname, "apply") == 0) { /* OK-button selected */ /* get value of switch */ bval = vg4->canvas->switch_get(cvas, "sw1"); [...] break; } }
SEE ALSO