The Change method of the TDBCalendar is called whenever a new date value is set. Change calls the OnChange event handler, if one exists. The component user can write code in the OnChange event handler to respond to changes in the date.
When the calendar date changes, the underlying dataset should be notified that a change has occurred. You can do that by overriding the Change method and adding one more line of code.
type TDBCalendar = class(TSampleCalendar); private procedure Change; override; . . . end;
class PACKAGE TDBCalendar : public TSampleCalendar { protected: virtual void __fastcall Change(); . . . };
procedure TDBCalendar.Change; begin FDataLink.Modified; { call the Modified method } inherited Change; { call the inherited Change method } end;
void __fastcall TDBCalendar::Change() { if (FDataLink != NULL) FDataLink->Modified(); // call the Modified method TSampleCalendar::Change(); // call the inherited Change method }
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|