wn_switch_relabel_c
status.i4.v = wn_switch_relabel_c(switch_id.i4.v, text.i1a.r, color.i4.v
[,on_funcs.fa.r] [,on_func_data.ga.r]
[,off_func.f.v] [,off_func_data.g.v])
This routine will change the label and/or color of a switch created
by an earlier call to 'wn_switch_create_c'.
switch_id ID of desired switch
(returned by prior call to 'wn_switch_create_c')
text null terminated switch text (Note: For multiline
switch labels, successive lines should be separated
by a space which will not be displayed.)
(If a value of NULL is passed for this argument,
the present text will remain unchanged.)
color switch color (If a value of CLIB_DEFAULT_ARG is
passed for this argument, the switch color will
remain unchanged.)
(constants are in 'cnsparam')
[on_funcs] addresses of functions to be called upon transition
of the switch to an "on" state (one function for
momentary or latching switches or one per switch
for a radio switch) (default is NULL which results
in leaving the previous "on" functions)
(called as follows:
on_funcs(wid.i4.v, on_func_data.g.v, switch_data.s.r)
("switch_data" is a structure of type
SWITCH_ACTION_DATA))
[on_func_data] address of data to be passed to "on_funcs"
(default is NULL which results in leaving the previous
"on_funcs" data)
[off_func] address of function to be called when the switch
is turned off (latching switches only) (default is NULL
which results in leaving the previous "off" function)
(called as follows:
off_func(wid.i4.v, off_func_data.g.v, switch_data.s.r)
("switch_data" is a structure of type
SWITCH_ACTION_DATA))
[off_func_data] address of data to be passed to "off_func"
(default is NULL which results in leaving the previous
"off_func" data)
This function returns ACNET status values as follows:
CBS_OK success
CBS_NO_SUCH switch does not exist
This function requires the following include files:
cnsparam_h, cbslib_h, acnet_errors_h
Related functions:
wn_switch_create_c, wn_switch_delete_c, wn_switch_window_delete_c,
wn_switch_read_c, wn_switch_pressed, wn_switch_enable_c,
wn_switch_disable_c, wn_switch_set_state_c, switch_relabel_c
C/C++ usage:
static const char text[] = "new label";
int status;
int switch_id;
int color = CLIB_DEFAULT_ARG;
void new_on_func(int window_id, void *dummy,
SWITCH_ACTION_DATA *switch_data);
void new_off_func(int window_id, void *dummy,
SWITCH_ACTION_DATA *switch_data);
void (*on_funcs[1])();
void **on_func_data = (void **) NULL;
void *off_func_data = (void *) NULL;
on_funcs[0] = new_on_func;
status = wn_switch_relabel_c(switch_id,text,color,on_funcs,
on_func_data,new_off_func,off_func_data);