Re: Widget help needed...



Ok,

Now i have another problem. The widget that i'm monitoring is enclosed
in an object, so i need to make the alarm available only to this object
scope. I dont know how to do this since the Gtk wheel is global.

Yet another question, i need an event that tells me that thar widget is
no longer visible so i can remove the alarm, any one recomended??

Thank you

On Wed, 2003-05-21 at 05:06, muppet wrote:
On Tue, 2003-05-20 at 19:40, Bruno Tavares wrote:
I need a way to know if a widget has been visible for more than X
seconds.
Any sugestions. ( an event or sgnal would be great :) )


there's no such timer so far as i know, but it's easy to catch the
widget becoming visible and install a timeout for however many
milliseconds you want.  for example:


      $widget = ....->new...;

      $widget->signal_connect (map_event => sub {
              # this sub will be called when the window is
              # initially mapped, which is X-speak for "shown."
              Glib::Timeout->add ($nmilliseconds, sub {
                              # widget has been visible for 
                              # $nmilliseconds, do something about it.
                              0; # return false so we don't run again
                              });
              0;
              });

      $widget->show;

      # go on about your business....


i chose map-event rather than map because (so far as i can tell)
map-event is the one that gets called *after* the window is visible.




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