[a103] - MsgBox [BUG] Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
_3D_
Posts: 277
Joined: 29 Jan 2014, 14:40

[a103] - MsgBox [BUG]

24 Jun 2019, 10:43

The BUG

Code: Select all

res:= MsgBox("Press Esc!")
MsgBox("User pressed : " res)
User pressed "Esc" but MsgBox return "OK". Actually in this case MsgBox return only "OK".
In this case MsgBox must return "" (nothing) when pressed "Esc" or clicked on "X".

Code: Select all

res:= MsgBox("Press Esc!",,"OC")
MsgBox("User pressed : " res)
In this case MsgBox return "OK" only if user pressed "OK" and "Cancel" when "Esc" or "X".

Suggestion:
If MsgBox closed with "X" then return ""
If MsgBox have option "Cancel" then when pressed "Esc" return "Cancel" else return "".

Best: when "Esc" or "X" return ""
AHKv2.0 alpha forever.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: [a103] - MsgBox [BUG]  Topic is solved

24 Jun 2019, 10:48

It is documented behaviour,
msgbox wrote:The Close button (in MsgBox's title bar): Since the MsgBox window is a built-in feature of the operating system, its X button is enabled only when certain buttons are present. If there is only an OK button, clicking the X button is the same as pressing OK. Otherwise, the X button is disabled unless there is a Cancel button, in which case clicking the X is the same as pressing Cancel.
_3D_
Posts: 277
Joined: 29 Jan 2014, 14:40

Re: [a103] - MsgBox [BUG]

24 Jun 2019, 10:59

In other words using MsgBox without options is not recommended because no deference in answers.
AHKv2.0 alpha forever.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, Google [Bot], mikeyww and 44 guests