I have a view that as soon as it is launches all of my fields are
populated with "a deafObject". If I try to type into the field, the text disappears as soon as the field loses focus. What is this "error" trying to tell me? Thanks, David B. |
"David B" <[hidden email]> wrote in message
news:[hidden email]... >I have a view that as soon as it is launches all of my fields are > populated with "a deafObject". If I try to type into the field, the > text disappears as soon as the field loses focus. What is this "error" > trying to tell me? I am not sure exactly what is happening in your case. The MVP implementation in Dolphin uses an instance of DeafObject as a place holder for views before they are created. A DeafObject will effectively ignore most messages sent to it by returning itself. It sounds like you may be trying to interact with the views too early. I believe that the model: method can be evaluated before the views have been created, perhaps you are using views there. You could throw a self halt wherever you are setting the fields that become DeafObjects and see what is happening in the debugger. If you are trying to use views too soon you could either try using the presenters instead, or put the code that requires the views in the onViewOpened method. If you still have trouble it may be helpful if you could post a little code so we can see exactly what you are doing. Chris |
In reply to this post by David B
David,
> I have a view that as soon as it is launches all of my fields are > populated with "a deafObject". If I try to type into the field, the > text disappears as soon as the field loses focus. What is this "error" > trying to tell me? Just a hunch, but look for mismatches between view names specified in #createComponents and those in the view resource. Another possibility is that you might have missed a super send somewhere in the presenter. For the latter, #createComponents, #createSchematicWiring, #model:, #onViewOpened, etc., will generally super-send. Which version are you using? What is your model? Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Dr. Schwab,
I checked my #createComponents view names and compared them to the View resource names and there were no mismatches. I have also all of the super statements in #createComponents, #createSchematicWiring, and #model:. I am using Dolphin 5.1 Value Edition. I'm not that familiar with all of the terms with Smalltalk. When you say model are you referring to the class i am using that is a child of class Model, or are you referring to something else tied to MVP? If you are referring to the class Model, i have created a subclass of Model called Account. I have a view called MPBankingShell that presents the name, address, city/state/zip, phone, etc of the Account class. I have looked through my code and I don't see how posting my code maybe able to help, but I will provide it below: Class MPBankingShell createComponents super createComponents. lastNamePresenter := self add: TextPresenter new name: 'lastName'. firstNamePresenter := self add: TextPresenter new name: 'firstName'. middleInitialPresenter := self add: TextPresenter new name: 'middleInitial'. address1Presenter := self add: TextPresenter new name: 'address1'. address2Presenter := self add: TextPresenter new name: 'address2'. cityPresenter := self add: TextPresenter new name: 'city'. statePresenter := self add: TextPresenter new name: 'state'. zipPresenter := self add: TextPresenter new name: 'zip'. homePhonePresenter := self add: TextPresenter new name: 'homePhone'. workPhonePresenter := self add: TextPresenter new name: 'workPhone'. SSNPresenter := self add: TextPresenter new name: 'SSN'. passwordPresenter := self add: TextPresenter new name: 'password'. accountNumberPresenter := self add: TextPresenter new name: 'accountNumber'. initialBalancePresenter := self add: NumberPresenter new name: 'initialBalance'. transactionsPresenter := self add: ListPresenter new name: 'transactions'. currentBalancePresenter := self add: NumberPresenter new name: 'currentBalance'. createSchematicWiring super createSchematicWiring. transactionsPresenter when: #actionRequested send: #editTransaction to: self. model: aAccount super model: aAccount. lastNamePresenter model: (aAccount aspectValue: #lastName). firstNamePresenter model: (aAccount aspectValue: #firstName). middleInitialPresenter model: (aAccount aspectValue: #middleInitial). address1Presenter model: (aAccount aspectValue: #address1). address2Presenter model: (aAccount aspectValue: #address2). cityPresenter model: (aAccount aspectValue: #city). statePresenter model: (aAccount aspectValue: #state). zipPresenter model: (aAccount aspectValue: #zip). homePhonePresenter model: (aAccount aspectValue: #homePhone). workPhonePresenter model: (aAccount aspectValue: #workPhone). SSNPresenter model: (aAccount aspectValue: #SSN). passwordPresenter model: (aAccount aspectValue: #password). accountNumberPresenter model: (aAccount aspectValue: #accountNumber). initialBalancePresenter model: (aAccount aspectValue: #initialBalance). currentBalancePresenter model: (aAccount aspectValue: #currentBalance) aspectTriggersUpdates. transactionsPresenter model: (aAccount transactions). David B. |
David B wrote:
> model: aAccount > > super model: aAccount. > lastNamePresenter model: (aAccount aspectValue: #lastName). > firstNamePresenter model: (aAccount aspectValue: #firstName). > middleInitialPresenter model: (aAccount aspectValue: #middleInitial). ... etc... If all your subpresenters are showing a deaf object, then one possibility is that that's because #model has been called with a DeafObject as its parameter. If so, then probably the easiest way to find the problem is to put a breakpoint in #model: (aAccount isKindOf: DeafObject) ifTrue: [self halt]. I don't immediately see why you should be getting a DeafObject as your model. During the early phases of initialising an MVP triad, the /view/ is a DeafObject, but there is no stage where the model is (by default). It's possible that you are sending a message to the view early in the startup (not very likely, but possible) and that will always answer the DeafObject itself (that's how DeafObject is defined). If you are somehow using the answer as your model then that would explain it. It's worth double checking /all/ the methods in your Presenter class that override a superclass method (they'll be flagged with an upward-pointing triangle/arrow in the method list), to ensure that all necessary super-sends are happening. Problems like this are virtually always caused by a forgotten super-send, so even if you have checked once, it's worth checking again ;-) -- chris |
Free forum by Nabble | Edit this page |