Skip to content

Instantly share code, notes, and snippets.

@netvl
Created November 24, 2012 20:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save netvl/4141343 to your computer and use it in GitHub Desktop.
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