Combobox controls can be tricky as some pretty basic initialisations of those controls require that messages be sent to the control which requires that the underlying HWND has been allocated and that in turn requires that the control's parent *also* has a HWND.<div>
<br></div><div>Most often this can trip you up when you initialise these controls in the constructor or OnCreate events of a form - the temptation is to think that if the form has been "created" then there must be a window, right ? But this isn't always the case.</div>
<div><br></div><div>If the code that is causing you trouble is in a form constructor or OnCreate event, try moving it to the OnShow event instead - this will occur only after the form actually has an underlying window. If that solves the problem then window timing is the problem and you should take a closer look at the initialisation required by the control and the best place to perform it.</div>
<div><br></div><div>It may even be that you can simply leave the initialisation to occur in the OnShow event.</div><div><br></div><div>hth</div><div><br><br><div class="gmail_quote">On 6 September 2011 16:39, Vik Vasudev <span dir="ltr"><<a href="mailto:vikas.image@gmail.com">vikas.image@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello Everyone,<br><br>I am getting this "Control has no parent window error" when i try to load a form in insert mode. i mean to say it has datasource assigned to it.<br>
<br><br>I have a Tabsheet with a panel control.<br>
<br>So code snippet like.<br>here Tdemo is derived from TCustomDropDownCheckBox<br><br>X = Tdemo.create (self)<br>X.parent := Panel.<br>.X.datasource = yz;<br><br>Problem is when the dataset is loaded in insert mode at first instance it gives this error. Then when i move to other component and comes back it works fine.<br>
<br>I suspect parent handle is not getting assigned.<br><br>Any help or idea on this be appreciated<br><font color="#888888">-- <br> vikas<br>
</font><br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>