Component with a native window backing it?


#1

Hi all -

I need a component with an actual window (NSView or UIView) backing it; what is the correct way to approach this?

 

Thanks!


#2

NSViewComponent?


#3

Yes, I assumed that.

What I did was have a SomeComponent : public NSViewComponent() ...

But the SomeComponent's native handle is the same as its parent... something is wonky with how I'm using it, I think.


#4

That class doesn't do anything until you actually give it an NSView to hold.


#5

OK.  So what is the right way to go about having a Component which has a real window backing it?  I know that a DocumentWindow has such a window, but are there other components I could use for the purpose or do I have to roll my own?

What I want is a plain component whose handle I can give to an OS function


#6

What I see is that a component which is a child of another component ends up using the parent's peer instead of its own.  I need it to keep its own peer


#7

Maybe what you need is to use a normal component and use addToDesktop to add it to a parent window?


#8

Hi, again -

That seems to work, sort of.   But the component now draws in an odd location.  How can I make it be the size of the parent component?

I tried setBounds("0,0,parent.width,parent.height") but it seems to not be happy.  However, we are getting closer...


#9

Something seems to be going on with mapping coordinates; (0,0) is towards the bottom of the window on the left, and if I give a coordinate of (0,-400) for the top-left, the embedded window goes up.

Does this make any sense to you?