 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Joao Morais Guest
|
Posted: Fri Jun 02, 2006 4:17 am Post subject: Binding Commands and their views |
|
|
Hello,
(First of all, sorry about this probable reintroduced thread, I couldn't
upload some apparently interesting messages before Dec/2005 from this ng.)
Following the MVP concept, how should I bind a command instance and the
control that triggers such command?
I'd 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.
Hints?
Thanks,
--
Joao Morais |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Fri Jun 02, 2006 1:16 pm Post subject: Re: Binding Commands and their views |
|
|
"Joao Morais" <morais (AT) laserpress (DOT) srv.br> a écrit dans le message de news:
447f9e8e$1 (AT) newsgroups (DOT) borland.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'd 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 |
|
| Back to top |
|
 |
Joao Morais Guest
|
Posted: Mon Jun 05, 2006 3:56 pm Post subject: Re: Binding Commands and their views |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | "Joao Morais" <morais (AT) laserpress (DOT) srv.br> a écrit dans le message de news:
447f9e8e$1 (AT) newsgroups (DOT) borland.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's 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 |
|
| Back to top |
|
 |
Joanna Carter [TeamB] Guest
|
Posted: Mon Jun 05, 2006 4:11 pm Post subject: Re: Binding Commands and their views |
|
|
"Joao Morais" <morais (AT) laserpress (DOT) srv.br> a écrit dans le message de news:
44840ded$1 (AT) newsgroups (DOT) borland.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 would 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 |
|
| Back to top |
|
 |
Joao Morais Guest
|
Posted: Mon Jun 05, 2006 4:51 pm Post subject: Re: Binding Commands and their views |
|
|
Joanna Carter [TeamB] wrote:
| Quote: | "Joao Morais" <morais (AT) laserpress (DOT) srv.br> a écrit dans le message de news:
44840ded$1 (AT) newsgroups (DOT) borland.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 would 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 would 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'll have a look. If you have some links, they'll be very
much appreciated.
Thank you,
--
Joao Morais |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|