BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Binding Commands and their views

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Joao Morais
Guest





PostPosted: Fri Jun 02, 2006 4:17 am    Post subject: Binding Commands and their views Reply with quote



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





PostPosted: Fri Jun 02, 2006 1:16 pm    Post subject: Re: Binding Commands and their views Reply with 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.

| 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





PostPosted: Mon Jun 05, 2006 3:56 pm    Post subject: Re: Binding Commands and their views Reply with quote



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





PostPosted: Mon Jun 05, 2006 4:11 pm    Post subject: Re: Binding Commands and their views Reply with 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.

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





PostPosted: Mon Jun 05, 2006 4:51 pm    Post subject: Re: Binding Commands and their views Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.