Christian Budde wrote:
Ok, just for the records: I tried to do it with TWinForm.CreateParented(ParentWindow: hwnd), but I get an access violation. So that does not work.
I think ParentWindow is very widgetset specific (see below). Probably
it will work cross platform very limited.
Ok, thanks for the information. I'm willing to find a cross platform solution, so I don't necessary need to go that ParentWindow road.
Solution:
It is probably easier to create a wrapper TWinControl / TCustomForm
with the ability to use the foreign Handle.
I just had a look at the wincontrol.inc and I already found this:

{------------------------------------------------------------------------------
 TWinControl CreateParentedControl
------------------------------------------------------------------------------} class function TWinControl.CreateParentedControl(ParentWindow: hwnd): TWinControl;
begin
 // ToDo
 Result:=nil;
end;

Is this what you thought of? I mean it's still pretty "ToDo", but I guess the structure is already there. Now all I need to do is fill it with live. Any ideas?

The main reason it exists is delphi compatebility. Using this function instead of using windows.SetParent has the advantage that the VCL/LCL knows that the parent is not a VCL/LCL control so it can do special things.

I think on win32 for sure and on X or OSX it is doable. However I think it will take loads of time to debug the LCL prevent it to assume that a parent always is a LCL control. And the result will always have less functionality that when it has a real LCL parent. Even in delphi this is the case. So it is a lot of effort for something with limited functionality and limited use. I rather spend my time on other things.

Marc




   Christian

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to