Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: anarchist on January 12, 2014, 05:55:14 PM
-
Hello all,
Not certain whether this is expected behaviour or if I am doing something wrong. I have a window which contains a nested window. The nested window contains a button named "btnOption1". Both the button and the nested window have ParentNotify = true.
Indide the parent window's script I have added:
on "btnOption1"
{
//do something
}
I am expecting this to be called when I press the button inside the nested window. Unfortunately, this is not the case. I set a breakpoint here (I have some code, not comments) and it is never reached.
I have moved the button inside the parent window and the above code is reached. Therefore, something is wrong with the nested window. Do I need to add a script to catch the button press event?
I am working with WME Project Manager 1.10.001 which is still in beta, so I am not sure if this is a bug.
-
Yes, in the main window script you need to define some method, for example:
on "NestedButton"
{
//do something
}
And in the nested window script:
-
Thanks 2.0, that is exactly the information I needed.
A more general question that rises from this is: Since the nested window does not send the events to the parent, what is the use of ParentNotify?
-
It works for buttons within the window at least. As about windows - well, every day is not Sunday :)
-
Parent of the button is window, not a parent window.
-
Parent of the button is window, not a parent window.
I understand that, but shouldn't the parent window be notified with event "btnOption1" when button triggers that event in the sub-window (provided that the sub-window does not handle the particular event in its script)?
btnOption1 clicked -> nested window event btnOption1 triggers -> nested window does not handle event -> parent window event btnOption1 triggers
Is the above logic flawed?
-
What you're saying makes sense, but ParentNotify only seems to work for buttons as far as I can tell, so you can't chain it like that. 2.0's answer is the best way to go.