#548 A way to forward event to another component w/o programming

3.0.0 RC
General (239)
Tom M. Yeh

Without zscript, it is tedious to register event listener for each menuitem and buttons in a window.

For example,
<window id="w" use="MyWindow">
<button id="b" label="OK" onClick="w.onOK()"/>

requires zscript to run w.onOK, which degrades the performance.

On the other hand, we can register
class MyWindow {
void onCreate() {

but it is tedious.

It will be better if we can

<window id="w" use="MyWindow">
<button label="onOK" event="w.onOK"/>

Then, in MyWindow,
class MyWindow {
public void onOK() {

No zscript, no addEventListener



  • Dennis Chen

    Dennis Chen - 2007-08-17

    Logged In: YES
    Originator: NO

    I think we need to specify the type of Event, such as:
    <button label="onOK" event="onClick:w.doOK,onX:w.doY"/>
    no script, parser register listener when parsing.

    And some times I want get more information from event.
    public void doOK(Event event) {

    Or, nothing in argument is Ok. too.
    public void doY() {


  • Henri Chen

    Henri Chen - 2007-08-17

    Logged In: YES
    Originator: NO

    It a way to chain event from this component's onX event to another component's onY event. So it might be look like this:

    <button label="onOK" event="onClick:w.onOK,onX:z.onY"/> rather than doOK and doY.

    It reads "button's onClick event will trigger component w's onOK event while onX event will trigger component z's onY event."

    To be more general, maybe in this form:

    <button label="onOK" event="onX1:w1.onY1,w2.onY2,...; onX2:w3.onY3, w4.onY4,..."/>

    So you can chain event to trigger multiple events.

    The issue here is how you pass the data in event? In onClick and onOK example, no data, no problem. If there is data, then ...?

  • Tom M. Yeh

    Tom M. Yeh - 2007-08-19
    • milestone: --> 3.0.0 RC
    • status: open --> closed
  • Tom M. Yeh

    Tom M. Yeh - 2007-08-19

    Logged In: YES
    Originator: YES

    Ready since 8/19

    <button label="OK" forward="onOK"/>

    It forwards the onOK event to the space owner of the button.

  • Henri Chen

    Henri Chen - 2007-08-19

    Logged In: YES
    Originator: NO

    I don't follow this example. There is no onOK event in button then how do it forward that to the space owner?


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks