How do I align dropboxes regardless of the length of the labels? - ruby-on-rails

I'm using rails and I have and then <%= select ...>. But there are three rows of this and the dropboxes start right after the label ends and the labels are all of different lengths so the dropboxes are not aligned. I'm not really sure what part of my code I need to change to set how they are aligned. CSS? I have some ideas (creating a table, making a class etc.) but they're not working so I was hoping someone could let me know what direction to go in.

Put a class onto your label tags, then in the css for that class you need to:
add a fixed width that is larger than the largest label
make sure the label has "display: inline-block" or "display: block"
because it needs to behave like a block-style (rather than a
span-style) object to force widths on most displays.

Related

how to set which label should be truncated if labels overlap?

i have a similiar problem as asked in How to resolve the Storyboard's warnings on Xcode?
However my left label can get really wide at runtime and the standard behaviour is, that the right label is truncated. How can i force the interface builder to truncate the left label and not the right one?
Both texts in the labels are set on runtime, so i have no knowledge of the resulting width of each label.
As stated above i used the solution from the linked question but the wrong label is truncated. So my problem differs from the one stated in the link.
There is a property called content compression resistance.
This determines how hard it resists compression of content.
So... for the label that you want to keep full length run this...
label.setContentCompressionResisyancePriority(.required, axis: .horizontal)
I’m typing on my phone so I may have messed up the parameter names. But auto complete will help.
This will make sure that the other label is truncated first.
You can also set this in IB in the measurements panel near the bottom.

Clarity: Is there a recommended way to make clr-datagrid take up all available vertical space?

I am trying to make my take up all vertical space even if there are no rows in the table yet. Is clr-datagrid customizable to do so? It seems like I have to manually override flexbox properties of .datagrid-host and .datagrid-overlay-wrapper in order to make it grow in column direction.
I tried even that but the datagrid don't seem to be growing vertically.
The Clarity datagrid supports any fixed height you want on the datagrid element itself. If the height is too large for the number of displayed rows, the body will expand with empty space. If the height is too small for the number of displayed rows, the body will scroll while the header and footer remain in place.
So in your case, it's as simple as putting height: 100% for the datagrid in your CSS. That's all you need to do. See https://plnkr.co/edit/eZqaic8CS6CFHVcGxAnH?p=preview for a working example.

Center label after dynamic text update in Axure

I've got a label we'll call selectedTextLabel with multiple labels underneath it forming a list (yes, I know about repeaters), when I select one of the lower labels I throw in that label's text description into selectTextLabel. The problem I've running into is that, though selectedTextLabel is aligned center (positionally) and the text within it is center aligned, when new text that is longer or shorter than the original gets put within it from an action, it keeps the same top left xy coordinants and increases or decreases the width accordingly making my design look misaligned.
It's almost like it's not obeying text-align: center on dynamic text like it does in the editor.
Does anyone know a solution? Is this a bug? I've googled but only have gotten editor based answers as opposed to dynamic browser based answers.
Thanks.
After an insight, it turns out it's rather easy. You just have to make the label the full width that you want it to be centered within. Then if you have text align center set, it'll keep the text centered.
What was happening in my instance was that I only had the label set to the width of the first selection and since the label didn't know what to do when something longer was set as the text, it expanded it's width but kept the same top left x and y coordinants, making the new center misaligned.
I hope this helps someone out there.

How to apply constraints to multiple line labels in StoryBoard?

I have static data on my Screen. I have taken labels to display it, but when I am going to apply constraints on it for iPhone 6 then it displays data in single line at preview screen. Please send me solution which constraints I have to add.
You can do the following:
Set height constraint for multiple label
Select it throw builder
Change 'Relation' property to 'Greater Than or Equal' (to automatically resize content depend on text)
Set 'Lines' property of target label to '0'
like so
Basically, you need to provide each element's height,width,x-position,and y-position.
If you are not sure, just drag the elements to wherever you want them to be (be careful about those alignments), and use 'Add Missing Constraints' or 'Reset to Suggested Constraints'.
Though I highly don't recommend using them, you may end up manually modifying the constraints by yourself.
You need to be more specific so that we can offer more help.

How to handle long text UILabel

I have a view which has a lot of labels. Some of them get the text set dynamically. Sometimes the text is to long to display it within one line. I know how i can display the text in multiple lines. My problem is that when i do display the text in multiple lines then the margins are broken between the labels. Sometimes a label even swapes into the content of the next label.
I want to avoid fixing this "by hand" (repositioning of all other elements). Maybe Autolayout can fix this, but sadly i'm not able to use it for now. But it would be a good argument to convert my project from springs&struts into autolayout. However, maybe there is another way to fix this issue. Would be nice if somebody can help me out. Thanks in advance!
You can use sizeWithFont:constrainedToSize:lineBreakMode: to calculate the height which will be required by each of the labels. You should use this in a loop which iterates over each label in the order they should appear on screen. As you go, increment the y position by the height of the current label and the margin. Each label will now have the correct position and at the end of the loopy will hold the full required height.

Resources