Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLMMorphic repeated code blocs #5883

Closed
David5i6 opened this issue Mar 11, 2020 · 0 comments · Fixed by #5884
Closed

GLMMorphic repeated code blocs #5883

David5i6 opened this issue Mar 11, 2020 · 0 comments · Fixed by #5884

Comments

@David5i6
Copy link
Contributor

At GLMMorphic there is this method definition:

togglingButtonLabelled: anObject pressed: aBoolean style: aSymbol
	| button oldLabel m |
	button := SimpleButtonMorph new.
	(oldLabel := button findA: StringMorph) ifNotNil: [ oldLabel delete ].
	m := self morphElement: anObject.
	button
		addMorph: m;
		borderColor: Color transparent.
	(self isAlignmentMorph: m)
		ifTrue:[ 
			button extent: (m width + 6 ) @ (m height + 6 ).
			m position: 3 @ 3 ]
		ifFalse:[ 
			(self isImageMorph: m)
				ifTrue: [ button extent: (m width + 6) @ (m height + 6) ]
				ifFalse:[ button extent: (m width + 6) @ (m height + 6) ].
			m position: 3 @ 3.	"button center - (m extent // 2)" ].
	self styleButton: button morph: m pressed: aBoolean style: aSymbol.
	m lock.
	^ button

The executed code is the same for all if branches.

I'm going to create a pull requeest with reviewed code.

Ducasse added a commit that referenced this issue Mar 27, 2020
fixes: #5883 uses lazy initialization since the initialise since not …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant