I have a textfield component with a label for errormessages. Whenever a errormessage appears, it missplaces the field with the error.
Is there anyway to preallocate the space needed for the errormessages?
Put your text label inside div with fixed height or width. Your space will always be there, and you show your text based on your error.
Related
I'm trying to figure out which piece of CSS is making the text shrink by a very tiny but noticeable amount in the cells when you select one of them
Here's a code sandbox. Just click on one of the cells to focus it and you'll see what I mean:-
https://codesandbox.io/s/material-ui-table-virtualized-t2xkt
NOTE: when you select a cell, it replaces the plain div with a customised Material UI TextField
Which CSS property do I need to adjust to ensure that the text size and position stays uniform when the cell is focused or not focused?
You were right it was the padding. Solved it by remove a pixel from the padding-top in the div within the table cell when not focused
I have a dynamically built string that is sometimes too long, but still needs to be displayed fully to the user. I would much rather have the text scroll than creating a tooltip for it.
I have creating a label with this:
Label text = new Label("hello there i hope this text is long enough to take up space");
TranslateTransition tran = new TranslateTransition(Duration.millis(75000));
tran.setNode(text);
tran.setByX(-400);
tran.setInterpolator(Interpolator.LINEAR);
tran.setCycleCount(Timeline.INDEFINITE);
// add the text
tran.play();
One, when I do this, if the text is "this is really long" and it's shortened to "this is really..." then when the label scrolls, the text remains "this is really...". Another thing is this scrolls the label away, changing the x position of the element. Is there a way to just change the text will a scroll instance?
Also, is there a way to programatically determine if a given text is going to be too large for a specified area?
The most simplest method could be "marquee":
http://www.quackit.com/html/codes/html_marquee_code.cfm
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee
http://www.sitepoint.com/web-foundations/marquee-html-element/
But it´s nonstandard: http://www.w3.org/TR/css3-marquee/
A better method is CSS3: http://www.hongkiat.com/blog/css3-animation-advanced-marquee/
I have a QComboBox which I have populated with addItem() repeatedly, and then selected an item with setCurrentIndex(). The trouble is that some of the text is wider than the width of the box and it shows the text moved to the left so the right-hand-side is visible. I want the text in the edit box to be positioned the same as the text in the drop-down box (so the start of text is visible on the left-hand-side, and any oversized text unseen on the right).
Some suggested reasoning: I think it may be trying to ensure the cursor is visible, after leaving the cursor at the end. But I have tried using setCursorPosition(1) but there is no such function in QComboBox.
I'm looping through a recordset, and for each item I create at runtime a spark Label and set the text property from a field of the recordset. The labels must have a fixed width and some text goes multiline.
I want to arrange the label vertically so I need to know the height of the label so I can place the next label properly, but when I try to read this property, after the labels is added through the addElement method, it returns 0.
Do you know how to get the label height?
Use a VGroup or a List for this instead. It will automatically handle this kind of behaviour for you. Make sure to set variableRowHeight to true.
Cheers
I have a Tree object in my Flex code. It's width is 100%, and it is contained by a Panel with width=200. I am using a custom itemrenderer that extends TreeItemRenderer.
I need the text in each node to word wrap if it's too big (as happens often). I have tried
label.wordWrap = true;
in my item renderer without any luck. Any other suggestions?
If 'label' is an instance of the Label component, you won't be able to get it to wrap, no matter what you do, as the Label component doesn't support wrapping. Or, rather, is meant to be used only for single-line text.
If you are using a Label component, try using a Text component, instead. It's meant to display multi-line text.
With the default TreeItemRenderer you just need to set two properties on your Tree to enable wordWrap:
tree.variableRowHeight = true;
tree.wordWrap = true;
Enjoy.
What is the height that is set on the label? Is there enough room for the text to go vertically?
try setting the label width to a constant width. If your not able to do this because it needs to be dynamic then you need to override the update functions and set the width of the label then. The problem is the label hasn't calculated the actual 100% width at the time of rendering so it doesnt know it has to warp or not.
Dont Use Label. Use ' mx:Text width=" 100%" ' ( Text with 100% width) and it will wrap on its own.