How to show GtkToolItem in the overflow menu of a GtkToolbar? - haskell

I am working on a Haskell application using gtk2hs. This application has a toolbar which consists of several GtkToggleToolButton, GtkToolButton and GtkToolItem elements. For being able to resize the applications window, I set the ShowArrow attribute to True, so that elements, that would be outside the window, are listed in an overflow menu.
This works fine for GtkToggleToolButton and GtkToolButton elements, but GtkToolItem elements do not show up in the menu. This would not be such a big problem, but if those elements are not inside the window frame, the menu arrow does not show up only for them. So that you have no indication that the toolbar has actually more elements.
The GtkToolItem contains a GtkTable which contains a label and two GtkToolButton elements. Can I tell GTK that it should display a label in the overflow menu for my GtkToolItem elements?
Thank you in advance!
Tobias

GtkToolButton itself is a GtkToolItem (and you can add that table to it)! Then why you are using GtkToolItem directly?
And I think you should use GtkToolButton.set_stock_id (or set_icon_widget) aditional to set_label, instead of createing a table...

ToolItem has a method toolItemSetProxyMenuItem which allows you to specify the menu item that is displayed in the overflow menu:
http://hackage.haskell.org/packages/archive/gtk/0.11.0/doc/html/Graphics-UI-Gtk-MenuComboToolbar-ToolItem.html#v:toolItemSetProxyMenuItem

Related

How to display overflow menu for ToolItems in a GTK Toolbar

A GTK Toolbar can display an overflow menu when the toolbar is not wide enough to show its contents.
It seems that this feature doesn't work if the toolbar contains ComboBoxes wrapped by ToolItems.
Here is an example code that demonstrates the issue. It's written in Haskell but I guess it shouldn't be too difficult to translate it into other languages.
The instructions to build the repo is written in the README.md.
The last command opens a small GTK window. If you make it bigger you'll see two ComboBoxes in the window. The problem is that if you make the window narrower a bit, the right ComboBox disappears and no overflow menu appears even though toolbarShowArrow is enabled.
(Unfortunately I don't have enough reputation on SO to post two screenshots here so I uploaded them on the repo.)
Interestingly if I change the contents of the Toolbar from ToolItems to ToolButtons for example, I get the overflow menu.
Also I tested this with 3 packages: gtk for GTK2, gtk3 for GTK3, and gi-gtk for GTK3 with gobject introspection. All of them have the same issue.
So the question is: is there any workaround for this issue?
The documentation states this about gtk_toolbar_set_show_arrow():
Sets whether to show an overflow menu when toolbar doesn’t have room for all items on it. If TRUE, items that there are not room are available through an overflow menu.
So, it's an "overflow menu". I won't bore you with a detour into the GTK+ source, but suffice it to say: the items you add to the Toolbar need to provide menu items to appear in its overflow menu. Sounds logical now, right? :D
ToolButtons work because they call set_proxy_menu_item() with a MenuItem they create specifically for this purpose.
And that's what Toolbar looks for when deciding whether items can overflow: proxy MenuItems, which it can put into the overflow menu - and only if it finds at least one is there any point in giving the arrow to open that menu.
So, if you have other widgets, you can to get them into the overflow menu by setting a proxy menu item on your ToolItem, by either of:
simply calling gtk_tool_item_set_proxy_menu_item() to set a specific item
connecting to the ::create-menu-proxy signal on your ToolItem, and deciding during each emission whether or not to set (or clear) the proxy item
You'd also, of course, connect ::activate on that MenuItem to do something appropriate relating to the original ToolItem.
...though whether you can do anything useful from a MenuItem if the ultimate ToolItem child is a ComboBox is a different question. It doesn't expose its popup menu as something you can use. I guess you could just add a duplicate of the ComboBox to a MenuItem and use that as your proxy... But in that case, likely you're outwith the scope of what the overflow menu is meant for, and should instead just ensure your Toolbar doesn't get small enough to lose such controls.
Or maybe not! Try it and see how it goes.

see bounding boxes of elements in Dreamweaver

I would like to see the edges of all elements in my html page. That way it is clearly visible what you are doing at any time. Currently I need to click an element to see it's bounding box, which is time consuming if you need to click a lot of elements. Is there an option I need to click to see all the bounding boxes of elements all the time?
Figured it out. You need to be in Design mode to see element boundaries.

LWUIT Scroll List issue

I have 5 Lists in my Form. They are hidden and when I show one of them, the focus go inside the List and the Form doesn't scroll. I want to show all the List, navigate across it and keep my Formscrolling showing that List.Is there any way to make a Listno scrollable?
EDIT/CLARIFICATION
I show a Form with a Button. When I press this Button a List is showed under the Button. When the focus enter inside the List, the Liststarts to scroll, but the Formdoesn't, and I can't see the other elements. What I want is...a List no scrollable and a Formscrollable that let me see the rest of the List.
By munon at 2012-02-03
In the photo, you can see, the CheckBoxes are in the List. This List has a scrollbar but is his scrollbar not from the Form.
There is no way to make a list none scrollable but that shouldn't matter. If your form is scrollable and uses the correct layout (e.g. BoxLayout Y), then everything should just work (assuming you revalidate after adding a new list).
Personally I would use Components/Containers rather than lists for a design as elaborate as this. They provide lots of advantages over lists such as more refined focus/touch behavior.

GXT, how to display the widgets labels with a VBOXLayout

I have been trying to resolve this by myself but I can't find any answers. I need the text fields the combo box, etc., to display its own label, but I can't put it to work on a panel different from the FormPanel (in which all works great). I'm trying to display the labels for a text field on a VBoxLayout but I don't find the way to do it.
I need to work with a VBoxLayout because I need the widgets to position in the middle of the form after the window is maximized or minimized and this layout is the only one that proves to work. Is there another way to accomplish this?
Add another LayoutContainer and then set the panel to use FormLayout for example
LayoutContainer innerPanel = new LayoutContainer();
innerPanel.setLayout(new FormLayout());
Now it will work just like a form panel.

dijit.MenuItem values are auto-highlighted... how to stop this?

I am using Dojo 1.3.1 and have a dijit.Menu with several dijit.MenuItem items. The menu is displayed as a context menu when the user right-clicks on items that were bound to the menu using (dijit.byId("contextmenu_pf")).bindDomNode(...). All works well, but frequently when the menu is displayed, one or more of the menu items are highlighted (aside from the first one). This seems to be random and has no relationship to previously selected items. Some of the highlighted menu options are even displayed.
Has anyone seen this behavior and/or know how to stop it from happening?
Thanks - Peter
This is a known issue, filed as http://bugs.dojotoolkit.org/ticket/10339.
The attachment in that link also lists some workaround code.

Resources