This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ui | |
import ( | |
"github.com/mattn/go-gtk/gtk" | |
"unsafe" | |
) | |
// This is how GtkWidget and GtkEntry are defined in gtk.go source file in the library: | |
// | |
// type GtkWidget struct { | |
// Widget *C.GtkWidget | |
// } | |
// | |
// type GtkEntry struct { | |
// GtkWidget | |
// GtkEditable | |
// } | |
// | |
// GtkEditable implicit field is unimportant for now. | |
var ( | |
messageNameEntry *gtk.GtkEntry | |
) | |
func Init(builder *gtk.GtkBuilder) { | |
// GtkEntry requires GtkWidget, so I need to create GtkWidget instance first | |
messageNameEntryWidget := gtk.GtkWidget{} | |
// Code below does not work, as well as many other different attempts | |
*(unsafe.Pointer(&messageNameEntryWidget.Widget)) = builder.GetObject("messageNameEntry").Object | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment