I may be misunderstanding your intentions, but if you are dropping the dtp component on the windowed control at design time you don't need to specify the parent in the constructor; dtp's parent will automatically be the windowed control in which you placed it. So, in your example, if you remove DateTimePicker1.Parent := Self; from your constructor the dtp will be painted on the tabsheet.
If you are creating an instance at runtime, assign the parent along with your other specifications: dtp1.parent:= TabSheet1; dtp1.Left:= 20; etc. . . . . -----Original Message----- From: delphi-en@yahoogroups.com [mailto:delphi...@yahoogroups.com]on Behalf Of Niksen Harjanto Sent: 06 August 2010 11:44 To: delphi-en@yahoogroups.com Subject: Re: [delphi-en] WTA - TDateTimePicker inside TWinControl is invisible I use Self because I want the TDateTimePicker parent is TWinControl. and yes... that TDateTimePicker is "painted" on the Form, not in TWinControl. so... how to set TDateTimePicker parent to TWinControl, not to TForm? My other components works fine with this ("Self"). Thank You On 8/6/10, Wilson, Stephen <stephen.wil...@ipswichhospital.nhs.uk> wrote: > In your Constructor you have: > >>> DateTimePicker1.Parent := Self; > > Take a look at Delphi Help on the Self variable: > > "Within the implementation of a method, the identifier Self references the > object in which the method is called. " > > Perhaps a clearer example here: > > http://delphi.about.com/od/delphiprogrammingglossary/g/self.htm > > Presumably your dtp is created within the form (onCreate, onShow?) ? To > see what's happening, make your tabsheet half the size of its parent form > and drop your dtp near the edge of the tabsheet. > > HTH > S > > > -----Original Message----- > From: delphi-en@yahoogroups.com [mailto:delphi...@yahoogroups.com]on > Behalf Of Niksen Harjanto > Sent: 06 August 2010 09:33 > To: delphi-en > Subject: [delphi-en] WTA - TDateTimePicker inside TWinControl is > invisible > > > Dear all... > > I have created my own custom component. > It used TWinControl as it's "canvas" and a TDateTimePicker on top of it. > > When I dropped onto a TForm, everything was ok. > But if I dropped it onto the TTabSheet (tab in TPageControl), the > TDateTimePicker will visible ONLY WHEN I dropped it. > If I close the application and then re-open it again, the > TDateTimePicker will invisible. > Is this a bug or I made some mistake? > > > *************************************************************************** > > This e-mail and any files transmitted with it are confidential. If you are > not the intended recipient, any reading, printing, storage, disclosure, > copying or any other action taken in respect of this e-mail is prohibited > and may be unlawful. If you are not the intended recipient, please notify > the sender immediately by using the reply function and then permanently > delete what you have received. > > Content of emails received by this Trust will be subject to disclosure > under the Freedom of Information Act 2000, subject to the specified > exemptions, including the Data Protection Act 1998 and Caldicott Guardian > principles. > > This footnote also confirms that, unless otherwise stated, this email > message has been swept by Sophos Anti-virus for the presence of computer > viruses. > > ** Please consider the environment before printing this email. ** > > *************************************************************************** > > > > ------------------------------------ > > ----------------------------------------------------- > Home page: http://groups.yahoo.com/group/delphi-en/ > To unsubscribe: delphi-en-unsubscr...@yahoogroups.comyahoo! Groups Links > > > > -- "Sabbe Satta Bhavantu Sukhitatta - Semoga Semua Makhluk Hidup Berbahagia" Se Hai Ce Nei, Kai Siung Ti Ye - Di Empat Penjuru Lautan, Kita Semua Bersaudara Ko Ko Cay Siang - Yang Tinggi Masih Ada Pula Yang Melebihi Oleh Karena Itu Jangan Takabur, Jumawa, dan Terlalu Berbangga Diri Niksen - Pulsarian Bandung 782 members of KORMOT COMMUNITY KC #008 D 5470 WQ ------------------------------------ ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: delphi-en-unsubscr...@yahoogroups.comyahoo! Groups Links *************************************************************************** This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received. Content of emails received by this Trust will be subject to disclosure under the Freedom of Information Act 2000, subject to the specified exemptions, including the Data Protection Act 1998 and Caldicott Guardian principles. This footnote also confirms that, unless otherwise stated, this email message has been swept by Sophos Anti-virus for the presence of computer viruses. ** Please consider the environment before printing this email. ** ***************************************************************************