I have the following code. Every time start_cb() is called with new a set of 
data given. This new set of data is used to draw new graphs, ticks and labels 
for an x-axis. I have damage() called in Minimum() and Maximum(), but it does 
not clear the existing ticks and labels for the new ticks and labels 
corresponding to the new data set. Please give me some advice on what should be 
done. Thanks,

Giau


enum Damage {CA_DAMAGE_ALL=1, CA_DAMAGE_ADD=2};

class Axis: public Fl_Box
{
public:
   void Minimum(double minimum)
   {
       damage(CA_DAMAGE_ALL);
       min = minimum;
   }
   void Maximum(double maximum)
   {
       damage(CA_DAMAGE_ALL);
       max = maximum;
   }
};

class X_Axis: public Axis
{
protected:
    void draw()
    {   ...
        draw x axis with ticks and label
        ...
    };
}

class Graph : public Fl_Gl_Window
{
    X_Axis *x_axis;
    float min, max;
public:
    void Calculate() {... set min and max ...}
    float GetMin(){ return min; }
    float GetMax(){ return max; }
    Graph(....) { x_axis = new X_axis(...); }
}


void start_cb( Fl_Widget* o, void*)
{
    graph->Calculate();
    graph->x_axis->Minimum(graph->GetMin());
    graph->x_axis->Maximum(graph->GetMax());
    graph->x_axis->redraw();
}

in Main()
{
   graph = new Graph(245, 334, 134, 179, "");
}

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

Reply via email to