Q: Is Delphi's DataModule supposed to be able to handle components that aren't derived from TPersistent?
Q: Is Delphi's DataModule supposed to be able to handle components that aren't derived from TPersistent?
I'm refactoring my program to use TFrames under Delphi XE2 Pro. In this process, I've ran into a specific need to have access to TImageList shared among multiple forms.
Immediately, I had a problem adding the TImageList component to the TDataModule with "ClassNotFound". However, a simple Google Search yielded a "fix"...
http://stackoverflow.com/questions/14097246/delphi-xe2-data-module-expects-only-database-components
My Question, is this a hack? Is it a bug that was fixed in later versions of Delphi (XE3 appears to have the same behavior). Outside of actual data-components, I've never really used the DataModule for other types. Is is ok?
Commenting out the following line fixes it for me, but I need to know if this is proper.
{%CLASSGROUP 'System.Classes.TPersistent'}
http://stackoverflow.com/questions/14097246/delphi-xe2-data-module-expects-only-database-components
I'm refactoring my program to use TFrames under Delphi XE2 Pro. In this process, I've ran into a specific need to have access to TImageList shared among multiple forms.
Immediately, I had a problem adding the TImageList component to the TDataModule with "ClassNotFound". However, a simple Google Search yielded a "fix"...
http://stackoverflow.com/questions/14097246/delphi-xe2-data-module-expects-only-database-components
My Question, is this a hack? Is it a bug that was fixed in later versions of Delphi (XE3 appears to have the same behavior). Outside of actual data-components, I've never really used the DataModule for other types. Is is ok?
Commenting out the following line fixes it for me, but I need to know if this is proper.
{%CLASSGROUP 'System.Classes.TPersistent'}
http://stackoverflow.com/questions/14097246/delphi-xe2-data-module-expects-only-database-components
why hack? there is an answer at SO with link to documentation, so this is documented feature:
ReplyDeletehttp://docwiki.embarcadero.com/RADStudio/XE2/en/ClassGroup_pseudo-property_of_TDataModule
you can change xe2 to xe6 (in link): the same bahviour in different versions.
ps: I had the same question with placing TPopupMenu in DataModule.
When you select the datamodule in the Objectinspector there is a property ClassGroup where you can select the proper setting.
ReplyDeleteUwe Raabe ding, ding, ding! We have a winner. Thanks.
ReplyDelete