[Request] Text Object CSS support

Discussion and feedback on Construct 2

Post » Wed Apr 06, 2016 11:08 pm

Was there any particular reason CSS is supported for form elements like Button or Textbox but not Text?

It would be a huge boon for me to be able to style text objects directly for certain UI elements, rather than making a sprite or 9-patch to pin the text to and having to set up containers or manipulate them seperately.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Thu Apr 07, 2016 6:36 am

+1 Yes, currently we can use the Set CSS Style action for form elements, but it would be better if the Text object could be formatted like that too.
Also, an action to load a CSS file to format elements would be nice, since now we have to set up all CSS commands in seperate actions. If the webfont can be set from a CSS file, why not the formatting too?
B
129
S
33
G
17
Posts: 1,552
Reputation: 20,515

Post » Thu Apr 07, 2016 4:50 pm

Actually now I think it has to do with how text objects are rendered as part of the game while form objects are layered html elements on top of the game.

Which is unfortunate as layers/blending modes can't be used properly in conjunction with form elements

If that is the problem, would it be difficult to at least add border and background color settings/properties to the text object?
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Fri Apr 08, 2016 8:36 am

Form elements are HTML elements floating over the page, so can use CSS but not layering/blending/effects, whereas text objects are in the canvas so can't use CSS but can use layering/blending/effects.
Scirra Founder
B
387
S
230
G
88
Posts: 24,251
Reputation: 192,464

Post » Fri Apr 08, 2016 12:33 pm

Ashley wrote:Form elements are HTML elements floating over the page, so can use CSS but not layering/blending/effects, whereas text objects are in the canvas so can't use CSS but can use layering/blending/effects.

Thanks for the clarification. I thought that the text object is also a HTML element.
B
129
S
33
G
17
Posts: 1,552
Reputation: 20,515

Post » Fri Apr 08, 2016 5:40 pm

That makes sense, thanks.

Any chance to add some properties for the text object such as border, background, strikethrough/underline (while I'm at it maybe some wishful thinking like shadow and stroke)? Possibly for C3?

The usage for me would be dynamic buttons, labels, or menu items as a single object. In the case of menu items if I need to clip a scroll-able menu to a part of the screen, I would use blending or layer something on top to cover the margins.

Using a text and a sprite object together with containers is fine now, just a little clunky. As a beginner I definitely had some trouble wrapping my head around containers and how to use them properly though.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to Construct 2 General

Who is online

Users browsing this forum: R0J0hound, vikuserro and 1 guest