GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Apr 25, 2014 2:35 am

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: add menu to toolbar item
PostPosted: Tue Oct 25, 2011 7:06 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
how can i add a full submenu to a toolbar button?


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Wed Oct 26, 2011 7:46 am 
Offline
GTK+ Geek

Joined: Sun Apr 03, 2011 11:12 am
Posts: 63
Try GtkMenuToolButton


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Wed Oct 26, 2011 5:54 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
tried this :

GtkToolItem *drop_down = gtk_tool_button_new_from_stock(GTK_STOCK_PREFERENCES);
GtkWidget *drop_menu = gtk_menu_new();
gtk_menu_tool_button_set_menu(drop_down, drop_menu);
gtk_toolbar_insert(toolbar, drop_down, -1);

and no menu is shown.


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Thu Oct 27, 2011 4:37 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I think that's because you defined drop down at creation as being tool_item rather than the more specific menu_tool_button.
By the way if you run from the terminal you should see the error messages such as checking for GTK_IS_MENU_TOOL_BUTTON which'll clue you in to what needs to be done.


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Thu Oct 27, 2011 9:24 am 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
cheers.works like a charm now (:


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Thu Oct 27, 2011 1:12 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
thanks,but is it able to add a menu to a toolbar item without that down arrow at the right?


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Sat Oct 29, 2011 3:05 am 
Offline
Never Seen the Sunlight

Joined: Thu Mar 24, 2011 2:10 pm
Posts: 328
Location: Sydney, Australia
I don't think so. The arrow is designed as being how you access the menu for the case of tool buttons.


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Sat Oct 29, 2011 4:00 pm 
Offline
GTK+ Geek

Joined: Sat Sep 03, 2011 6:36 pm
Posts: 94
anyway,i have seen that in some apps (:
is there any way i can only display the arrow?


Top
 Profile  
 
 Post subject: Re: add menu to toolbar item
PostPosted: Mon Oct 31, 2011 8:47 pm 
Offline
Never Seen the Sunlight

Joined: Wed Jul 23, 2008 10:31 am
Posts: 2406
Location: Slovenia
Hi.

You can manually popup the menu when user clicks on tool button. It's a bit messy when it comes to positioning menu properly, but I can be done. I played with this quite some time ago and manage to get the results I was after.

Cheers,
Tadej


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group