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

fix enter/escape behavior on dialogs #1537

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Spec2-Adapters-Morphic/SpMorphicButtonAdapter.class.st
Original file line number Diff line number Diff line change
@@ -175,6 +175,12 @@ SpMorphicButtonAdapter >> newButton [
menu: #menu:
]

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

self widget isDefault: true
]

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

10 changes: 6 additions & 4 deletions src/Spec2-Adapters-Morphic/SpMorphicDialogWindowAdapter.class.st
Original file line number Diff line number Diff line change
@@ -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
]
7 changes: 3 additions & 4 deletions src/Spec2-Dialogs/SpDialogPresenter.class.st
Original file line number Diff line number Diff line change
@@ -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 ]