Increased fontsize of ttk::treeview leads to overlapping rows - tcl

If I change the fontsize of a treeview (that is already created) from e.g. 8 to 16 the rows overlap each other. I made some attempts to change the padding but I had no success. Other widgets change automatically their size in the right way if I change the font size, but not the ttk::treeview widget.

You can use the option -rowheight, however :
... The -rowheight value is not corrected by the tk scaling value or by the configured font size and must always be set ...
More about styling this widget: ttk::treeview manual page
Saludos!,

Related

PDFlib - trimming pages

I am trying to figure out whether it's possible to trim a PDFlib page AFTER its dimensions have been set.
For example, I have a non-standard page that is 500x10000pt:
$p->begin_page_ext(500, 10000, '');
...
$p->end_page_ext('');
After I'm done adding elements to it, I will know how tall that page should be.
How can I trim that page to the height of 2000pt?
How can I trim that page to the height of 2000pt?
by simple using:
$p->end_page_ext('width=500 height=2000');
It's just important that this will reduce the page dimension from the origin (lower left). Otherwiese you might use the cropBox Option to crop the page to some special area. For example:
$p->end_page_ext('cropbox={100 100 600 2100}');
Please see PDFlib 9.2 API Reference, chapter 3.3 for details for all option of end_page_ext().

KDE widget - problem with icon size and the parent item

I would like to modify the KDE widget User Switcher to let the user decide the size of the icons to be shown in the fullRepresentation view. The user set a value in a combobox in the settings, and the view should automatically update.
To achieve this, I've added the code iconSize: getIconSize(combo_currentIndex) in each ListDelegate instance. Here, getIconSize is a simple javascript function that returns the specified value from units.iconSizes.
Then, I tried two approaches:
Approach 1: In ListDelegate.qml I have created the property alias iconSize: icon.Layout.minimumWidth. It doesn't work, the widget load and shout out this error: ListDelegate.qml:41:30: Invalid alias target location: Layout.
Approach 2: In ListDelegate.qml I have created the property int iconSize: units.iconSize.medium (I chose medium because that's the default option in the user settings). Then I changed the Layouts properties of the PlasmaCore.IconItem as follows:
Layout.minimumWidth: iconSize
Layout.maximumWidth: iconSize
Layout.minimumHeight: iconSize
Layout.maximumHeight: iconSize
At this point, the size of the icons changes accordingly to the user settings. But the ListDelegate item height remain fixed (as it were still using units.iconSize.medium), therefore the icons overlaps when the user chooses an icon size greater than medium.
What can I do to solve this problem?
After reading the docs, I have fully understand how Layout works.
The solution of Approach 2 is quite simple. I also needed to set the correct values to the Layout properties minimumHeight, maximumHeight and preferredHeight of the parent element (which is the RowLayout row):
Layout.minimumHeight: units.iconSizes.tiny
Layout.maximumHeight: units.iconSizes.enormous
Layout.preferredHeight: iconSize
The code should be self explanatory. In doing so, the parent RowLayout element is able to correctly change it's height to accomodate the icon.

autosizing movieclips to match text size (AS3)

I'm looking to add a specialized border around some dynamic text.
A special type of border that filters just can not produce
So I need this border to match the length of the dynamic text.
Unfortunately this code is not working
thistext.autoSize = TextFieldAutoSize.LEFT;
border.width = thistext.width;
What happens is, the border width is set to the initial starting width of the text and is not changed as the width of the text changes
Any ideas on how I can make this work?
You should rather listen only to text changes : flash.events.Event.CHANGE, instead of checking every frame.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.html#event:change
Besides, you may use textWidth attribute to get actual text width, no matter the value of autosize attribute (Width must be set to the maximum width). I'm not a huge fan of auto size feature which hides the maximum width, although it exists internally ( equal to the width attribute of the textfield, BEFORE setting autosize..). I'd rather have a less "magical" but more clear behavior, but it's debatable, especially if your text has to interact with the mouse (click,hover..), then you can take advantage of the bounds being automatically updated
I actually caught my mistake.
I need to add the code into an event listener that checks every frame AFTER the dynamic change so this code works
border.width = thistext.width;

How to style a mutiple select box so it always displays every option?

I have a multiple select box that is dynamically populated. I want all of the options to be displayed, rather than a limited size. Is there an attribute that allows this or other method to cause all options to display?
You can use the HTML attribute size to indicate the number of options you'll want to display. I'd figure out the number of options through your script and add that number to the size attribute.
<select name="select" multiple size="10">.
There is no attribute that will cause it to change size dynamically, but you can always use Javascript to dynamically change the height of the select box. Note of caution though: this might not work on older versions of IE, or IE set to a lower compatibility mode.

IE <select>, how to make the displayed width the smallest possible for the current options

I've written a function which takes a <select> ID, and replaces all the options with new ones (using jQuery's html()). However, on IE the width of the dropdown remains the original one which has a size way bigger than what I need to display, because is based on the original <option>'s that had long strings captions.
Is there a way to force the <select> to recalculate it's width?
I am using IE 8.
I think the pragmatic solution would be to replace the whole <select> element. This way, the newly inserted one will have the correct width for its <option> elements (disregarding any other styling that may be applied).
The thing to bear in mind if replacing the whole select is that any references to the replaced element will need to cleaned up prior to removing it from the DOM (to avoid any potential memory leaks) and event handlers attached to the newly inserted element.
It's possible to set its width through css.
In your case I would approach it using this method:
If you are using em's or ex's as font size units, then since it is a value based on height, you can assume using a certain ratio that it is almost near the equivalent of a character's width. Based on that, you can actually calculate how wide your select element would be by:
1st: get the number of characters of the smallest string from the select options.
2nd: multiply that by the em value.
3rd: set this value as the select's width.
using jquery that would be achieved through:
var em = 1em; //assign here a value, that corresponds to your layout's font size
var shortest = 6500;
$('mySelect').each(function(i, selected){
temp = $(selected).text().length();
shortest = (temp < shortest) ? temp : shortest;
});
$('mySelect').css('width',(shortest*em + 1) + 'em'); //add 1em for the scrollbar