"clip" flag for gui text labels.

This is the place to request new mods or give ideas about what could be done.
Post Reply
dgnuff
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri Feb 24, 2017 8:06 pm
Contact:

"clip" flag for gui text labels.

Post by dgnuff »

It's been discussed elsewhere that making gui text labels wrap is not really possible with the current library in use.

Even so, is it possible to mark a label as single line, and then clip the text if it overflows. Even cutting it in the middle of a letter is OK, I just don't want it extending past maximal_width.

The aim is to get the effect of using the Win32 API DrawText() with the DT_SINGLELINE flag and not using the DT_NOCLIP flag. https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Standard Code Rant applies here: I haven't seen the source so I have no idea how hard this is, or if it's even possible. :)

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: "clip" flag for gui text labels.

Post by Klonan »

In 0.15 you can set labels to wrap properly across multiple lines

dgnuff
Burner Inserter
Burner Inserter
Posts: 15
Joined: Fri Feb 24, 2017 8:06 pm
Contact:

Re: "clip" flag for gui text labels.

Post by dgnuff »

My apologies, I didn't make it 100% clear what I want.

Firstly, it's great to hear that wrapping text is coming in 0.15. However, in my use case, I have a label that I'm using as part of a row in a scroll-pane. In this instance, I only want it to show a single line of text so that I can strictly control the height of each row in the scroll-pane. Since the text is generated at run time, it's possible that it may overflow the width I've set for the field.

I don't know the details of the library you're using, but if my hypothetical clipping was enabled, then you'd take the first point where you've split the text into multiple lines, and simply discard the second and subsequent lines.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: "clip" flag for gui text labels.

Post by Klonan »

dgnuff wrote:My apologies, I didn't make it 100% clear what I want.

Firstly, it's great to hear that wrapping text is coming in 0.15. However, in my use case, I have a label that I'm using as part of a row in a scroll-pane. In this instance, I only want it to show a single line of text so that I can strictly control the height of each row in the scroll-pane. Since the text is generated at run time, it's possible that it may overflow the width I've set for the field.

I don't know the details of the library you're using, but if my hypothetical clipping was enabled, then you'd take the first point where you've split the text into multiple lines, and simply discard the second and subsequent lines.
Thats also added in 0.15, where if its too long is will simply clip the string and add '...' to the end

Post Reply

Return to “Ideas and Requests For Mods”