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
When I try to use an AspectFrame (or any other widget I've tried) for the signal_connect_motion! signal handler, I get an AssertionError: Object of type AspectFrame does not fullfill the widget interface error. I'm assuming that Mousetrap.AspectFrame is supposed to fulfill the widget interface.
julia>using Mousetrap
julia>main() do app::Application
window =Window(app)
aspect_frame =AspectFrame(1.0)
set_child!(window, aspect_frame)
connect_signal_motion!(aspect_frame) do _, x, y
println((x,y))
endpresent!(window)
end
(<unknown>:128894): GLib-GObject-CRITICAL **: 14:55:44.274: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
[ERROR] In Mousetrap.main: AssertionError: Object of type AspectFrame does not fullfill the widget interface. In order for it to be able to be treated as a widget, you need to subtype `Mousetrap.Widget`**and** add a method with signature `(::AspectFrame) -> Widget` to `Mousetrap.get_top_level_widget`, which should map an instance of AspectFrame to its top-level widget component.
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:0 [inlined]
[2] get_top_level_widget(x::AspectFrame)
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:362
[3] connect_signal_motion!(f::Function, x::AspectFrame)
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:5530
[4] (::var"#16#18")(app::Application)
@ Main ./REPL[2]:8
[5] (::TypedFunction)(args::Application)
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:91
[6] (::Mousetrap.var"#14#15"{TypedFunction})(app::Application)
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:1542
[7] (::TypedFunction)(args::Application)
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:91
[8] (::Mousetrap.var"#6#8"{TypedFunction})(x::Tuple{CxxWrap.CxxWrapCore.CxxRef{Mousetrap.detail._Application}})
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:657
[9] safe_call(scope::String, f::Function, args::Tuple{CxxWrap.CxxWrapCore.CxxRef{Mousetrap.detail._Application}})
@ Mousetrap ~/.julia/packages/Mousetrap/WZu6w/src/Mousetrap.jl:1900
The text was updated successfully, but these errors were encountered:
I think you misunderstood the component interface. AspectFrame, or indeed most widgets, do not support signal motion. Instead, motion is a signal of an event controller, EventControllerMotion in this case. You need to create the event controller, then connect it to a widget using add_controller!. Afterwards you can connect to the signals of the event controller itself, but it will use the bounds of the widget:
using Mousetrap
main() do app::Application
window =Window(app)
aspect_frame =AspectFrame(1.0)
set_child!(window, aspect_frame)
# create event controller
mouse =MotionEventController()
# connect controller to widgetadd_controller!(aspect_frame, mouse)
# connect to signal of controllerconnect_signal_motion!(mouse) do _, x, y
println((x,y))
endpresent!(window)
end
When I try to use an AspectFrame (or any other widget I've tried) for the
signal_connect_motion!
signal handler, I get anAssertionError: Object of type AspectFrame does not fullfill the widget interface
error. I'm assuming that Mousetrap.AspectFrame is supposed to fulfill the widget interface.The text was updated successfully, but these errors were encountered: