popup menus for tree items.




I'd like to display a popup menu when someone right clicks a tree item.
The current behavior is that the tree collapses (or expands?).  I tried
handling the button press event for the tree item.  In the handler, I
select the item by calling gtk_tree_item_select(GTK_TREE_ITEM(widget)).  
This caused a seg fault if I would select this way and then click the
middle mouse button.  Moreover, I didn't receive a selection_changed event
for the root tree and I could use this techique to select multiple things,
which I didn't want to do (I did set the selection mode to single).

Is there a "good way" to do this?

Also, IIRC, Java (or maybe Windows) has some sort of specific popup
callback/event for its widgets.  This is so on a Mac you someone can
option-click and in Windows or X-windows someone can right-click to get a
popup menu.  It would be nice to be able to do the same in GTK.  I think
it would be better than right-click to expand (or collapse).

I'm using GTK 1.0.4

Thanks,
David

PS- Is there a way to set accelerators for menus (ie, Alt-F opens the File
menu)?


      __          _    __  
  ___/ /__ __  __(_)__/ /  David Helder - University of Michigan
 / _  / _ `/ |/ / / _  /   dhelder@umich.edu
 \_,_/\_,_/|___/_/\_,_/    http://www.eecs.umich.edu/~dhelder



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]