2

I want to insert GtkEntry widget to GtkToolbar. Following line

gtk_toolbar_insert(GTK_TOOLBAR(searchPanel_Toolbar),
                      GTK_TOOL_ITEM(searchPanel_Entry), -1);

gives me this error:

Gtk-CRITICAL **: gtk_toolbar_insert: assertion `GTK_IS_TOOL_ITEM (item)' failed

How can I add widgets to GtkToolbar without gtk_toolbar_insert_widget() which is deprecated?

1
  • The error means that searchPanel_Entry is not a GtkToolItem. What exactly is searchPanel_Entry ? Commented May 24, 2012 at 16:28

1 Answer 1

4
GtkToolbar *toolbar = gtk_toolbar_new();
GtkToolItem *item  = gtk_tool_item_new();
GtkEntry *entry = gtk_entry_new();

gtk_container_add( GTK_CONTAINER(item), GTK_WIDGET(entry) );
gtk_toolbar_insert( GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), -1 );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.