Updates Not Working...

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

Updates Not Working...

Joey Gibson-2
OK, probably dumb question time. I periodically go back through the
PersonalModel tutorial just to refresh my memory (since I don't get to
do St at work, generally). While going through this time, I can't seem
to get the currentBalance presenter to show the updated value when I
change the initialBalance value. The model itself is being updated (if I
inspect the model, I can verify this), but the text field for the
currentBalance won't update until I kill the window and do a new showOn:
on the existing model. (But of course that doesn't count.) I reloaded
the PersonalMoney.pac from the Samples directory, and it does correctly
update. I looked at PersonalAccount and PersonalAccountShell to see what
the differences were, but the only thing I spotted was a class side
method on PersonalAccount called #publishedEventsOfInstances. I then
added that to my model class but nothing changed.

I've created a stripped down example that exhibits the same behavior,
which I've included below (FooModel and FooShell) and I'd be grateful if
someone could take a look and see what I might be missing.

Thanks,
Joey

###
"Filed out from Dolphin Smalltalk 2000 release 4.00"!

Model subclass: #FooModel
        instanceVariableNames: 'fooVal barVal'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
FooModel comment: ''!

FooModel guid: (GUID fromString: '{9D63BEC4-A5E2-4E6C-8BF1-
058289EB8284}')!

!FooModel categoriesForClass!Unclassified! !
!FooModel methodsFor!

barVal
        ^barVal.!

barVal: anObject
        "Set the value of the receiver's ''barVal'' instance variable to
the argument, anObject."

        barVal := anObject.
        self trigger: #barValChanged!

calculateBarVal
        self barVal: fooVal * 10!

fooVal
        "Answer the value of the receiver's ''fooVal'' instance variable."

        ^fooVal!

fooVal: anObject
        "Set the value of the receiver's ''fooVal'' instance variable to
the argument, anObject."
self halt.
        fooVal := anObject.
        self calculateBarVal.! !
!FooModel categoriesFor: #barVal!*-unclassified!public! !
!FooModel categoriesFor: #barVal:!accessing!public! !
!FooModel categoriesFor: #calculateBarVal!*-unclassified!public! !
!FooModel categoriesFor: #fooVal!accessing!public! !
!FooModel categoriesFor: #fooVal:!accessing!public! !

!FooModel class methodsFor!

publishedEventsOfInstances
        "Answer a Set of Symbols that describe the published events
triggered
        by instances of the receiver."

        ^(super publishedEventsOfInstances)
                add: #barValueChanged;
                yourself! !
!FooModel class categoriesFor: #publishedEventsOfInstances!*-
unclassified!public! !

"----------------------------------------"

"Filed out from Dolphin Smalltalk 2000 release 4.00"!

Shell subclass: #FooShell
        instanceVariableNames: 'fooPresenter barPresenter'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
FooShell comment: ''!

FooShell guid: (GUID fromString: '{CB19C2C5-6E52-43E0-A94F-
2CC0E9ADA017}')!

!FooShell categoriesForClass!Unclassified! !
!FooShell methodsFor!

createComponents
        " (AutoGenerated) Create the presenters contained by the
receiver."

        super createComponents.
        "(AutoGenerated on 12:50:12 PM, Monday, July 30, 2001)"
        fooPresenter := self add: NumberPresenter new name: 'foo'.
        barPresenter := self add: NumberPresenter new name: 'bar'.
!

createSchematicWiring
        super createSchematicWiring.
!

model: aFooModel
        super model: aFooModel.
        fooPresenter model: (aFooModel aspectValue: #fooVal).
        barPresenter model: (aFooModel aspectValue: #barVal).

        barPresenter model aspectTriggers: #barValueChanged.! !
!FooShell categoriesFor: #createComponents!*-unclassified!public! !
!FooShell categoriesFor: #createSchematicWiring!*-unclassified!public! !
!FooShell categoriesFor: #model:!*-unclassified!public! !

!FooShell class methodsFor!

defaultModel
        ^FooModel new.! !
!FooShell class categoriesFor: #defaultModel!*-unclassified!public! !



--
-- Sun Certified Java2 Programmer
-- My Pocket Smalltalk Stuff: www.joeygibson.com/st
--
-- "We thought about killin' him, but we kinda
--  hated to go that far...." - Briscoe Darling



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


Reply | Threaded
Open this post in threaded view
|

Re: Updates Not Working...

Ian Bartholomew-4
Joey,

I'm not quite sure why your PersonalMoney fails, as you say the one in the
sample folder works correctly. However the example you posted contains

barVal: anObject
[snipped]
self trigger: #barValChanged

and

model: aFooModel
[snipped]
barPresenter model aspectTriggers: #barValueChanged

which is why this doesn't work. Remove (or add) the "ue" and it updates as
expected.

Another good one, along similar lines, is to use the wrong name for a view
in #createComponents - not matching the name you used in the ViewComposer.
Dolphin doesn't complain and the effect is the same as the above views not
updating when expected.

Ian


Reply | Threaded
Open this post in threaded view
|

Re: Updates Not Working...

Joey Gibson-2
In article <9k488c$2ijla$[hidden email]>, [hidden email]
says...
>
> which is why this doesn't work. Remove (or add) the "ue" and it updates as
> expected.

        I said going into this that it was probably a dumb question. And
indeed it was. I made the change you suggested and it began working.

> Another good one, along similar lines, is to use the wrong name for a view
> in #createComponents - not matching the name you used in the ViewComposer.
> Dolphin doesn't complain and the effect is the same as the above views not
> updating when expected.

        I've been bitten by this one many times. Yea, verily.

Joey

--
-- Sun Certified Java2 Programmer
-- My Pocket Smalltalk Stuff: www.joeygibson.com/st
--
-- "We thought about killin' him, but we kinda
--  hated to go that far...." - Briscoe Darling



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----