f



Help with subclass of Dialog please

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




0
Graham
12/2/2009 2:24:31 PM
comp.lang.smalltalk.dolphin 3769 articles. 0 followers. Post Follow

5 Replies
294 Views

Similar Articles

[PageSpeed] 5

Hi,

Try:

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

Regards,
Bruno
0
Bruno
12/2/2009 3:27:05 PM
On 2 dic, 13:27, Bruno Buzzi Brasesco <bruno.brase...@gmail.com>
wrote:
> Hi,
>
> Try:
>
> widthPresenter value: (aDiscModel width).
> lengthPresenter value: (aDiscModel length).
> profilePresenter value: (aDiscModel profile).
>
> Regards,
> Bruno

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

It depends on what you want...

Regards,
Bruno

0
Bruno
12/2/2009 3:32:51 PM
"Bruno Buzzi Brasesco" <bruno.brasesco@gmail.com> wrote in message 
news:4f020c93-ab63-4193-91e9-15e34bc8b505@p19g2000vbq.googlegroups.com...
> Hi,
>
> Try:
>
> widthPresenter value: (aDiscModel width).
> lengthPresenter value: (aDiscModel length).
> profilePresenter value: (aDiscModel profile).
>
> Regards,
> Bruno
>


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) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




0
Graham
12/2/2009 3:36:56 PM
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
0
Bruno
12/2/2009 3:45:58 PM
"Bruno Buzzi Brasesco" <bruno.brasesco@gmail.com> wrote in message 
news:13949870-15ea-4629-83e7-a52ef2b208c8@j9g2000vbp.googlegroups.com...
> 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
>

Thats it! Great - thanks Bruno. Merry Christmas!

Graham



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

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




0
Graham
12/2/2009 3:51:48 PM
Reply: