public
Last active

  • Download Gist
ui.go
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
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
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.