Skip to content

Fix message box missing a close button on Windows#2556

Merged
zcbenz merged 2 commits into
electron:masterfrom
etiktin:fix_msg_box_no_close_btn
Aug 25, 2015
Merged

Fix message box missing a close button on Windows#2556
zcbenz merged 2 commits into
electron:masterfrom
etiktin:fix_msg_box_no_close_btn

Conversation

@etiktin

@etiktin etiktin commented Aug 22, 2015

Copy link
Copy Markdown
Contributor

This resolves #2293.

The issue was that on Windows the close button (the X in the dialog's border) was visible only if cancelId wasn't 0. This is weird, because it means that no dialog that contains a single button will ever have a close button (e.g. the alert dialog). The OS X and Linux implementation doesn't do that. So I changed the Windows code, to always show the close button.

I added two additional small changes:

  • Changed alert to always return undefined instead of 0 (the index of the OK button), so it will comply with the spec (or at least how most browsers choose to implement it).
  • Explicitly set the cancelId for confirm to 1. The button on index 1 is Cancel and according to the documentation cancelId will automatically be set to it in the Windows and OS X implementation. This change makes sure that Linux will use the same cancelId.

@etiktin etiktin changed the title Fix message box don't have a close button on Windows Fix message box missing a close button on Windows Aug 22, 2015
@zcbenz

zcbenz commented Aug 25, 2015

Copy link
Copy Markdown
Contributor

Looks good to me, thanks!

zcbenz added a commit that referenced this pull request Aug 25, 2015
Fix message box missing a close button on Windows
@zcbenz zcbenz merged commit da10df3 into electron:master Aug 25, 2015
@etiktin etiktin deleted the fix_msg_box_no_close_btn branch September 4, 2015 23:19
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 this pull request may close these issues.

No close button in message box with a parent window

2 participants