Board index » delphi » Relation of Model, Command and Selection
Chau Chee Yang
![]() Delphi Developer |
Relation of Model, Command and Selection2006-04-28 04:28:29 PM delphi55 Hi, I thought I have master the concept of Model, Command and Selection. However, after looking some articles. I found out something unclear: If an interactor trigger the model's command. The command suppose to work on the selection. However, there are chances that the command will refer to model too. Thus, we have this design: TCommand = class private fSelection: ISelection; procedure BindSelection(const Selection: ISelection); public constructor Create(const aModel: IModel); end; If seems redundant for the Command to know both model and selection as the model already know selection. If the command want to work on selection, it can refer to model: (aModel.Selection as IVisited).Accept(TVisitor.Create); Note: aModel is a weak reference in this case. -- Best regards, Chau Chee Yang E Stream Software Sdn Bhd URL: www.sql.com.my SQL Financial Accounting |