double Yshift = -70;
void cb_yshift(Fl_Widget *) {
Yshift = -y_shift->value();
}
y_shift = new Fl_Line_Dial(x,y,70,70); x += 110;
y_shift->color(0x38697600,FL_BLACK);
y_shift->minimum(-160); y_shift->maximum(160);
y_shift->step(1); y_shift->value(-40);
y_shift->when(FL_WHEN_CHANGED);
y_shift->callback(cb_yshift);
double Ch1Shift = 0;
void cb_ch1_shift(Fl_Widget*,void*) {
Ch1Shift = ch1_shift->value();
}
Fl_Line_Dial *ch1_shift = new Fl_Line_Dial(x,y,40,40);
ch1_shift->minimum(-160); ch1_shift->maximum(160);
ch1_shift->step(1); ch1_shift->value(0);
ch1_shift->when(FL_WHEN_CHANGED);
ch1_shift->callback(cb_ch1_shift);
Hi,
I recently started using FLTK and am most impressed with it, especially the documentation. I've struck a bug that I can't resolve and would much appreciate some assistance. This code works:
double Yshift = -70;
void cb_yshift(Fl_Widget *) {
Yshift = -y_shift->value();
}
y_shift = new Fl_Line_Dial(x,y,70,70); x += 110;
y_shift->color(0x38697600,FL_BLACK);
y_shift->minimum(-160); y_shift->maximum(160);
y_shift->step(1); y_shift->value(-40);
y_shift->when(FL_WHEN_CHANGED);
y_shift->callback(cb_yshift);
This code segfaults:
double Ch1Shift = 0;
void cb_ch1_shift(Fl_Widget*,void*) {
Ch1Shift = ch1_shift->value();
}
Fl_Line_Dial *ch1_shift = new Fl_Line_Dial(x,y,40,40);
I suppose your problem here : you create a new variable
"ch1_shift", but callback uses some outer/global variable having
the same name and not initialized. Just remove "
Fl_Line_Dial *
"