Sending mouse messages to a hidden juce window


Hi all!

I’ve got a very special problem (as usual : ), and couldn’t find a good solution yet.
Probable the solution very fair and simple with JUCE (like in most cases),
so I ask you for a little help. I made a panel with buttons and sub-panel
(and the latter have other components):

I “hide” this panel (eg.: setTopLeftPosition(scr_width,0)), and capture it’s appearance
by HWND of panel, for a texture of a 3D object. If I “click” with my 3D device, projected
2D positon calculated, and PostMessage(panel_hwnd,WM_LBUTTONDOWN,…) called.
(Yes, I know, this quick and dirty solution could be used for demo purposes, only.
But I want to check a possibility of a “real” 3D-gui : )

It’s working if I pick color (or browse files with another subpanel), but
I can’t click to buttons - except: if part of button is in the screen’s rectangle.
Has anyone any suggestions to click to buttons?




Any reason that you didn’t just use Component::createComponentSnapshot() to grab the image?


Yes: I didn’t discern it. Sorry! :oops: I’ve tried out this, and it’s working wonderfully.
Only a little complement needed for making textures under win32 - like the flipIt at this: )
But I still thinking about accessibility of buttons… :roll: (It would be so amazing for me :slight_smile: )


The “correct” way to handle a component that’s embedded inside something other than a normal window is to write a special ComponentPeer for it. That’s how the MagnifierComponent works - a special peer lets you redirect all the mouse and redrawing to whatever input/output device you need. It’s a bit tricky though, and not as well-documented as the rest of the code because it’s so specialised.


Thank you for the answer! I’m going to look these up.


(And I’m thinking about: why can ColourSelector handle mouseinput in the hidden window, and buttons can’t).


Forwarding mouse events isn’t as simple as it sounds. You need to cope with all the enter/exit events too, which is probably where you’ve gone wrong.