GUI: Allow different font color for checkbox & radio states

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

GUI: Allow different font color for checkbox & radio states

Post by aubergine18 »

Unlike buttons, checkboxes and radiobuttons don't allow different colors for their different states: default, hover, clicked, disabled.

(They don't have a disabled state either, it would be nice if that could be added, along with way to disable GUI elements)

It would be nice if they had some extra prototype properties similar to those of button prototypes:

Code: Select all

default_font_color
hovered_font_color
clicked_font_color
disabled_font_color
If a modder wants to change colors when checkbox is checked or radio button is selected, it can simply listen to the associated GUI event and change the style of the GUI element to one which has alternate color scheme.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: GUI: Allow different font color for checkbox & radio states

Post by ssilk »

Isn't that already possible?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: GUI: Allow different font color for checkbox & radio states

Post by aubergine18 »

For buttons, yes = they have background image states and fort color states. But not for checkbox or radiobutton - they have background image states (the square or circle in case of checkbox/radiobutton), but not font color states. There's no events fired for the mouse states (eg. on hover) so no way to mimic the functionality via hacks either.

See __core__/prototypes/styles.lua for examples between 'button_style' and 'checkbox_style' or 'radiobutton_style' prototypes.

Note: I could be wrong - if someone has code showing it working, please post it! (Specifically: font color changing on hover and on click - via stylesheet not code hacks).
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: GUI: Allow different font color for checkbox & radio states

Post by ssilk »

Well, but the implementation you suggest is ... wrong (sorry :) ). You need to do that CSS like, create some definitions of
default, hovered, clicked, disabled and that includes also background images, border thickness and color, background color etc. etc. in a way, where the default can be inherited to the others, that overwrite only parts. Just like CSS.

Example: http://www.w3schools.com/CSSref/sel_hover.asp
http://www.w3schools.com/CSSref/tryit.a ... link_more1
http://www.w3schools.com/CSSref/tryit.a ... link_more2
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: GUI: Allow different font color for checkbox & radio states

Post by aubergine18 »

Yes, I'd love to do it CSS style (not sure how performant that's going to be in a game context - it works fine for browsers with decades of fine tuning, but might be too slow/cumbersome for a game to implement).

The way the game currently does it with buttons, while not ideal, is sufficient if it could be extended to checkboxes and radio buttons. It all depends on what the devs are planning to do with this planned GUI overhaul that was mentioned in the recent #FF. I'd very much like pseudo states :hover, :select, :active etc on all entities, but at the very least I'd like button-style capabilities on radio and check entities.

One other thing I'd very much like is just generally more consistency in the stylesheets and Lua API. I can see they're going for monomorphism in the approach currently taken, but I'm not sure it's an effective approach for GUI stuff. I've been chipping away at a consistent set of properties for my Style mod, like standardising top-left position of an image to a "pos" array, regardless of how the different types of images (composition, monolith, raw, animation, etc) all have different properties for defining top left (some are array, others are x,y, etc).
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Ideas and Suggestions”