range widget



I can display the widget but i didnt add any signals and the tutorial is a little confusing.
how would you set the max amount that the widget will go to? and how do you add a signal to the widget?

this is my code thus far for a horizontal range widget ---

#include <gtkmm.h>
using namespace std;

class examp : public Gtk::Window
{
public:
    examp();
    ~examp();
private:
    void on_adjustment_value_changed();

    Gtk::HScale m_HScale;
    Gtk::VScale m_vscale;
    Gtk::HBox top_box, box_num1;
    Gtk::Adjustment m_scale_digits,m_adjustment_digits;
};

examp::examp()
{    m_adjustment_digits(1.0, 0.0, 5.0);
m_adjustment_digits.ssignal_value_changed().connect(sigc::mem_fun(*this, &examp::on_adjustment_value_changed));
    m_scale_digits.set_digits(0);

  m_HScale.set_update_policy(Gtk::UPDATE_CONTINUOUS);
  m_HScale.set_digits(1);
  m_HScale.set_value_pos(Gtk::POS_TOP);
  m_HScale.set_draw_value();
  m_HScale.set_size_request(200, 30);

  add(top_box);
  top_box.pack_start(box_num1);
  box_num1.pack_start(m_HScale);
  show_all_children();
}

examp::~examp()
{}

void examp::on_adjustment_value_changed()
{
    double val = m_adjustment_digits.get_value();
    m_vscale.set_digits((int)val);
    m_HScale.set_digits((int)val);
int main(int argc, char* argv[])
{
    Gtk::Main kit(argc, argv);
    examp example;
    Gtk::Main::run(example);

    return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]