Re: Please Help Me



Thank you, John, for your reply!
I already have a program that monitors the creation and close of files in a specific directory.
I want to read the message from a pipe between the GUI and the monitor program and
based on the output, change the color of the window (light). Therefore, after it is initially
displayed in yellow, it can be changed to different colors.

I understand how to make it change based on a button click. I guess that this is more how to connect
outside logic to the GUI that I have written. I just don't quite understand.
----------------------------------------------------------------------------------


John Hobbs wrote:
Are you wanting it to change color when you click on it? Or do you have a button? Or a timeout?

If you want it to change on click do something like...

Example::Example()
{
     m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);
     m_Color_Yellow.set_rgb_p(0.
99, 0.99, 0.00);
     m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);
     m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);


     add(mc_HBox);

     mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);

     m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);

     m_Light1.set_size_request(400, 300);

     m_Light1.signal_button_release_event().connect(sigc::mem_fun(*this,&Example::onClickMLight1));

     mc_HBox.add(m_Light1);

     show_all_children();
}

void Example::onClickMLight1 () {
     m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Green);
}

Does that help any?

- John Hobbs

john velvetcache org


------------------------------------------------------------------------------ #include <gtkmm.h> class Example : public Gtk::Window { public:       Example();       virtual ~Example(); protected:       virtual void on_button_quit();       Gtk::VBox mc_VBox;       Gtk::HBox mc_HBox;       Gdk::Color m_Color_Black, m_Color_Red, m_Color_Green, m_Color_Yellow;       Gtk::EventBox m_Light1, m_Light2, m_Light3; }; Example::Example() {       m_Color_Red.set_rgb_p(0.99, 0.00, 0.00);       m_Color_Yellow.set_rgb_p(0.99, 0.99, 0.00);       m_Color_Green.set_rgb_p(0.00, 0.99, 0.00);       m_Color_Black.set_rgb_p(0.00, 0.00, 0.00);       add(mc_HBox);       mc_HBox.pack_start(mc_VBox, Gtk::PACK_SHRINK, 0);       m_Light1.modify_bg(Gtk::STATE_NORMAL, m_Color_Yellow);       m_Light1.set_size_request(400, 300);       mc_HBox.add(m_Light1);       show_all_children(); } int main(int argc, char *argv[]) {       Gtk::Main kit(argc, argv);       Example window;       Gtk::Main::run(window); return 0; } Example::~Example() { } void Example::on_button_quit() { hide(); } ------------------------------------------------------------------------------ _______________________________________________ gtkmm-list mailing list gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list



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