c - 'GtkToggleButton {aka struct _GtkTogglebutton}' has no member 'active' -


i trying compile , run example of gtk+3, unfortunately, example gtk+2 manual, can't find useful on gtk+3 , can't download gtk+2. on example there couple of function this:

void entry_toggle_editable( gtkwidget *checkbutton, gtkwidget *entry ) {     gtk_editable_set_editable(gtk_editable(entry),gtk_toggle_button(checkbutton)->active); } 

when compiling got error:

'gtktogglebutton {aka struct _gtktogglebutton}' has no member named 'active' 

i looked in manuals. able find in order around problem, understand release compatibility problem, gtk+3 manuals useless approaching first time gtk.

one of biggest changes between gtk+ 2 , gtk+ 3 gtk+ 3 gets rid of public structure fields, replacing them gobject properties. instead of saying

gtk_toggle_button(checkbutton)->active 

you say

gboolean active; g_object_get(checkbutton, "active", &active, null); 

(the null because g_object_get() can multiple properties same object @ same time; null says "that need call".)

gtk+ provides accessor methods add type checking, can say

gtk_toggle_button_get_active(gtk_toggle_button(checkbutton)) 

using these when available preferable calling g_object_get() directly.

the gtk+ documentation come a tutorial. realized, cannot use gtk+ 2 examples learn gtk+ 3 without modification; need spend more time finding gtk+ 3 examples.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -