How to dissect TimePresenter ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
acg
Reply | Threaded
Open this post in threaded view
|

How to dissect TimePresenter ?

acg
Hello
 I was exploring DatePresenter and TimePresenter. After exploring these
classed, I ask myself, 'How would one start to develop the model, view,
and presenter for this type of 'elementary presenter' ?.

After browsing DatePresener and TimePresenter classes, I can not 'see'
how the functionalities are tied together.

For example, there are no instance or class variables, no instance
methods and only a class #icon method in class TimePresenter.

Looking at 'inhereted methods' did not help my understanding. In
TimePresenter, were does 'check box', 'up button' or 'down button' come
from ? In DatePresenter were does 'calender' come from ? The View
Composer and Resource Browsers and Class Browsers give me no clue how
or were to start understanding these type of presenters.

A little guidance please. Thanks.
ACG


Reply | Threaded
Open this post in threaded view
|

Re: How to dissect TimePresenter ?

Schwab,Wilhelm K
acg wrote:

> Hello
>  I was exploring DatePresenter and TimePresenter. After exploring these
> classed, I ask myself, 'How would one start to develop the model, view,
> and presenter for this type of 'elementary presenter' ?.
>
> After browsing DatePresener and TimePresenter classes, I can not 'see'
> how the functionalities are tied together.
>
> For example, there are no instance or class variables, no instance
> methods and only a class #icon method in class TimePresenter.
>
> Looking at 'inhereted methods' did not help my understanding. In
> TimePresenter, were does 'check box', 'up button' or 'down button' come
> from ? In DatePresenter were does 'calender' come from ? The View
> Composer and Resource Browsers and Class Browsers give me no clue how
> or were to start understanding these type of presenters.
>
> A little guidance please. Thanks.

Is there a specific reason you care about DatePresenter and
TimePresenter, or did you simply pick them as an example?  You are
trying to apply common sense to a Microsoft product; that rarely works
out :)

OA has done a nice job of hiding the chaos of the offending Windows
widget, which create all of the elements you mention, and connects them
too.  The trick is this case is to create the control with the correct
options and to hook up an appropriate type converter, and to make it all
fit into MVP despite itself.

That is a long way around to saying that this is a poor example to
follow if you are trying to learn how to create composite presenters.
If you are trying to learn how to force fit a goofy control into MVP,
then you have found a nice place to start.

Does that help?

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


acg
Reply | Threaded
Open this post in threaded view
|

Re: How to dissect TimePresenter ?

acg
Bill Schwab wrote:
> acg wrote:
> > Hello
> >  I was exploring DatePresenter and TimePresenter. After exploring these
> > classed, I ask myself, 'How would one start to develop the model, view,
> > and presenter for this type of 'elementary presenter' ?...


Hello Bill
  Thanks for the speedy reply. I chose DatePresenter and TimePresenter
because they were so different from any composite presenters that I
have made. I used to the smalltalk statement that 'everything is
available and open', except primitives of course.

After using ST/V and VW dialects, I was examining those two class out
of curiosity. It has be said 'any code written by man, can be broken by
man', but I could not figure how to start on those two classes. I guess
I look to 'typeconverter' to see how things are 'hidden'

Thanks, for this and anyother comment
ACG


Reply | Threaded
Open this post in threaded view
|

Re: How to dissect TimePresenter ?

Schwab,Wilhelm K
acg wrote:

> Bill Schwab wrote:
>
>>acg wrote:
>>
>>>Hello
>>> I was exploring DatePresenter and TimePresenter. After exploring these
>>>classed, I ask myself, 'How would one start to develop the model, view,
>>>and presenter for this type of 'elementary presenter' ?...
>
>
>
> Hello Bill
>   Thanks for the speedy reply. I chose DatePresenter and TimePresenter
> because they were so different from any composite presenters that I
> have made. I used to the smalltalk statement that 'everything is
> available and open', except primitives of course.
>
> After using ST/V and VW dialects, I was examining those two class out
> of curiosity. It has be said 'any code written by man, can be broken by
> man', but I could not figure how to start on those two classes. I guess
> I look to 'typeconverter' to see how things are 'hidden'

The type converter is only part of it.  The date/time picker is a
shining example of how _not_ to design software; OA has done a great job
of hiding the details.

There are some tutorials on creating composite presenters, and those
will probably be a much better place to start than date/time.  Note that
beginners always complain that MVP is difficult to understand.  Then
comes an awakening after which one can't understand why it was so hard
last week, or so it seems.

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: How to dissect TimePresenter ?

Chris Uppal-3
In reply to this post by acg
acg wrote:

> I chose DatePresenter and TimePresenter
> because they were so different from any composite presenters that I
> have made.

It may be worth pointing out that those two Presenters' default Views are /not/
compound.  They directly wrap the "primitive" Windows control, and that
control, although it looks compound, is not so as far as any Smalltalk code is
concerned.

If you look at the View class, DateTimePicker, you'll see the code to wrap the
underlying Windows control.  Since that control is able to display both dates
and times, Dolphin uses instances of that View class (differently configured)
for the view resources for both kinds of presenter.

See:
    http://windowssdk.msdn.microsoft.com/en-us/library/ms672136.aspx
for a description of that Windows control, and for descriptions of the other
Windows controls.  Some of the others (but not all) are also used by Dolphin --
indeed just about all the components that come "in the box" with Dolphin are
implemented in that way.  (MoenTreeView is the only real exception, I think).

I'm not sure that I agree with Bill that the Windows date-time control is
"goofy" (at least, not fundamentally so -- it certainly has its little
quirks...).  But anyway, this way of using Windows controls to provide the View
for one or more kinds of Presenter is pretty central to the design of MVP.
It's the fact that the OS provides entire GUI components, plus a desire to use
those components (instead of implementing everything as raw graphics), which
makes classical MVC inappropriate or impossible.

    -- chris


acg
Reply | Threaded
Open this post in threaded view
|

Re: How to dissect TimePresenter ?

acg
Chris Uppal wrote:
...> It may be worth pointing out that those two Presenters' default
Views are /not/

> compound.  They directly wrap the "primitive" Windows control, and that
> control, although it looks compound, is not so as far as any Smalltalk code is
> concerned.
>
> If you look at the View class, DateTimePicker, you'll see the code to wrap the
> underlying Windows control.  Since that control is able to display both dates
> and times, Dolphin uses instances of that View class (differently configured)
> for the view resources for both kinds of presenter.
>
> See:
>     http://windowssdk.msdn.microsoft.com/en-us/library/ms672136.aspx
> for a description of that Windows control, and for descriptions of the other
> Windows controls. ..

Hi Chris
  Thanks for the references. I was trying to learn how Dolphin wraps a
Windows control, and had no plan to modify TimePresenter or
DatePresenter as such.  After looking at the code examples in MSDN, I
remember why I don't like to code in C/C++

Thanks again
ACG