Hi Fred,
Changing the value of gPad doesn't set/clear any Modified flag, so
IsModified() isn't expected to change.
With the way things currently exist, I don't see any general way to
fix ROOT to allow for a signal to be emitted when the current pad
changes. This is because, for all intents, "gPad" is a global
variable.
[ It is actually a CPP macro which expands to a static method of the
TVirtualPad class which maintains the actual "currentPad" pointer.
It looks like "gPad" used to be a simple pointer itself, but was
hacked to its current state in order to deal with threads. ]
Ideally, "gPad" would be a smart pointer (ref counted handle). In
this case, it could easily be modified to emit a signal when
operator=() is used. Changing to this design now would break legions
of user code.
However, what *could* be done at least is to emit a signal from inside
TPad::cd(). This would let you be notifed of a pad change initiated
by an explicit cd(), however, you wouldn't get notice when a pad
changes like so:
void switch_to_pad(TPad* mypad)
{
gPad = mypad;
}
Regards,
-Brett.
Frederic Sarazin writes:
>
> Dear ROOTers,
>
> I have a question concerning the method: gPad->IsModified()...
>
> Let's say that I've got a canvas with 4 subpads and gPad points to one
> of them.
> The command gPad->IsModified() returns (const unsigned char 0). Now, if
> I click
> on an other pad (or use the cd command) and enter the command
> gPad->IsModified(),
> I get (const unsigned char 0) again.
>
> What I think is that gPad->IsModified() happens to be (const unsigned
> char 1) just after
> the pointer gPad has been changed and then goes back to 0 (perfect to
> generate a signal !),
> but I don't know how to test this.
> But maybe I'm completly wrong and in fact, gPad->IsModified() goes to 1
> when something
> new has been attached to/painted to/removed from the active pad ! In
> this case, can anyone tell me
> if a specific method exists to tell the user when the address of gPad
> has changed (in order to
> generate a signal/an interruption).
>
> Thanks for your help,
>
> Fred
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:45 MET