0ad/binaries/data/mods/public/gui/reference/common/Buttons/CloseButton.js
s0600204 b594266008 Use correct hotkey in tooltip of Reference Suite's Close Buttons
The various pages of the Reference Suite (`structree`, `civinfo`,
`viewer`) all
use the same `CloseButton` object, and the same hotkey to close each
page.

The hotkey that is listened for is the one assigned to `cancel`, however
the
tooltip was attempting to display the hotkey assigned to `close` (which
doesn't
actually exist).

This was SVN commit r24601.
2021-01-14 01:48:21 +00:00

16 lines
413 B
JavaScript

class CloseButton
{
constructor(parentPage)
{
this.closeButton = Engine.GetGUIObjectByName("closeButton");
this.closeButton.onPress = parentPage.closePage.bind(parentPage);
this.closeButton.caption = this.Caption;
this.closeButton.tooltip = colorizeHotkey(parentPage.CloseButtonTooltip, this.Hotkey);
}
}
CloseButton.prototype.Caption =
translate("Close");
CloseButton.prototype.Hotkey =
"cancel";