I have some code adapted from the jucer, and I’ve ‘lost’ my mouse clicks. I have:
a tabbed holder, which contains a viewport,
which contains a magnifier, which owns a ‘workspace’, and that has a component that has sub-components I want to click.
Before I added the ‘workspace’ object I did get clicks, and now I don’t. The workspace is set up to not intercept, I think. Sound familiar?
[code]LayoutEditor::LayoutEditor (EncoreVC_Document* document_)
: document (document_),
layout(document_),
firstResize (true)
{
addAndMakeVisible (viewport = new ZoomingViewport (this)); // deals with setting the zoom
workspace = new WorkspaceComponent(3840, 2160);
jassert(workspace != NULL);
viewport->setViewedComponent (magnifier = new MagnifierComponent (workspace, true)); // contains/draws
// subCompHolder is 'in' the workspace, an arbitrary but zoomable space
workspace->addAndMakeVisible (subCompHolder = new SubComponentHolderComp (document, grid));
subCompHolder->setBounds((workspace->getWidth() - 1920) / 2, (workspace->getHeight() - 1080) / 2, 1920, 1080);
// Listen to our layout
layout.getSelectedLayers().addChangeListener (this);
setWantsKeyboardFocus (true);
setZoom (0.4f, subCompHolder->getX(), subCompHolder->getY());
[/code]
and
[code]//==============================================================================
class WorkspaceComponent : public Component
{
public:
WorkspaceComponent (double width, double height)
{
setInterceptsMouseClicks (false, false);
setWantsKeyboardFocus (false);
setBounds(0, 0, width, height);
}
~WorkspaceComponent()
{
}
void paint (Graphics& g)
{
g.fillCheckerBoard (0, 0, getWidth(), getHeight(),
100, 100,
Colour (0xffe0e0e0),
Colours::white);
}
void resized()
{
}
[/code]
Thanks,
Bruce