Super Simple GUI example?

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

Super Simple GUI example?

Griff-2
Hi,

I am trying to create a super simple GUI sample. I've got two classes,
a shell and a model.
I am doing something wrong here. Anyone care to take a look and see
what is wrong?

Regards.

start pac
---------------------------------
| package |
package := Package name: 'Super Simple GUI'.
package paxVersion: 1;
        basicComment: 'This is a super simple example of how to use the
MVP framework.'.


package classNames
        add: #SuperSimpleModel;
        add: #SuperSimpleShell;
        yourself.

package binaryGlobalNames: (Set new
        yourself).

package globalAliases: (Set new
        yourself).

package setPrerequisites: (IdentitySet new
        add: '..\Documents and Settings\617933\My Documents\Dolphin Smalltalk
X6\Object Arts\Dolphin\Base\Dolphin';
        add: '..\Documents and Settings\617933\My Documents\Dolphin Smalltalk
X6\Object Arts\Dolphin\MVP\Base\Dolphin MVP Base';
        add: '..\Documents and Settings\617933\My Documents\Dolphin Smalltalk
X6\Object Arts\Dolphin\MVP\Presenters\Text\Dolphin Text Presenter';
        add: '..\Documents and Settings\617933\My Documents\Dolphin Smalltalk
X6\Object Arts\Dolphin\MVP\Type Converters\Dolphin Type Converters';
        yourself).

package!

"Class Definitions"!

Model subclass: #SuperSimpleModel
        instanceVariableNames: 'firstName'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
Shell subclass: #SuperSimpleShell
        instanceVariableNames: 'firstNamePresenter'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!

"Global Aliases"!


"Loose Methods"!

"End of package definition"!

"Source Globals"!

"Classes"!

SuperSimpleModel guid: (GUID fromString:
'{A47283BE-061D-4594-B406-48D874E97F7F}')!
SuperSimpleModel comment: ''!
!SuperSimpleModel categoriesForClass!Unclassified! !
!SuperSimpleModel methodsFor!

displayOn: aStream
        self firstName displayOn: aStream.!

firstName
        ^firstName.!

firstName: aString
        firstName := aString.!

initialize
        firstName := 'First name goes here'!

printOn: aStream
        self basicPrintOn: aStream.
        aStream nextPut: $(.
        self firstName displayOn: aStream.
        aStream nextPut: $).! !
!SuperSimpleModel categoriesFor: #displayOn:!public! !
!SuperSimpleModel categoriesFor: #firstName!public! !
!SuperSimpleModel categoriesFor: #firstName:!public! !
!SuperSimpleModel categoriesFor: #initialize!public! !
!SuperSimpleModel categoriesFor: #printOn:!public! !

SuperSimpleShell guid: (GUID fromString:
'{E52F7150-7390-4458-8C28-CDEBEEF0E266}')!
SuperSimpleShell comment: ''!
!SuperSimpleShell categoriesForClass!Unclassified! !
!SuperSimpleShell methodsFor!

createComponents
        super createComponents.
        firstNamePresenter := self add: TextPresenter new name: 'firstName'!

defaultModel
        ^SuperSimpleModel new.!

model: aSuperSimpleModel
        super model: aSuperSimpleModel.
        firstNamePresenter model: (aSuperSimpleModel aspectValue:
#firstName).! !
!SuperSimpleShell categoriesFor: #createComponents!public! !
!SuperSimpleShell categoriesFor: #defaultModel!public! !
!SuperSimpleShell categoriesFor: #model:!public! !

!SuperSimpleShell class methodsFor!

defaultView
        "Answer the literal data from which the 'defaultView' resource can be
reconstituted.
        DO NOT EDIT OR RECATEGORIZE THIS METHOD.

        If you wish to modify this resource evaluate:
        ViewComposer openOn: (ResourceIdentifier class: self selector:
#resource_defaultView)
        "

        ^#(#'!!STL' 3 788558 10 ##(Smalltalk.STBViewProxy)  8
##(Smalltalk.ShellView)  98 27 0 0 98 2 27131905 131073 416 0 524550
##(Smalltalk.ColorRef)  8 4278190080 0 551 0 0 0 416 0 234 256 98 2 410
8 ##(Smalltalk.TextEdit)  98 16 0 416 98 2 8 1140916352 1025 560 0 482
8 4278190080 0 7 0 0 0 560 0 8 4294903441 852486
##(Smalltalk.NullConverter)  0 0 1 983302 ##(Smalltalk.MessageSequence)
 202 208 98 3 721670 ##(Smalltalk.MessageSend)  8 #createAt:extent: 98
2 328198 ##(Smalltalk.Point)  173 41 850 761 41 560 786 8
#selectionRange: 98 1 525062 ##(Smalltalk.Interval)  3 1 3 560 786 8
#isTextModified: 98 1 32 560 983302 ##(Smalltalk.WINDOWPLACEMENT)  8
#[44 0 0 0 0 0 0 0 1 0 0 0 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 86 0 0 0 20 0 0 0 210 1 0 0 40 0 0 0] 98 0 850 193
193 0 27 8 'firstName' 0 0 0 0 0 1 0 0 0 0 1 0 0 722 202 208 98 2 786
816 98 2 850 2559 21 850 991 211 416 786 8 #updateMenuBar 98 0 416 1026
8 #[44 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 4 0 0 10 0 0 0 238 6 0 0 115 0 0 0] 98 2
560 410 8 ##(Smalltalk.StaticText)  98 16 0 416 98 2 8 1140850944 1
1328 0 0 0 7 0 0 0 1328 0 8 4294903373 690 0 0 0 722 202 208 98 2 786
816 98 2 850 31 41 850 121 41 1328 786 8 #text: 98 1 8 'First Name'
1328 1026 8 #[44 0 0 0 0 0 0 0 1 0 0 0 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 15 0 0 0 20 0 0 0 75 0 0 0 40 0 0 0] 98
0 1088 0 27 1088 0 27 )! !
!SuperSimpleShell class categoriesFor:
#defaultView!public!resources-views! !

"Binary Globals"!


---------------------------------
end pac


Reply | Threaded
Open this post in threaded view
|

Re: Super Simple GUI example?

Griff-2
When I saved the resource name, I manually entered "defaultView" rather
than leave it with the default. That was the problem!