PinballY / PinballY-Addons-and-Examples

Collection of extensions for PinballY, the pinball game launcher.
MIT License
10 stars 4 forks source link

dispatchEvent example request #21

Closed RichardL64 closed 2 years ago

RichardL64 commented 2 years ago

Can anyone help with an example of 'dispatchEvent' syntax please?

Context I'm trying to fire gameInfo filterSelect when programatically changing the filter with gameinfo.setCurFilter elsewhere. gameInfo.dispatchEvent("filterselect") doesn't do it.

Overall context I want to know which filter was selected before a new one is selected - so I can filter the filter. (i.e. if I have 1990s filter selected. i.e. my code for top 10 would use gameList.getFilterInfo(LAST FILTER).getGames() as the basis for the new filtering rather than gameList.GetAllGames().

LAST FILTER having been set by hooking gameList filterselect.

Referencing this documentation: http://mjrnet.org/pinscape/downloads/PinballY/Help/EventTarget.html

many thanks;

RichardL64 commented 2 years ago

np - worked it out - please ignore :)

let fs = new FilterSelectEvent(); fs.id = gameList.dispatchEvent(fs);

stephenhouser commented 2 years ago

Closing as resolved