How to inherit from the Grids class in Delphi 7? -
here's class inherit tstringgrid class. want create grid populated data database. simple class stub:
unit clstcustomstringgrid; interface uses grids, dialogs; type tcustomstringgrid = class (tstringgrid) public procedure sayhello (); end; implementation procedure tcustomstringgrid.sayhello (); begin showmessage('hello world!'); // procedure body end; end.
this have in main form:
uses ... ... tcustomstringgrid; // here compilation stops ... ... ... procedure tmyform.formshow (sender: tobject); var mysg: tcustomstringgrid; begin mysg := tcustomstringgrid.create(self); mysg.left := 100; mysg.top := 40; mysg.parent := self; mysg.sayhello(); end;
the error get:
file not found: 'tcustomstringgrid.dcu'
please, me figure out doing wrong.
your class declared in unit clstcustomstringgrid;
, uses
clause using tcustomstringgrid
(which class name).
change uses clause:
uses ... ... clscustomstringgrid; ...
Comments
Post a Comment