Closed itsManjeet closed 3 months ago
Description:
I'm working with GTK4 bindings in Go and have encountered a panic when trying to access a custom child widget from gtk.FlowBoxChild.
gtk.FlowBoxChild
I created a subclass as per the instructions in Subclassing with the following structure:
type ChildWidget struct { gtk.Widget // Other fields... } var childWidgetType = glib.RegisterSubclass[*ChildWidget]()
I attempted to access this ChildWidget within a FlowBox like so:
ChildWidget
FlowBox
flowBox.ConnectChildActivated(func(child *gtk.FlowBoxChild) { childWidget := child.Child().(*ChildWidget) })
However, I encountered the following panic:
panic: interface conversion: gtk.Widgetter is *gtk.Widget, not *disk_card.DiskCard [recovered] panic: closure error: unexpected panic caught: interface conversion: gtk.Widgetter is *gtk.Widget, not *disk_card.DiskCard
Expected Behavior:
I expected to successfully cast child.Child() to my custom ChildWidget type without causing a panic.
child.Child()
Actual Behavior:
The application panics with the error mentioned above, indicating a type mismatch during the conversion.
Steps to Reproduce:
gtk.Widget
ConnectChildActivated
Environment:
1.21.1
4.14.4
gotk4
v0.3.1
Additional Information:
Any guidance on correctly accessing the child widget in this context would be greatly appreciated!
Subclassing currently barely works and will very likely be removed in the future in order to allow development on dynamic runtime linking. Sorry about this.
Description:
I'm working with GTK4 bindings in Go and have encountered a panic when trying to access a custom child widget from
gtk.FlowBoxChild
.I created a subclass as per the instructions in Subclassing with the following structure:
I attempted to access this
ChildWidget
within aFlowBox
like so:However, I encountered the following panic:
Expected Behavior:
I expected to successfully cast
child.Child()
to my customChildWidget
type without causing a panic.Actual Behavior:
The application panics with the error mentioned above, indicating a type mismatch during the conversion.
Steps to Reproduce:
gtk.Widget
as shown.FlowBox
.ConnectChildActivated
callback.Environment:
1.21.1
4.14.4
gotk4
version:v0.3.1
Additional Information:
Any guidance on correctly accessing the child widget in this context would be greatly appreciated!