GtkBox implicit margin between children - gtk3

Is it possible to remove all margins between two widgets inside a GtkBox?
Tried: Set everything to zero
Result: Still 2px effective margin
GTK+ Version: 3.18.9
Widget properties:
Drawing code:
auto w_out=static_cast<double>( gtk_widget_get_allocated_width(widget) );
auto h_out=static_cast<double>( gtk_widget_get_allocated_height(widget) );
cairo_set_source_rgba(cr,self->m_background.red,self->m_background.green
,self->m_background.blue,self->m_background.alpha);
cairo_rectangle(cr,0,0,w_out,h_out);
cairo_fill(cr);
auto img=self->r_img;
if(img!=nullptr)
{
//...
}
The actual size is 22 x 22 as expected.
Rendered result:
It appears that this is not a theming issue, since all themes behaves the same.

I've tried on the same Gtk version:
$ rpm -q gtk3-devel
gtk3-devel-3.18.9-1.fc23.x86_64
and it did work without any borders as can be seen:
The images are centered due to horizontal alignment set as center. Resizing the window to the smallest size:
The image used was a crop from the original (22x22 px):
Conclusion
Seems that you are creating a custom widget, maybe there's something you're missing (more details needed). From regular widgets (GtkImages packed on a GtkBox, tested with glade) it seems to work fine.

I found the solution. I had a non-zero spacing for the GtkBox.

Related

How to prevent TextField widget's cursor from jittering? - Flutter

https://imgur.com/X2gEMqO
Check out the video to see what I'm talking about ⤴
Before I start making custom widgets I wanted to see if anyone knew a way to fix this with vanilla Flutter. It seems to be something related to the TextEditingController but I'm not entirely sure.
When the TextField is set to centre or right align it seems to work just fine, but when on left / start / justify it always seems to have that slight jitter.
Thanks in advance! ~ I may post this to the Github repository as well
Edit: You can see that the cursor jitters only when it moves to the left of the textfield. When it is moving within the string it does not jitter at all. I was testing this on a simulated iPhone 11
This problem has two parts to it. First, the cursorOffset of the text_field.dart for whatever reason has a negative x value.
This causes the cursor to be jammed into it's container making the width look weird. Second, the TextStyle.height property causes the cursor to jump.
I figured out how to fix this thanks to Pavel!
TextField - Font Size 50.0 / Height 1.30
https://imgur.com/gallery/G9bkcIf
TextField - Font Size 20.0 / Height 1.30
https://imgur.com/gallery/x7a5nzM
Fix Cursor Offset
The cursorOffset value is stored within the text_field.dart file. In
order to edit it, you should probably create a duplicate of the
text_field.dart file to customize. Here's how to do that,
although you might find better answers with a Google
Once you have the file ready to edit navigate to cursorOffset
within TargetPlatform.iOS. It should be around line 924-ish if
your file is unmodified.
Change the values of Offset(...) to 0 & 0 (x, y) respectively or
whatever you think is appropriate.
If you duplicated the text_field.dart file correctly then it should
be working right away!
Fix Cursor Jump
This fix is a lot less work. Simply add in a TextStyle widget to the
style: property of a TextField widget.
Then, just fill in the height property of your TextStyle widget
with whatever you think! I found 1.3 was a good median but pick the
best height for your fontSize. Here's some information on
height:
Github Issue Regarding This
https://github.com/flutter/flutter/issues/31661

Is there way to set detailRowHeight prop to 100% in ag-grid?

Recently started working on a master detail structure angular ag-grid. The structure has two levels of master-detail nesting. I need to fix the heights of inner - 2 grids such that they occupy all available real estate on the screen. Currently, ag-grid defaults it to 300 px and a lot of whitespace or unused space appears on a 1920x1200 screen resolution monitor. I also need to have fixed headers for all grids.
Any ideas or pointers would be appreciated...
Update: Referring to a forked version of plunker example from ag-grid here - https://next.plnkr.co/edit/yUzo4EqONEmgCmIw This is simple and basic set up for master-detail grid.
Note that: I haven't set any detail row height and have setup just one record to show up in the grid to test for the issue.
If you run the plunker code and view the result in separate window, notice that the inner / child grid doesn't occupy all the space available below it. In other words, it doesn't take as much as space/height available from parent container (master's detail row). The default 300px master detailRowHeight is making height fixed for inner grid. Also, from documentation, detailRowHeight prop doesn't seem to take something similar as 100% or 100vh and only takes fixed pixels number. Added a picture of the example below and the height / unused space I referred
We have different resolutions that users use to view data in grid and the heights of inner grids need to auto-adjust taking max. available space to show most information in the grids.
You could try something like this, I pulled it from the documentation:
In your component.ts file add this method. If it's a detail row it will apply different calculations than the other rows.
public rowHeight(params) {
if (params.node && params.node.detail) {
var offset = 80;
var allDetailRowHeight = params.data.callRecords.length * 28;
return allDetailRowHeight + offset;
} else {
// otherwise return fixed master row height
return 25;
}
};
In your template add the following: [getRowHeight]="rowHeight"
<ag-grid-angular
#agGrid
style="width: 100%; height: 100%;"
id="myGrid"
class="ag-theme-balham"
[columnDefs]="columnDefs"
[masterDetail]="true"
[detailCellRendererParams]="detailCellRendererParams"
[getRowHeight]="rowHeight"
[rowData]="rowData"
(gridReady)="onGridReady($event)"
></ag-grid-angular>
Hopefully this will get you moving forward. Good Luck!
https://www.ag-grid.com/javascript-grid-master-detail/#detail-row-height
So I don't have a great, full solution for you but as a starting point I would use CSS to override the styles ag-grid is setting - I don't think detailRowHeight is going to help.
Here's my plunk getting close to what you want with some simple CSS I put in index.html. You can use !important to override ag-grid styles, or you could use javascript to set the CSS after ag-grid does. I prefer !important in this case and don't have to worry about timing.
https://next.plnkr.co/edit/mmXBBJE5Wa1JrX7v
The problem I wasn't going to get into is getting it to dynamically fill up available space, depending on the row selected, scroll position, etc. I can't think of any simple way to achieve that - I do this type of thing in grid often and end up writing javascript to calculate the available space, and then set the CSS in javascript.
In ag-grid you have the possibility to set auto height for details.
Set grid property detailRowAutoHeight=true to have the detail grid to dynamically change it's height to fit it's rows.
const gridOptions = {
// dynamically set row height for all detail grids
detailRowAutoHeight: true,
// other grid options ...
}
However if you are providing your own detail component...
detailCellRenderer: 'MyOwnDetailsComponent',
then, it might not work and you will still need to provide an grid options height detail content through...
detailRowHeight: 560,
Please see the ag-grid documentation here

Row issue with Ag-Grid

I'm trying to manipulate the style of a data-table being used with ag-grid plugin. The background colour of each row seems to cut off before the end of the table when it's inside of a CSS overflow parent. What can I do to avoid that cut off so that everything is in colour?
I had the same issue and solved it by
using overflow: auto on ag-body-viewport class and remove width: 100% on the .ag-body-container{} class, in case you have that.

How can I change vertical spacing in Gtk2 menu items in Eclipse?

I'm trying to make Eclipse UI more compact and already have successfully tweaked it using these instructions:
Can I make Eclipse on Ubuntu look more compact?
https://gist.github.com/andrioli/3825078
The only remaining thing I want to improve is reducing vertical spacing between menu items as on this picture:
.
I looked through GtkMenuItem style properties, but can't find any setting for that. GtkMenu::vertical-padding also doesn't seem to be right one.
Is there any Gtk2 widget property that I can modify to do it?
There are a couple of settings in your theme's gtkrc file that you can modify to make the menu items more compact:
To reduce the width and height of the menu items, you can assign a smaller value to the xthickness and ythickness properties respectively (horizontal and vertical padding respectively between the text and border of a widget). e.g.
style "menu_item" {
xthickness = 1
ythickness = 1
}
The above code snippet assumes your GtkMenuItem widget uses a style called menu_item in your theme's gtkrc file. i.e.
widget_class "*<GtkMenuItem>*" style "menu_item"
The height of the separator menu item (line separating menu items) can be reduced by assigning a smaller value to the GtkWidget::separator-height property. e.g.
style "separator_menu_item" {
xthickness = 1
ythickness = 1
GtkSeparatorMenuItem::horizontal-padding = 0
GtkWidget::wide-separators = 1
GtkWidget::separator-width = 1
GtkWidget::separator-height = 1
}
Again, the above code snippet assumes your GtkSeparatorMenuItem widget uses a style called separator_menu_item in your theme's gtkrc file. i.e.
widget_class "*<GtkSeparatorMenuItem>*" style "separator_menu_item"

gtk (or gtkmm) 3 widen scrollbar for embedded (touchscreen) use

Since I'm using gtk3 and gtkmm3 on embedded I would like to have the scrollbar of a scrolledwindow wider.
I tried many ways but couldn't find a working solution.
Particularly I had a partial result with the following lines of code:
Gtk::Scrollbar *p_tableScrollbar = mp_scrolledwindowTable->get_vscrollbar();
p_tableScrollbar->set_size_request(50, -1);
but while the frame of the scrollbar becomes bigger, the slider remains narrow and part of the scrollbar area.
Then I tried the CSS way with the code:
Glib::RefPtr<Gtk::CssProvider> r_cssProvider = Gtk::CssProvider::create();
r_cssProvider->load_from_data("* {\n -GtkRange-slider-width: 50;\n }\n");
but still no result.
If anybody knows how to obtain the result please help.
It's gtk not gtkmm but here you go.
http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=195381#p195381