Hello people,
I hope you can help me. It is a very simple problem I have and I'm actually embarresed bring it up. I'm trying to link a simple model to it view/presenter pair. Now I can get it to work sometimes on the most basic models but sometimes not. I think I've got a blind spot and it's starting to drive me round the bend. Thanks for you help. My model has one instance variable number holding 'an integer'. My presenter is called TransactionShell. The sub-presenter is called numberPresenter. This is the code: createComponent "Create the presenters contained by the receiver" super createComponents. numberPresenter := self add: NumberPresenter new name: 'number' model: aTransaction "Set the model associated with the receiver" super model: aTransaction. numberPresenter model: ( aTransaction aspectValue: #number) Class method: defaultModel ^Transaction new Now when I execute' TransactionShell' show in a workspace I get the following error message: 21:27:40, 13 September 2001: 'UndefinedObject does not understand #model:' UndefinedObject(Object)>>doesNotUnderstand: TransactionShell>>model: TransactionShell(Presenter)>>on: TransactionShell class(Presenter class)>>on: TransactionShell class(Presenter class)>>new TransactionShell class(Shell class)>>create: TransactionShell class(Presenter class)>>create TransactionShell class(Presenter class)>>show UndefinedObject>>{unbound}doIt CompiledExpression>>value: SmalltalkWorkspace>>evaluateRange:ifFail:debug: SmalltalkWorkspace>>evaluateRange:ifFail: SmalltalkWorkspace>>displayIt Symbol>>forwardTo: [] in Command>>value BlockClosure>>ifCurtailed: BlockClosure>>ensure: Command>>value SmalltalkWorkspaceDocument(Shell)>>performCommand: CommandQuery>>perform DelegatingCommandPolicy(CommandPolicy)>>route: [] in ShellView(View)>>onCommand: BlockClosure>>ifCurtailed: BlockClosure>>ensure: Cursor>>showWhile: ShellView(View)>>onCommand: ShellView(View)>>wmCommand:wParam:lParam: ShellView(View)>>dispatchMessage:wParam:lParam: [] in InputState>>wndProc:message:wParam:lParam:cookie: BlockClosure>>ifCurtailed: ProcessorScheduler>>callback:evaluate: InputState>>wndProc:message:wParam:lParam:cookie: ShellView>>translateAccelerator: ShellView>>preTranslateKeyboardInput: ShellView(View)>>preTranslateMessage: InputState>>preTranslateMessage: InputState>>pumpMessage: InputState>>loopWhile: InputState>>mainLoop [] in InputState>>forkMain ExceptionHandler(ExceptionHandlerAbstract)>>markAndTry [] in ExceptionHandler(ExceptionHandlerAbstract)>>try: BlockClosure>>ifCurtailed: BlockClosure>>ensure: ExceptionHandler(ExceptionHandlerAbstract)>>try: BlockClosure>>on:do: [] in BlockClosure>>newProcess Jaskooner |
Jaskooner,
> createComponent > "Create the presenters contained by the receiver" > super createComponents. > numberPresenter := self add: NumberPresenter new name: 'number' Your #createComponents method is called #createCompent (singular). Unless it's a typo in your post, adding the s should fix it. Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
"Bill Schwab" <[hidden email]> wrote in message news:<9nr76g$9gs2p$[hidden email]>...
> Jaskooner, > > > createComponent > > "Create the presenters contained by the receiver" > > super createComponents. > > numberPresenter := self add: NumberPresenter new name: 'number' > > Your #createComponents method is called #createCompent (singular). Unless > it's a typo in your post, adding the s should fix it. > > Have a good one, > > Bill If that doesn't solve it, do you actually have a getter and setter in your model called #number and #number: - you try to connect to those in your #model: method Ted |
Thank you for you reply Bill and Ted,
The problem was I created createComponent (singular) rather than createComponents (plural) and not see it. I do this from time to time unfortunetly. Another wee prob that very similar. I have my model instance variable number linked to my numberPresenter linked to my view (This is a very simple example just to get the mechanism into my head). The problem I have is to update my numberPresenter when the model instance variable number changes. I have tried nearly every example I have browsed for event triggers etc but I am making a obvious mistake somewhere. Here is my code. model number: aInteger "Set the value of receivers number instance to the argument, aIntger" number := aInteger. self trigger: #numberChange presenter createComponents super createComponents. enterNumberPresenter := self add: NumberPresenter new name: 'enterNumberPresenter'. createSchematicWiring self model when: #numberChange send: #myNumberChange to: self myNumberChange enterNumberPresenter value: (self model number) Thats it. Appreciate your help jaskooner"Ted Bracht" <[hidden email]> wrote in message news:[hidden email]... > "Bill Schwab" <[hidden email]> wrote in message news:<9nr76g$9gs2p$[hidden email]>... > > Jaskooner, > > > > > createComponent > > > "Create the presenters contained by the receiver" > > > super createComponents. > > > numberPresenter := self add: NumberPresenter new name: 'number' > > > > Your #createComponents method is called #createCompent (singular). Unless > > it's a typo in your post, adding the s should fix it. > > > > Have a good one, > > > > Bill > > If that doesn't solve it, do you actually have a getter and setter in > your model called #number and #number: - you try to connect to those > in your #model: method > > Ted |
> I have my model instance variable number linked to my numberPresenter
> linked to my view (This is a very simple example just to get the mechanism > into my head). > > The problem I have is to update my numberPresenter when the model instance > variable number changes. I have tried nearly every example I have browsed > for event triggers etc but I am making a obvious mistake somewhere. I can't see anything obviously in error in you code, although #createSchematicWiring should reall do a super send first but it's absence won't matter in this case. There is one method that you haven't mentioned, your Presenter class>>defaultModel method? Along those lines, you are sure that the Presenter's model is an instance of your Model class and that this is the instance whose #number instance variable you are changing. One other thing to check is that you've used exactly the same name for the NumberPresenter in the #createComponents method and for the NumberPresenter resource when you created the view in the ViewComposer. A different name doesn't raise any errors but just results in the view never being updated when expected. Ian |
Hi
I manged to solve the problem. It wasn't major just a problem in my logic. Thanks for your help. Jas "Ian Bartholomew" <[hidden email]> wrote in message news:9o0hia$a2jmo$[hidden email]... > > I have my model instance variable number linked to my numberPresenter > > linked to my view (This is a very simple example just to get the mechanism > > into my head). > > > > The problem I have is to update my numberPresenter when the model instance > > variable number changes. I have tried nearly every example I have browsed > > for event triggers etc but I am making a obvious mistake somewhere. > > I can't see anything obviously in error in you code, although > #createSchematicWiring should reall do a super send first but it's absence > won't matter in this case. > > There is one method that you haven't mentioned, your Presenter > class>>defaultModel method? Along those lines, you are sure that the > Presenter's model is an instance of your Model class and that this is the > instance whose #number instance variable you are changing. > > One other thing to check is that you've used exactly the same name for the > NumberPresenter in the #createComponents method and for the > resource when you created the view in the ViewComposer. A different name > doesn't raise any errors but just results in the view never being updated > when expected. > > Ian > > > > |
Free forum by Nabble | Edit this page |