Direct 3D Window as Child component


#1

Hi Jules,
I have a requirement where in I have to display Direct 3D Window inside a juce component. I Created a Direct 3D Window and made it child component of My component(which is derived from juce component). There are no resize/repaint issues.The problem is I am not able to get any mouse event callbacks…What am I doing wrong…Please help…

This is my code

juce::ComponentPeer* pCompPeer = (juce::ComponentPeer*) (getTopLevelComponent()->getPeer());
	HWND parenthandle = (HWND)(pCompPeer->getNativeHandle());

	if(parenthandle!=NULL)
	{
		bool result =  SetParent(Direct3D_WindowHandle,parenthandle);   
	}

	juce::Component::setBounds(x,y,width,height);
	juce::Component *toplevelcomp = (getTopLevelComponent());
	int newx=x,newy=y;
	relativePositionToOtherComponent(toplevelcomp, newx, newy);

	if(newx!=x && newy !=y)
	{
		SetWindowPos(m_hWnd,HWND_TOP,newx-x ,newy-y ,width,height, SWP_SHOWWINDOW);
	}
	setVisible(true);

#2

Well that’s not surprising - mouse events get delivered to the window that they happen inside, so the events for your d3d window won’t go anywhere near juce’s event handling mechanism… You’d need to give your window a custom event handling proc to catch them and forward them to juce if that’s what you need.


#3

Okay, I will try it out. :slight_smile: