GWT menu item text alignments issues - gwt

Is it possible in GWT to set Menu Item text in two different alignments,what I mean to say is
I want my menu item's label to be left justified and its accelerator key to be right justified.
i.e,
Create Alt+Ctrl+C
Edit Shift+E
Optimize Ctrl+O

There's a "boolean asHTML" option when creating menu items, set that to true, then use CSS to left align and right align the text you want to align.
See the docs: http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/MenuItem.html

Related

How do I make these GTK buttons that are drawn together in a group?

GTK has a way to draw a group of buttons together so they look like one big button with a divider between them, rather than buttons that are drawn apart. It's useful for drawing buttons together that have a similar function.
Here's an example from the GTK inspector, where they appear to be specifically toggle buttons where only one can be selected:
Another example, from Glade, where each button represents a category of widgets and opens a menu:
What is this style of buttons called, and how do I make them?
GTK Inspector example shows GtkStackSwitcher, a special widget used to control the GtkStack (for page switching).
Generally, to achieve this visual effect for a group of buttons, GtkButtonBox is used with the layout style set to GTK_BUTTONBOX_EXPAND.
Buttons expand to fill the box. This entails giving buttons a "linked" appearance, making button sizes homogeneous, and setting spacing to 0
You can also manually add a "linked" style to any container with buttons:
GtkStyleContext *context;
...
context = gtk_widget_get_style_context(button_box);
gtk_style_context_add_class(context, GTK_STYLE_CLASS_LINKED);
HowDoI/Buttons (paragraph "Linked buttons")

Add a cell renderer using Glade

I'm using Glade to build a GTK user interface for my Rust program.
The issue is that items that are added to the ListStore are not showing up. I have horizontal lines set up that show up, but the text of the items is not showing up. I Googled and I suspect it's because of the cell renderers. I have tried to add a cell renderer in Glade, however I didn't see anywhere where could I do that. I right click on the treeview, click Edit, right click on the row/column but nothing about cell renderers is displayed.
How can I add a cell renderer using Glade?
$ glade --version
glade 3.22.1
It's very hard to find. I search lots of tutorial but many of them are very old, so the interface was quite different.
Right click GtkTreeView and choose "Edit"
On top left sub area, click blue "+" sign to add a new column.
right click newly created column, choose add child text
You will see Cell Render area showing up to the right.
In "Properties and Attributes", set "Text" properties to the column you wish to present.

Highlight the ComboBoxCellEditor choice on mousehover

I want to achieve the ComboBox functionality in which the ComboBox values are highlighted on mouse hover. In ComboBoxCellEditor only the selected is highlighted when the drop down is shown. There is no effect of the mouse hover on the list.
In the above pic my cursor is pointing to String2 and its highlighting String2. Here i'm using ComboBox.
But In the above pic my cursor is pointing to String2 but its highlighting the String0 which is selected. I want to achieve the first pic functionality using ComboBoxCellEditor.
There are two implementations of a combo box in SWT:
Combo uses the platform's native widget
CCombo (C for custom) is a control composed of a text and a button which opens a List to let the user select an item
The ComboBoxCellEditor internally uses the CCombo widget. To have a combo box like shown in the first image of your question in a cell editor, you need to implement your own AbstractComboBoxCellEditor that uses the Combo widget.
The two combo box implementations are mostly API compatible. You may want to use a copy of the ComboBoxCellEditor as a start, change the type of the comboBox field to Combo and adjust the remaining code passages.

JavaFX 8, how to hide a pane in Splitpane?

I have a splitpane created from FXML that consists of Three panes left to right. I want to be able to hide the rightmost pane but I can't find anything to hide it. If I turn of the visibility it hides the pane content. What I want is to temporarily hide it, so the pane is removed visually.
As a temporary workaround I move the divider to 100%, but this leaves the divider visible. Another side-effect is that if I resize the main window the divider doesn't stay at the rightmost position.
Any tips on hiding one pane in splitpane?
Or any tips on the best way to achieve this without splitpane(rightmost pane needs to be resizable when not hidden). General pointers to techniques/containers would be appreciated since I'm new to Java/JavaFX but not to programming :)
Seems I've found it, even thought it's not a plain hide/show deal. My splitpane is named "mainSplitPane", and the one I want to hide/show is the third. Upon initialization of the controller I retrieve the third pane and store it in "componentsPane".
Declared in controllerclass:
Node componentsPane;
Called in initialize method of the controllerclass:
componentsPane=mainSplitPane.getItems().get(2);
Code to hide:
mainSplitPane.getItems().remove(componentsPane);
And code to show:
mainSplitPane.getItems().add(2, componentsPane);
mainSplitPane.setDividerPosition(1, 0.8);
A side effect is that I have to set dividerposition since it's removed.

In GWT, how can I make my widget escape the display bounds of its containing widget?

So for example, if a context menu was too small for its panel when the menu opened, I should like the menu to spill out of the panel in order to display properly.
In Swing, you can arrange for the widget to render on a 'glass pane' which is a transparent layer in front of 'everything else'. Is there an equivalent in GWT?
In my case, my 'context menu' is not a classical menu - it's some arbitrary GWT panel, which might contain (for example) a form with some editable fields, more resembling a dialog ... but it isn't modal, and its position needs to be anchored into the surrounding HTML.
GWT's PopupPanel appears to fulfil this role.