…
Here is my updated answer. Attached is a file called ButtonActionHandler.zip which includes a file named ButtonActionHandler.js (name it what you want).
I had to comment out these two lines for it to compile
public class EGUI_Button extends EGUI_Element {}
super.OnClick();
[77826-buttonactionhandler.zip|77826]
…