Re: [ROOT] TGListView::DoubleClicked() problem

From: Bertalan Juhasz (Bertalan.Juhasz@cern.ch)
Date: Fri Jan 11 2002 - 13:16:57 MET


Hi Fons,

>    I made a mistake, could you try:
> 
> fIconBox->Associate(fListView);
> 
> in that case the container forwards its messages to
> TGListVIew::ProcessMessage(), which then will issue the
> correct signals for the container events.

Thanks, that helped! It's a pity that this information is not mentioned in
any example. Don't forget to include it the upcoming GUI manual! :-)

Cheers,

Bertalan


> Juhász Bertalan wrote:
> 
> > Hi Fons,
> > 
> > 
> >>    make sure that after creating the TGLVContainer you associate
> >>the container with the TGListView. In that case the container
> >>events are properly propagated to the TGListView and things should work.
> >>Example:
> >>
> >>    fListView = new TGListView(fV2, 520, 250);
> >>    fIconBox = new TGLVContainer(fListView->GetViewPort(), 520, 250,
> >>                                 kHorizontalFrame, fgWhitePixel);
> >>    fIconBox->Associate(this);
> >>
> > 
> > Thank you, this would be fine but I (and I'm sure other people in the future
> > too) want to use the signal/slot mechanism i.e. connect some signal
> > function which is called when I double-click on an item to one of my slot
> > functions instead of using Associate() and ProcessMessage(). The only signal
> > function I found was TGListView::DoubleClicked(); neither TGLVContainer nor
> > TGFileContainer have such a signal function. So I believe my Connect(...)
> > code below is correct but doesn't work therefore I believe this is a bug in
> > ROOT because the double (and single) click events are apparently not
> > properly propagated to the TGListView _signal_ functions. Or do I have to
> > use Associate() for that? As far as I understood from the example codes I
> > don't need to. I won't be able to use Associate(this) anyway because my
> > class is not inherited from TGMainFrame or any other GUI class therefore it
> > cannot be the argument for Associate(). So I just use
> > 
> > fFileView = new TGListView(fC2,540,180);
> > fFileCont = new TGFileContainer(fFileView->GetViewPort(),100,100,
> >                                 kVerticalFrame,TGFrame::GetWhitePixel());
> > fFileView->Connect("DoubleClicked(TGLVEntry*, Int_t)", "PbarFileBrowser",
> >                    this, "HandleBrowser(TGLVEntry*, Int_t)");
> > 
> > but as I said it doesn't work.
> > 
> > Cheers,
> > 
> > Bertalan
> > 
> > 
> >>Bertalan Juhasz wrote:
> >>
> >>
> >>>Dear Rooters,
> >>>
> >>>I'm developing some GUI classes and I've encountered the following
> >>>problem: even if I connect TGListView::DoubleClicked() to one of my slot
> >>>functions using
> >>>
> >>>fFileView->Connect("DoubleClicked(TGLVEntry*, Int_t)",
> >>>
> > "PbarFileBrowser",
> > 
> >>>this, "HandleBrowser(TGLVEntry*, Int_t)");
> >>>
> >>>the HandleBrowser() function is never called when I double click on an
> >>>item although ROOT is not complaining about wrong signal/slot
> >>>
> > connection.
> > 
> >>>Was I doing something wrong? After digging into and playing with the
> >>>
> > ROOT
> > 
> >>>code I've discovered that HandleBrowser() is never called because
> >>>TGListView::DoubleClicked() is never called, only
> >>>TGLVContainer::HandleDoubleClick(). After I've added the following lines
> >>>to TGLVContainer::HandleDoubleClick()
> >>>
> >>>if (fListView) fListView->DoubleClicked(f, event->fCode);
> >>>if (fListView) fListView->DoubleClicked(f, event->fCode, event->fXRoot,
> >>>event->fYRoot);
> >>>
> >>>right after SendMessage(...) (similarly to TGTreeView) everything worked
> >>>fine but maybe this is a dirty/illegal solution (I'm completely new to
> >>>
> > GUI
> > 
> >>>programming). Most likely TGListView::Clicked() has similar problems but
> >>>that I didn't investigate.
> >>>
> >>>I'm using ROOT 3.02/06 with RedHat 7.2.
> >>>
> >>>BTW, are there plans to write some User's Guide on GUI programming? For
> >>>those how never did anything like that before (like myself) it's a bit
> >>>painful (and dangerous) to learn just by digging through example codes
> >>>(although those codes are quite nice).
> >>>
> >>>Regards,
> >>>
> >>>Bertalan
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>--
> >>Org:    CERN, European Laboratory for Particle Physics.
> >>Mail:   1211 Geneve 23, Switzerland
> >>E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> >>WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
> >>
> >>
> >>
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Org:    CERN, European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23, Switzerland
> E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480
> 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:37 MET