Also, your specifying the owner as a Tcomponent class, then referencing Self as the owner of the instance of the constructor. Self refers to the form which is why it's disappearing. You've got to reference the TWinControl which you chould create a variable for and reference that.
Dave --- On Fri, 8/6/10, Niksen Harjanto <[email protected]> wrote: From: Niksen Harjanto <[email protected]> Subject: [delphi-en] WTA - TDateTimePicker inside TWinControl is invisible To: "delphi-en" <[email protected]> Date: Friday, August 6, 2010, 1:32 AM 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 is my script Constructor Tdtp.Create(AOwner: TComponent); Begin Inherited Create(AOwner); OnResize := OnComponentResize; Height := 23; Width := 121; boolEnabled := True; DateTimePicker1 := TDateTimePicker.Create(Self); DateTimePicker1.Parent := Self; DateTimePicker1.Left := 0; DateTimePicker1.Top := 0; DateTimePicker1.Align := alClient; // DateTimePicker1.Font.Name := 'Verdana'; // Error !!! // DateTimePicker1.Font.Size := 9; // Error !!! Try DateTimePicker1.Font.Name := 'Verdana'; // I made trick in here, and it works Except End; DateTimePicker1.Visible := True; DateTimePicker1.TabStop := True; DateTimePicker1.OnEnter := onDTPEnter; DateTimePicker1.OnExit := onDTPExit; OnComponentResize(Self); DateTimePicker1.OnChange := EventChange; DateTimePicker1.OnClick := EventClick; DateTimePicker1.OnCloseUp := EventCloseUp; DateTimePicker1.OnContextPopup := EventContextPopup; DateTimePicker1.OnDblClick := EventDblClick; DateTimePicker1.OnDragDrop := EventDragDrop; DateTimePicker1.OnDragOver := EventDragOver; DateTimePicker1.OnDropDown := EventDropDown; DateTimePicker1.OnEndDock := EventEndDock; DateTimePicker1.OnEndDrag := EventEndDrag; DateTimePicker1.OnKeyDown := EventKeyDown; DateTimePicker1.OnKeyPress := EventKeyPress; DateTimePicker1.OnKeyUp := EventKeyUp; DateTimePicker1.OnStartDock := EventStartDock; DateTimePicker1.OnStartDrag := EventStartDrag; DateTimePicker1.OnUserInput := EventUserInput; Try DateTimePicker1.Font.Size := 9; // I made trick in here, and it works Except End; End; Thank You..... -- "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 [Non-text portions of this message have been removed]

