New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling elements; add :focused
and :disabled
states
#10291
Conversation
Great job as always :)
|
Sorry, but these aren't very feasible just yet:
None of these are final. It's just that Irrlicht limitations don't make these possible on a short-term basis, so this PR in particular won't add them. Later, when we do styling revamps on other elements, these features will almost certainly be added. |
If I get you right, you are using I consider this to be misleading. Focused means the element is basically the "last selected element". The opposite of |
No, Also, forgot to mention, but (pwd)fields and textareas now have gray text when disabled by default. |
Sorry for the misunderstanding. |
Closing all my inactive formspec PRs. There's little interest in them as of now and the formspec replacement is making fair progress, and I want to avoid causing more problems like #10083 due to my interests being divided between the replacement and extra features on the current system. If anyone really thinks that any of these are essential and gives a good reason why it really can't wait for the replacement (better than saying that one mod needs it), I'll reopen. I know an argument might be put forth that there's no knowing when the formspec replacement will come out, but I really think that it will become a reality, although maybe not soon. I might not display my progress prominently, but it's moving along at a steady rate. |
Formspecs will not be replaced anytime soon by modders, man. |
True, but that doesn't mean that we have to keep adding features to them forever. As I said, I'll reopen them if there's enough interest, meaning multiple mods need it. ATM, I'm trying to focus my work without a lot of sidetracking (and get the PR count down a little). For instance, I left #8679 open because multiple people expressed how useful it would be, while the others I closed had no such modder support. |
This PR allows formspec elements to be disabled with
set_disabled[<name 1>,<name 2>,...]
and styled with the:focused
(last interacted with element) and:disabled
style selectors.Nearly all interactive elements can be disabled, with the effect of graying out the text for most of them (it all depends on what Irrlicht decides to do). Disabled buttons, by default, have gray text and a
content_offset
of 0 when pressed. The default button border also does not indent in the pressed state when disabled. This cannot be changed, but I doubt anyone would want such behaviour on a disabled button anyway.The
:focused
selector takes lower precedence than everything except:default
whereas:disabled
takes highest precedence.This screenshot shows all the features. The right elements are disabled elements, whereas the left are enabled. The bottom two buttons use the
:focused
and:disabled
selectors combined with other selectors.To do
This PR is Ready for Review.
How to test
Make sure disabled elements don't interact at all, especially buttons; check that selectors work properly, including combination. The above screenshot: