Re: range widget



On Wed, 2007-10-24 at 13:12 -0400, Tralfas D wrote:
> okay i included all of that and heres what i got the only problem is
> that it fails at runtime
> #include
> 
> <gtkmm.h>
> 
> using
> 
> namespace std;
> 
> class
> 
> examp : public Gtk::Window 
> 
> {
> 
> public
> 
> : 
> 
> examp();
> 
> ~examp();
> 
> private
> 
> : 
> 
> Gtk::HScale m_HScale;
> 
> Gtk::HBox top_box, box_num1;
> 
> Gtk::Adjustment m_adj;
> 
> };
> 
> examp::examp(): 
> 
> m_adj(0.0,0.0,5.0), 
> 
> m_HScale(m_adj)
> 
> { 
> 
> 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()
> 
> {}
> 
> int
> 
> main(int argc, char* argv[]) 
> 
> {
> 
> Gtk::Main kit(argc, argv);
> 
> examp example;
> 
> Gtk::Main::run(example);
> 
> return 0; 
> 
> }

#include <gtkmm.h>

class examp : public Gtk::Window {

public:

     examp();
    ~examp() { }

private:

    Gtk::Adjustment m_adj;
    Gtk::HScale     m_hscale;
};

examp::examp()
 :  m_adj(0.0,0.0,5.0),
    m_hscale(m_adj)
{

    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(m_hscale);
    show_all_children();
}

int main(int argc, char** argv)
{
    Gtk::Main kit(argc, argv);

    examp example;
    Gtk::Main::run(example);
}

I suggest you to turn on warnings on g++ with -Wall and -Wextra

s.



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