February 2019
Intermediate to advanced
450 pages
11h 59m
English
At the time of writing, andlabs UI doesn't expose a menu API (despite ui.NewWindow() taking a hasMenubar parameter). There is a project underway to properly expose menu functionality to the Go API, but for now it's only available if you work with the underlying libui C code. The menu defined in the C library can be accessed from a Go project by adding a little CGo code, such as the following:
/*void onMenuNewClicked(uiMenuItem *item, uiWindow *w, void *data) { void menuNewClicked(void); menuNewClicked();}int onQuit(void *data) { return 1;}void loadMenu() { uiMenu *menu; uiMenuItem *item; menu = uiNewMenu("File"); item = uiMenuAppendItem(menu, "New"); uiMenuItemOnClicked(item, onMenuNewClicked, NULL); uiMenuAppendSeparator(menu); item ...Read now
Unlock full access