Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with subclass of Dialog please

0 views
Skip to first unread message

Graham Dicker

unread,
Dec 2, 2009, 9:24:31 AM12/2/09
to
Hi everyone

I have forgotten how to arrange for a subclass of dialog to pass input
values to a model and then display the results. I have a dialog that has
some numeric fields which are inputs and some other numeric fields that are
outputs and there is a button the user clicks that should cause the dialog
to pass the inputs to the model and then have the outputs updated. The model
is called a DiscModel and the Presenter is called DiscDialog and in the
createComponents I have

super createComponents.
outerPresenter := self add: NumberPresenter new name: 'outer'.
innerPresenter := self add: NumberPresenter new name: 'inner'.
anglePresenter := self add: NumberPresenter new name: 'angle'.
widthPresenter := self add: NumberPresenter new name: 'width'.
lengthPresenter := self add: NumberPresenter new name: 'length'.
profilePresenter := self add: NumberPresenter new name: 'profile'.

the first three are inputs and the second three are outputs.

and in the model: method of the presenter I have put:

model: aDiscModel

"Set the model associated with the receiver."

| aspectBuffer |
super model: aDiscModel.

aspectBuffer := self model.
outerPresenter model: (aspectBuffer aspectValue: #outer).
innerPresenter model: (aspectBuffer aspectValue: #inner).
anglePresenter model: (aspectBuffer aspectValue: #angle).
widthPresenter model: (aDiscModel width).
lengthPresenter model: (aDiscModel length).
profilePresenter model: (aDiscModel profile).

but the values in the fields are not updating properly

Thanks

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4654 (20091202) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


Bruno Buzzi Brasesco

unread,
Dec 2, 2009, 10:27:05 AM12/2/09
to
Hi,

Try:

widthPresenter value: (aDiscModel width).
lengthPresenter value: (aDiscModel length).
profilePresenter value: (aDiscModel profile).

Regards,
Bruno

Bruno Buzzi Brasesco

unread,
Dec 2, 2009, 10:32:51 AM12/2/09
to
On 2 dic, 13:27, Bruno Buzzi Brasesco <bruno.brase...@gmail.com>
wrote:

Or:
widthPresenter model: (aDiscModel width asValue).
lengthPresenter model: (aDiscModel length asValue).
profilePresenter model: (aDiscModel profile asValue).

It depends on what you want...

Regards,
Bruno

Graham Dicker

unread,
Dec 2, 2009, 10:36:56 AM12/2/09
to

"Bruno Buzzi Brasesco" <bruno.b...@gmail.com> wrote in message
news:4f020c93-ab63-4193...@p19g2000vbq.googlegroups.com...


Thanks Bruno, but no it still doesn't update. Should I have something called
createSchematicWiring or something to trigger updates in the "Calculate"
button handler?

Graham

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4655 (20091202) __________

Bruno Buzzi Brasesco

unread,
Dec 2, 2009, 10:45:58 AM12/2/09
to
Hi,

> Thanks Bruno, but no it still doesn't update. Should I have something called
> createSchematicWiring or something to trigger updates in the "Calculate"
> button handler?

If the inputs are changed and the you need to recalculated it, then
you need:
createSchematicWiring
super createSchematicWiring.
outerPresenter when: #valueChanged send: #updateOutputs to: self.
innerPresenter when: #valueChanged send: #updateOutputs to: self.
anglePresenter when: #valueChanged send: #updateOutputs to: self.

updateOutputs
model doSomeStuff.
widthPresenter value: (model width).
lengthPresenter value: (model length).
profilePresenter value: (model profile).

Every time you modify any of outerPresenter, innerPresenter ,
anglePresenter the #updateOutputs should be triggered.

Regards,
Bruno

Graham Dicker

unread,
Dec 2, 2009, 10:51:48 AM12/2/09
to

"Bruno Buzzi Brasesco" <bruno.b...@gmail.com> wrote in message
news:13949870-15ea-4629...@j9g2000vbp.googlegroups.com...

Thats it! Great - thanks Bruno. Merry Christmas!

0 new messages