Hi Giorgio,
Sorry for the late answer...
//______________________________________________________________________
// Compute distance from point px,py to objects in event
Int_t i,j; Int_t dist = 9999; Int_t x = 0, y = 0, px1 = 0, px2 = 0, py1 = 0, py2 = 0;Window_t wtarget;
delete fTip; fTip = 0;
if(fEvent->GetTotal() <= 0) return 0; // Browse every track and get related particle infos. for(i=0;i<fEvent->GetTotal();i++) {
for(j=0;j<fEvent->GetParticle(i)->GetNTracks();j++) { dist = fEvent->GetParticle(i)->GetTrack(j)->DistancetoPrimitive(px, py); if (dist < 2) { gVirtualX->TranslateCoordinates(fEmbeddedCanvas->GetId(), fClient->GetDefaultRoot()->GetId(), px, py, x, y, wtarget); TBox *b = new TBox(x-2, y-2, x+2, y+2); fTip = new TGToolTip(fClient->GetDefaultRoot(), b, fEvent->GetParticle(i)->GetObjectInfo(px, py), 50); fTip->Show(x+12, y+12); delete b; gPad->SetSelected((TObject*)fEvent->GetParticle(i)); fStatusBar->SetText(fEvent->GetParticle(i)->GetObjectInfo(px, py),1); gPad->SetCursor(kPointer); return 0; } }
2) context menu :
It is not possible to change the context menu title for the time being.
We are looking for a solution, and we'll let you know.
3) custom cursors :
In our ToDo list.
Cheers,
Bertrand.
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Giorgio De Nunzio
Sent: Monday, October 03, 2005 9:54 AM
To: roottalk (Mailing list discussing all aspects of the ROOT system)
Subject: [ROOT] User defined cursors, TGTooltips, Context menu titles,
Pointing-down y-axes: my (ROOT) problems exposed...
Hi all, in particular Rene', Valeri and Bertrand, who are kindly helping me (Hope I am forgetting none!!) Sorry for replying so late, but I still have mail problems. In particular, when trying to write to the list I get the msg:
>This is the Postfix program at host cabis.unile.it. >I'm sorry to have to inform you that the message returned below could >not be delivered to one or more destinations....
I have to investigate further. I am now obliged to use another mail server (the Telecom ADSL one), but there again strange things happen..
OK, back to my ROOT questions.
Before all, thanks for your kind interest and help!
All of my present ROOT problems come from the same piece of code...
I have defined a class, TAnnotation, which derives from TEllipse and TString (but the latter can, and will possibly, change): it is an empty circle drawn around an image detail, with a comment to be written somewhere.
Details (figures correspond to the above list).
"Warning: multiple ambiguous inheritance TObject and TX. Cint will not get correct base object address"
I have tried to define a simpler class and try:
class TX : public TEllipse, public TNamed {
public:
TX() : TEllipse(), TNamed() {}
ClassDef(TX ,1)
};
...
ClassImp(TX)
Compiling, I get the aforementioned message. Uh, perhaps I have not even tried to see if the context menu title changed, anyway.
3) Cursors.
I understand very well that this is not a top priority problem, so feel
free to completely neglect it.
I have written this code in my HandleEvent() method:
case kMouseMotion: // shows the different cursors (arrows, cross) cout << "kMouseMotion\n"; if (fLocked) gPad->SetCursor(kHand); // CURSOR CHANGE! else { px1 = gPad->XtoAbsPixel(fX1); py1 = gPad->YtoAbsPixel(fY1); Tx = Bx = px1; ... OMISSIS ... if ((TMath::Abs(px - Tx) < kMaxDiff) && (TMath::Abs(py - Ty) < kMaxDiff)) { // top edge T = kTRUE; gPad->SetCursor(kTopSide); // CURSOR CHANGE! } else if ((TMath::Abs(px - Bx) < kMaxDiff) && (TMath::Abs(py - By) < kMaxDiff)) { // bottom edge B = kTRUE; gPad->SetCursor(kBottomSide); // CURSOR CHANGE! ... OMISSIS ... else { INSIDE = kTRUE; gPad->SetCursor(kMove); // CURSOR CHANGE! } pxold = px; pyold = py; } break; ... OMISSIS ...
The code is taken from TEllipse HandleEvent(), with some modifications.
As you can see, I have set the cursor to kHand when the TEllipse cannot be modified, while as usual kMove, kTopSide, etc are used when fLocked is false and the user can modify the TAnnotation object.
I simply don't like that kHand pattern: I'd like something more informative or nicer, eg a closed padlock. Just as an initial test, I have tried to #include <qcursor.h> but there was no such file. I'll try again and look for it: possibly I have to download Qt separately, or simply use the right path.
4) I have not tried the sample codes sent to me by Rene' yet (thanks!). I remember I had already seen that code, but the inverted axes did not work at the time. It was a dfferent ROOT version. I'll take a look at the source and try to adapt it to my need.
Thanks for your patience in reading all this!
Ciao
Giorgio
Dipartimento di Scienza dei Materiali
Universita' di Lecce
tel. 0832 297084
giorgio.denunzio_at_unile.it
Received on Mon Oct 10 2005 - 10:54:11 MEST
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:12 MET