Skip to content

Commit

Permalink
Merge pull request #1537 from pharo-spec/dev-3.0
Browse files Browse the repository at this point in the history
fix enter/escape behavior on dialogs
  • Loading branch information
estebanlm authored Apr 10, 2024
2 parents 987e0b9 + ce7e32a commit aab7b6b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/Spec2-Adapters-Morphic/SpMorphicButtonAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ SpMorphicButtonAdapter >> newButton [
menu: #menu:
]

{ #category : 'accessing' }
SpMorphicButtonAdapter >> setAsDefault [

self widget isDefault: true
]

{ #category : 'factory' }
SpMorphicButtonAdapter >> setWidgetColor: button [

Expand Down
10 changes: 6 additions & 4 deletions src/Spec2-Adapters-Morphic/SpMorphicDialogWindowAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ SpMorphicDialogWindowAdapter >> addPresenterIn: widgetToBuild withSpecLayout: aS

super addPresenterIn: widgetToBuild withSpecLayout: aSpec.
self model buttons ifNotEmpty: [
widgetToBuild setToolbarFrom: [ self buildButtonBar ] ]
widgetToBuild setToolbarFrom: [ self buildButtonBar ].
self presenter defaultButton
ifNotNil: [ :aButton | aButton adapter setAsDefault ] ]
]

{ #category : 'factory' }
SpMorphicDialogWindowAdapter >> buildButtonBar [

| buttonBar |

buttonBar := (SpButtonBarPresenter owner: self model) placeAtEnd.
self model buttons do: [ :buttonPresenter |
buttonBar add: buttonPresenter ].
self model buttons
do: [ :buttonPresenter | buttonBar add: buttonPresenter ].

^ buttonBar
]
Expand Down
7 changes: 3 additions & 4 deletions src/Spec2-Dialogs/SpDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ SpDialogPresenter >> icon: aForm [

{ #category : 'initialization' }
SpDialogPresenter >> initializeDialogWindow: aDialogWindowPresenter [

aDialogWindowPresenter
okAction: acceptAction;
cancelAction: cancelAction.

acceptAction ifNotNil: [ aDialogWindowPresenter okAction: acceptAction ].
cancelAction ifNotNil: [ aDialogWindowPresenter cancelAction: cancelAction ].

self parentWindow
ifNotNil: [ :w | aDialogWindowPresenter centeredRelativeTo: w ]
Expand Down

0 comments on commit aab7b6b

Please sign in to comment.