Re: Lighted Indicator



Here's an example solution of what I think you want. Again, it may not
be the best, but it works.

#include <gtkmm.h>

int main(int argc, char *argv[]) {

        Gtk::Main kit(argc, argv);
        Gtk::Window window;
        Gtk::EventBox evbox;
        Gtk::HBox hbox;
        Gtk::Label label ("Test");
        Gtk::Button button;

        evbox.modify_bg(Gtk::STATE_NORMAL, Gdk::Color("#FF0000"));
        evbox.modify_bg(Gtk::STATE_ACTIVE, Gdk::Color("#FF0000"));
        evbox.modify_bg(Gtk::STATE_PRELIGHT, Gdk::Color("#FF0000"));
        evbox.set_size_request(15);

        hbox.pack_start(evbox,false,false,3);
        hbox.pack_start(label,false,false,3);

        button.add(hbox);

        window.add(button);
        window.show_all();

        Gtk::Main::run(window);
        return 0;
}


BTW, always send to the list :-)

- John

On Tue, Jun 3, 2008 at 3:28 PM,  <inbox_pub earthlink net> wrote:
> Thank you for your reply. All I want is something that looks like  a
> rectangular LED (like the colored portion of the color selection button.
> There is no need for the user to change the color--I only need the color to
> indicate the state of my application. I figured that someone else had
> already done something like what I am looking for. It must be possible since
> it is done in the color selection button.
> Thanks!
>
> John Hobbs wrote:
>
> Could you just pack an EventBox in there and change its background
> color? I'm not on my computer so I can't code and test that real
> quick, but I think it should work.
>
> - John
>
> On Fri, May 30, 2008 at 1:02 PM,  <inbox_pub earthlink net> wrote:
>
>
> My application requires a lighted indicator that changes color: black,
> yellow, red, and green. I implemented it with the color selection
> button. Is there some way to inhibit the selection box from appearing
> when the button is pressed? Or, is there another way to implement a
> lighted indicator that I can change its color from my program?
>
> Thanks!
> _______________________________________________
> 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]