Hello, Let me ask people what they mean "speaking gPad modified" (I had asked this but missed the answer). There could be several different "points of view" 1. One wants to get a signal when some object data-member is changed. It is interesting (and very useful) but it has nothing to do with the GUI, TPad, gPad, TCanvas etc. By this reason I think we should decouple such sort of "modification" of the TPad modification issue. I think TPad itself can not do this. It is difficult to find a generic solution. 2. Some TPad (why gPad ?) modified when its appearance on the "screen" has been changed. My guess many GUI applications would be happy to know very this moment. Now this has nothing to do with the objects those has been appended to the TPad. This moment is well defined by ROOT and can be caught. To change the image of the TPad on the TCanvas screen the method TPad::CopyPixmap is to be called . That in turn calls gVirtualX->CopyPixmap. So TVirtualX::CopyPixmap can signal when the image on the screen is about to be changed. Now we have to split our discussion, create two different brainstorming teams and vote :-). What do most of us are speaking about. Is it case 1) or 2) Myself scare to join the first team and think it would be not too difficult to resolve the second issue. Best regards, Valeri ----- Dr.Valeri Fine STAR/US Atlas E-mail: fine@bnl.gov Brookhaven National Lab Phone: +1 631 344 7806 Upton, NY 11973-5000 FAX: +1 631 344 4206 USA ----- Original Message ----- From: "Brett Viren" <bv@bnl.gov> To: "Frederic Sarazin" <sarazin@triumf.ca> Cc: <roottalk@pcroot.cern.ch>; <D.Bertini@gsi.de> Sent: Thursday, March 14, 2002 1:31 PM Subject: Re: [ROOT] gPad > 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:46 MET