Board index » delphi » Re: Binding Commands and their views

Re: Binding Commands and their views


2006-06-02 08:24:13 PM
delphi27
"Joao Morais" <XXXX@XXXXX.COM>a écrit dans le message de news:
447f9e8e$XXXX@XXXXX.COM...
| Following the MVP concept, how should I bind a command instance and the
| control that triggers such command?
In Delphi for Win32, I simply attach a handler in the Command to the OnClick
event of the control.
| I would thought about a view that holds the control, a model that holds the
| command, and a presenter; or a smart view that holds the control, knows
| what to do when the control is triggered, but both approaches didn't
| sound coherent to me.
Command/UI interaction does not need a models or presenters as you are only
really "listening" for a single input "pulse".
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
 
 

Re: Binding Commands and their views

Joanna Carter [TeamB] writes:
Quote
"Joao Morais" <XXXX@XXXXX.COM>a écrit dans le message de news:
447f9e8e$XXXX@XXXXX.COM...

| Following the MVP concept, how should I bind a command instance and the
| control that triggers such command?

In Delphi for Win32, I simply attach a handler in the Command to the OnClick
event of the control.
Yeah, quite simple and perfect, thanks. it is working now.
Please, another hint - my application has tons of commands that should
be triggered by a MenuItem of the MainForm.Menu. I wouldn't like to
include all of them into the Main Presentation unit, but make this
association via <SomeUnit>'s initialization section instead. How it
sounds, and what is your suggestion about this implementation?
Thank you,
Joao Morais
 

Re: Binding Commands and their views

"Joao Morais" <XXXX@XXXXX.COM>a écrit dans le message de news:
44840ded$XXXX@XXXXX.COM...
| Please, another hint - my application has tons of commands that should
| be triggered by a MenuItem of the MainForm.Menu. I wouldn't like to
| include all of them into the Main Presentation unit, but make this
| association via <SomeUnit>'s initialization section instead. How it
| sounds, and what is your suggestion about this implementation?
It is doubtful whether "tons" of commands would all apply to the same
business class. The idea of MVP, and other means of separating logic, is
that you do not attempt to place everything in the same place.
Also there is a difference between Commands as part of MVP and managing
application workflow. I'd suggest that you look at the idea of "manager"
or "scenario" classes that model concepts like Order Management, Customer
Management, etc. Possibly think about "Work Area" as a concept.
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer
 

Re: Binding Commands and their views

Joanna Carter [TeamB] writes:
Quote
"Joao Morais" <XXXX@XXXXX.COM>a écrit dans le message de news:
44840ded$XXXX@XXXXX.COM...

| Please, another hint - my application has tons of commands that should
| be triggered by a MenuItem of the MainForm.Menu. I wouldn't like to
| include all of them into the Main Presentation unit, but make this
| association via <SomeUnit>'s initialization section instead. How it
| sounds, and what is your suggestion about this implementation?

It is doubtful whether "tons" of commands would all apply to the same
business class. The idea of MVP, and other means of separating logic, is
that you do not attempt to place everything in the same place.
Ok, in this case 'tons' means more than I'd like to place in the
same presenter, but I can be wrong (i.e. isn't so much, isn't in the
right place, etc.). This is the main form of an application that will
have links to several other forms.
Quote
Also there is a difference between Commands as part of MVP and managing
application workflow. I'd suggest that you look at the idea of "manager"
or "scenario" classes that model concepts like Order Management, Customer
Management, etc. Possibly think about "Work Area" as a concept.
Interesting, I will have a look. If you have some links, they'll be very
much appreciated.
Thank you,
Joao Morais