Hier habe ich eine gute Erklaerung für den Unterschied zwischen TTabControl und TPageControl gefunden:
www.experts-exchange...lphi/Q_21491670.html
Well, what's the difference between TTabControl and TPageControl? Here's a quote from Delphi help:
"Unlike a page control, TTabControl is not made up of several pages that contain different controls. Instead, TTabControl is a single object. When the current tab changes, the tab control must directly update its contents to reflect the change in an OnChange event handler."
So if you use TTabControl, you don't have to make a TMemo for *each* tab, it should be enough with 1 TMemo. In this case you'll have to update contents of memo when user changes tab.
If you use TPageControl, then each page can contain it's own TMemo component.
This is why TPageControl takes more resources than TTabControl does
Here's an example with TPageControl..
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
| ------ creating of new page var tab : TTabSheet; begin tab := TTabSheet.Create(nil); tab.Caption := format('tab &%d', [PageControl1.PageCount + 1]); tab.InsertControl(TMemo.Create(nil)); TMemo(tab.Controls[0]).Text := format('TMemo component in tab Nr. %d',[PageControl1.PageCount + 1]); tab.PageControl := PageControl1; end;
------ accessing TMemo in selected page begin TMemo(PageControl1.ActivePage.Controls[0]).PasteFromClipboard; end; |
Moderiert von
Christian S.: Delphi-Tags hinzugefügt