You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Events should be only captured by widgets, that are interested in the event. e.g. mouse events should be only propagate to widgets, that contains the current mouse position.
Propagation
Propagate events from root to leaf (tunnelling / preview events) and than back from leaf to root (bubbling). Events could be interrupted with event.handled = true.
The widget trait should provide for each system event type (mouse, key, resize, ...) a separate function. The default implementation should do nothing. Each widget that is interested in a particular event could be override the corresponding function. After that there is no need to write complex event match statements in each widget.
Example
pubtraitWidget{fnpreview_mouse_down(event:MouseEvent){}fnmouse_down(event:MouseEvent){}fnpreview_key_pressed(event:KeyEvent){}fnkey_pressed(event:KeyEvent){}
...
}implWidgetforButton{fnmouse_down(event:MouseEvent){// do something
event.handled = true;}}
Handled flag
Each event should provide a handled flag. If the flag is set to true the propagation of the event should stop. The flag should be set from the widget, that handles the event. This should be solve #44.
Additional
A combination with event aggregation or similar to handle custom "user" event should be possible.
The text was updated successfully, but these errors were encountered:
Here my suggestion for a new system event system:
Event capture
Events should be only captured by widgets, that are interested in the event. e.g. mouse events should be only propagate to widgets, that contains the current mouse position.
Propagation
Propagate events from root to leaf (tunnelling / preview events) and than back from leaf to root (bubbling). Events could be interrupted with event.handled = true.
http://csharphelper.com/blog/2015/03/understand-event-bubbling-and-tunneling-in-wpf-and-c/
Default set of event functions for system events
The widget trait should provide for each system event type (mouse, key, resize, ...) a separate function. The default implementation should do nothing. Each widget that is interested in a particular event could be override the corresponding function. After that there is no need to write complex event match statements in each widget.
Example
Handled flag
Each event should provide a handled flag. If the flag is set to true the propagation of the event should stop. The flag should be set from the widget, that handles the event. This should be solve #44.
Additional
A combination with event aggregation or similar to handle custom "user" event should be possible.
The text was updated successfully, but these errors were encountered: