[gtkmm] Scale widget does not call 'on_format_value'



Hi,
 i'm trying to run a simple example. I create a simple window with only a
HScale widget.
I wonder why the signal_format_value() does not work properly. I'm receiving
allways the 'value' 0.
 Any idea?

Here is the code:

class ScaleWindow : public Gtk::Window
{
public:

  ScaleWindow();

protected:

  // Signals
  virtual Glib::ustring on_format_value(double value);

  // Widgets
  Gtk::VScale m_vscale;
};

ScaleWindow::ScaleWindow()
{
  set_title("scale example");
  add(m_vscale);

  m_vscale.set_draw_value();
  m_vscale.set_range(0.0, 5.0);
  m_vscale.set_value_pos(Gtk::POS_RIGHT);

  m_vscale.signal_format_value().connect(
    SigC::slot(*this, &ScaleWindow::on_format_value) );

  show_all_children();
}


Glib::ustring ScaleWindow::on_format_value(double value)
{
  char buffer[10];
  sprintf(buffer, "You choose '%d'", value);
  printf("Value is %d\n", value);
  return Glib::ustring(buffer);
}




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