[quote=“tjstavenger”]I don’t think I’m doing anything too out of the ordinary, but I could be mistaken. Here’s a short snippet that illustrates the TGVerticalFrame -> TGCanvas -> TGVerticalFrame design I currently have:
TGVerticalFrame* mWidget = NULL; // mWidget initialized with the rest of our UI
TGLayoutHints* layout = NULL;
layout = new TGLayoutHints(201, 0, 0, 0, 0);
TGCanvas* mPaletteCanvas = new TGCanvas(mWidget);
mWidget->AddFrame(mPaletteCanvas, layout);
layout = new TGLayoutHints(203, 0, 0, 0, 0);
TGVerticalFrame* mPaletteFrame = new TGVerticalFrame(mPaletteCanvas->GetViewPort(), 500, 300, 0);
mPaletteCanvas->SetContainer(mPaletteFrame);
The mPaletteFrame later gets many buttons & labels added to it that cause the TGCanvas to show a vertical scrollbar. That scrollbar only works with the scroll wheel if the cursor is hovering over the scrollbar. The scroll wheel does not work if the cursor is hovering over the mPaletteFrame. I’ve been trying, unsuccessfully, to get the mPaletteFrame to send its scroll events to the mPaletteCanvas.
If needed, I may be able to break out a working sample that illustrates the behavior.[/quote]
Have a look how it’s done in a TRootCanvas:
[code]Bool_t TRootContainer::HandleButton(Event_t *event)
{
// Directly handle scroll mouse buttons (4 and 5), only pass buttons
// 1, 2 and 3 on to the TCanvas.
TGViewPort vp = (TGViewPort)fParent;
UInt_t page = vp->GetHeight()/4;
Int_t newpos;
gVirtualX->SetInputFocus(GetMainFrame()->GetId());
if (event->fCode == kButton4) {
//scroll up
newpos = fCanvas->fCanvasWindow->GetVsbPosition() - page;
if (newpos < 0) newpos = 0;
fCanvas->fCanvasWindow->SetVsbPosition(newpos);
// return kTRUE;
}
if (event->fCode == kButton5) {
// scroll down
newpos = fCanvas->fCanvasWindow->GetVsbPosition() + page;
fCanvas->fCanvasWindow->SetVsbPosition(newpos);
// return kTRUE;
}
return fCanvas->HandleContainerButton(event);
}[/code]
You can do something like this.