How to add borders to GTK2 boxes? - gtk

I would like to add a border to an HBox in GTK2.
I have tried wrapping the HBox in a GtkFrame, and while that works, the border is too thin for my needs and I could not find how to change that.
If this is possible, it would be an option.
Another approach I tried was wrapping the HBox in an EventBox and then coloring the EventBox's background to emulate a border.
Here, I ran into the problem that setting the EventBox's background color propagated the setting to the HBox itself.
If there is a way forward with this approach, it might be preferable, because of the added benefit of color choice (that said, if we can change GtkFrame's border color that might be work great too).
EDIT: I have reached something very close to what I'm looking for after managing to change the color of the GtkFrame surrounding the box only.
Still, I'd like to make the frame colored border a bit thicker and have not had much luck.
EDIT²: I have managed by essentially sandwiching two EventBoxes. I change the background color of the outer box and then change the background color of the inner box to match the default background. In this scenario, thickness can be controlled by the border width setting of the box.

Related

removal of blue frame input field sap ui5

I want to remove this blue color frame and also input focus frame . Do you have any idea how to remove this ?
Can anyone help me with this issue ? Kindly note this is not the border frame .
You could use a Theme without Frame like High Contrast White (just add ?sap-ui-theme=sap_hcw to your URL)
But even this will have a Focus indicator, which is essential for accessibility.
If you really need to go without Frame and Focus you will have to create your own Theme (see UI Theme Designer).

GTK3: Making a container aligned to bottom, filling horizontal space but not vertical

all.
I am writing an app in C with GTK3 and using Glade to build the UI.
What I am trying to do is making a container that will stay on the bottom of the frame, filling the horizontal space but not vertical. I will place a few buttons there and don't want them loose in the frame. Right now I just have enough code to show the window to see how it looks in runtime, focusing just on UI.
What I have tried so far:
GtkBox: would be perfect if I could adjust its height so I have free space above it, for another container. But it seems to take whatever free space is left (that is, the whole screen).
GtkPaned: would be perfect if I could prevent it from being resized in runtime and hide the handle. But, well, this is the purpose of this widget, so it doesn't seem to be possible.
GtkGrid: same thing as GtkBox.
For those who already worked with Borland C++ Builder or Delphi, it is the functionality of a "Panel" I'm trying to repeat. That is, you drop the container in the frame, align it to bottom (which makes it fill the horizontal space) and then you adjust the height in design time.
Any ideas? If you need more information, just let me know.
*EDIT: Alexander, this is when I try to expand on your comment, that is, using more than 1 button and container inside a container (see top right of Glade for the hierarchy).
When all buttons have Expand "Off", which works for 1 button, and when it is "On" (then I don't get to adjust the height anymore).
"No" to all buttons
"Yes" to all buttons
The simpliest solution: take GtkBox and use gtk_box_pack_end.
Another way is to control container align and expand behaviour (use gtk_widget_set_halign/gtk_widget_set_valign and gtk_widget_set_hexpand/gtk_widget_set_vexpand on the container itself)
Edit: didn't notice you are using glade. Create a gtkbox, add a child and change child's pack type
Also notice: if you want to add container near another container, you should pack both containers in another container.

Change the border's color of a button in Unity3D

I began to work with Unity3D since one month and I'm trying to do an application which contains a menu, composed by a panel and several buttons. At this moment, I'm trying to customize the menu, I change the fill color of the panel and buttons, but until now I could not change the border color of the buttons. There is any way to customize the border's color of the UI buttons? I would appreciate your help. :)
The easiest way to add an outline to your button is to use the Outline component (doc).
Simply add the Outline component where your button image or text is. Then configure it how you like it :)
The above results in the following button:
No, you can not change just border color. If you use default buttons, take a look at Source image. It is basically a grey square with black borders. So when you change color of image black color remains black.
To customize buttons as you want you need either create nested UI elements:
or create sprites with colors you want and replace source image
I find nested UI elements to be the easiest way to do something like this. Simple example:
Start out by creating a panel and change the scale until you get the desired size for your button. This will be your "borders".
Next create another panel as a child of the panel you just made and change the scale to be just slightly smaller than your first panel and change the color.
In the Inspector for your panel, add component and type in Button and add it as a component.
Finally, add a text as a child of your panel for a label and you're done.

How to change border color of a Jface Dialog(or TitleAreaDialog)?

I'm tring to change the border color of a TitleAreaDialog.
But after research found no support for this attempt.
This is handled in the class JFaceColors You should add a IPropertyChangeListener to detect when any of these colors change. Refer also to the ColorRegistry, where you can add colors.

Enabling form resizing

I have a existing form where the resizing is disabled. I tried to change the property Border Style to bsSizeable and border icons to [biSystemMenu,biMinimize,biMaximize]. I am able to resize but the controls inside the form is not sized accordingly. Any help would be appreciated.
The border style and icons control whether the form is resizable, but the controls on a form don't automatically move unless you've configured them to do so. Change their Align, Anchors, or Constraints properties, which all affect the size and position differently. You can also handle the form's OnResize event and arrange the controls however you want.