DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1839
Version: 2.0-feature


This is easy to do with the existing functionality.

Make your callback something like this:

void angle_cb(Widget *v, void *ob) 
{
        Dial *sd;


        sd = (Dial*)v;

        float val;
        float angle;

        val = (float) sd->value();

        // Limit values, this makes the dial to rotate without limits
        if(val>0.75) sd->value(val-0.5);
        if(val<0.25) sd->value(val+0.5);

        // Get the range back
        angle = 720 * val;
        if (angle >= 360.0) angle-=360.0;

// Do something with angle

}

When you create the dial you do it like this:

test_dir = new LineDial(505,130,200,200,"Test dial angles");
test_dir->angles(-180,540);
test_dir->value(0.5);
test_dir->callback(angle_cb,this);


Regards
Thor Henning Amdahl


Link: http://www.fltk.org/str.php?L1839
Version: 2.0-feature

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to