Fixed call of popup menu commands with parameters.s

This commit is contained in:
Uwe Oestermeier 2020-08-04 18:07:48 +02:00
parent 47b178fbc1
commit 12b17fd7af
3 changed files with 12 additions and 8 deletions

8
dist/iwmlib.js vendored
View File

@ -6671,9 +6671,11 @@
if (this.autoClose) { if (this.autoClose) {
this.close(); this.close();
} }
setTimeout(() => { console.log("perform", event, key);
func.call(event, key); setTimeout((event, key) => {
}, 20); console.log("perform within arrow", event, key);
func(event, key);
}, 20, event, key);
} }
/** Update the menu item denoted by key. /** Update the menu item denoted by key.

View File

@ -34,8 +34,8 @@ oncontextmenu="PopupMenu.open(cmds,
oncontextmenu="PopupMenu.open(cmds, {x: event.offsetX, y: event.offsetY}, { parent: example, keepWithin: example}); return false;"></div> oncontextmenu="PopupMenu.open(cmds, {x: event.offsetX, y: event.offsetY}, { parent: example, keepWithin: example}); return false;"></div>
<script class="doctest"> <script class="doctest">
let cmds = { let cmds = {
"Start": () => alert("Start"), "Start": (event, key) => {console.log("start", event, key); alert(key) },
"Stop": () => alert("Stop") "Stop": (event, key) => alert(key)
} }
let app = new App() let app = new App()
let popup = new PopupMenu({ parent: example, fontSize: "2em", autoClose: false }) let popup = new PopupMenu({ parent: example, fontSize: "2em", autoClose: false })

View File

@ -113,9 +113,11 @@ export default class PopupMenu extends Popup {
if (this.autoClose) { if (this.autoClose) {
this.close() this.close()
} }
setTimeout(() => { console.log("perform", event, key)
func.call(event, key) setTimeout((event, key) => {
}, 20) console.log("perform within arrow", event, key)
func(event, key)
}, 20, event, key)
} }
/** Update the menu item denoted by key. /** Update the menu item denoted by key.