Re: Is widget in Notebook visible



Tristan Van Berkom wrote:

> On Thu, Sep 2, 2010 at 11:03 AM, Jeffrey Barish
> <jeff_barish earthlink net> wrote:
>> I have a custom widget that resides on a page of a notebook.  I would
>> like for the widget to be able to detect by itself when it becomes
>> visible or invisible (as the user selects pages of the notebook).  The
>> expose-event tells me when the widget becomes visible, but I can't find a
>> corresponding event that tells me the converse.  Likewise, the
>> visibility-notify-event tells me only when the widget becomes visible,
>> not the converse.  Any suggestions?
> 
> Firstly if its a custom widget of your making and needs to run code..
> it should generally not connect to signals on its own class... instead you
> should implement the appropriate methods on the class directly.
> 
> A widget's visibility status is not exactly what you are looking for
> (A widget's "visible" flag is TRUE if the client code wants the widget
> to be visible... whether its on a page that is mapped or not).
> 
> You will (most probably) want to implement ->map() and ->unmap() in
> your custom widget class to detect if its actually shown or not.

Thanks.  map/unmap did the trick.

How to I implement appropriate methods directly?  Is this where the "do_" 
methods come in?  I tried do_map_event and do_unmap_event, but they don't 
get called.  Ah, do_map gets called, but then doesn't do anything.  do_unmap 
does not get called.  I'm just guessing here.
-- 
Jeffrey Barish



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