How to set disabled appearance for an Actor - libgdx

I have a TextButton, and I would like to disable it.
I'm using the default skin.
I have learned that:
setDisabled does nothing
setTouchable(Touchable.disabled) works but does nothing with appearance
I checked the uiskin.json file but it only defines up and down states and nothing about disabled state:
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: { down: default-round-down, up: default-round, font: default-font, fontColor: white },
toggle: { down: default-round-down, up: default-round, checked: default-round-down, font: default-font, fontColor: white, downFontColor: red }
},
What should I do? Create a new style and apply it on the button when I disable it? Or is there a built-in state that I should use?

Create a new style or add to one of your existing ones. You can define a background drawable named disabled and a font color with disabledFontColor. When you omit either of these from your style, then that particular element doesn't change when the you call setDisabled.

setDisabled Does Work!
The reason why you're not noticing a sudden change in appearance is because you have not configured the state of the disabled button within the skin.JSON file or programmatically.
Cobolfoo has created a skin editor for you to use with libGDX. Last commit was 2 years ago but nothing has changed since and the skin-editor should work flawlessly.
Skin-Editor on github
I highly suggest you to take look at it, hence fiddling with skin files is just waste of time imo.

Related

Disable default highlight on hover in Apache Echarts

Echart version update highlight the line series on hover by default, is there any workaround or a fix for this issue? To keep it more static and not highlight the lineseries data?
I don't think echarts support this yet, a good option is to set the emphasis color and the normal color to the same value:
itemStyle: {
normal: { color: '#aColor' },
emphasis: { color: '#aColor'}
}

change border color on hover for Material UI TextField

I have been trying to change the hover color of Material UI's outlined TextFeild. It seems like it has many state like active, focus, focused:hover etc.
I have found this post on which address my problem but I don't want to add MuiThemeProvider every time.
I am able to achieve it some extend but still I can't change color on hover when it was not focused.
https://codesandbox.io/s/kx0zx9q7jo
It seems like your root styles became overridden at some point. Maybe its not ideal solution, but I got it working with !important keyword:
"&:hover:not($disabled):not($focused):not($error) $notchedOutline": {
borderColor: "red !important"
}

Animations when adding new class

My web application has 2 different modes: visual and interaction. Initially app is in visual mode. When user goes into interactive mode I add class "interactive" in container div. When this mode change happens and I add this class, some new divs show up which were hidden before.
I'm using rules of this kind in my CSS:
.interactive #somedivThatWasHidden{
height: 100%;
width: 20%;
}
My question is, when this transition happens. i.e., when I say $(".container").addClass("interactive"); I want these new divs to show up as animations ( sliding in from sides ).
You can use jQueryUI to do animations.
Check in here..
http://jqueryui.com/toggleClass/
You can also use jQuery animate function,
something like
$(".container").addClass("interactive").animate({
//do your things
});
http://api.jquery.com/animate/

Trying to hide an object / create a fold effect

I'm trying to create a rather unique effect. It's actually not that complicated, what I'm trying to do is build an experimental site, which I have already done. I just can't seem to figure out how to go about doing the final step.
So this is my site I'm tinkering with http://www.dig.ital.me/sandbox/about-me/
And what I'm trying to do is collapse the left-side bar that has the text in it : "Made in blah blah blah, etc." By clicking on the : " Click this to hide this " .
And I've tried going about doing an anchor link associated with a name link and calling the display:none when that link is clicked. However, it isn't working. So I thought I would try stackoverflow, on how I could about achieving this kind of effect where it collapses, and re-opens again.
#hide-option { color:#FFF; width:500px; height:500px; padding-left:170px;}
#hide-option:hover .fixedfooter {
display:none;
cursor:pointer; }
Here's a snippet of the hide-option div id. I've exhausted a lot of routes to try and achieve this effect but I cannot seem how to figure it out. I've tried the :onClick class, and nth-child classes, but nothing seems to work.
// Store the footer as a variable, so we don't have to keep calling jQuery's selector engine
// It's slower than a tortoise stuck in a traffic jam.
var target = $('.fixedfooter');
// Every time the hide-option link is clicked
$('#hide-option a').click(function() {
// If the left position of the target is 0
if(parseInt(target.css('left')) == 0) {
// Check the target is not animated and, if it is, animate off screen
!target.is(':animated') && target.animate({left: -751}, 250);
} else {
// Assume it's hidden, and put it back to the start
!target.is(':animated') && target.animate({left: 0}, 250);
}
// Stop the link being followed
return false;
});
JQuery, the JavaScript library, will solve it all for you.
$("el").bind("onclick",function(){$("el").toggle('slow');});
If you only want CSS3 (if you don't care about IE6-8), here's something you could try: http://jsbin.com/isunoz/6/edit
I've commented it as much as possible, I hope it helps :)
What I've done is to use a checkbox input to decide if the sidebar should be shown or not.
By putting the checkbox input element right before the sidebar element (div.fixedfooter) and changing your anchor (the arrow) into a label for that checkbox, I'm able to use the :checked pseudo class and the + selector to target the sibling element (in this case, the sidebar div.fixedfooter). If the checkbox is checked, the sidebar is moved out of the screen and if it's not checked, the sidebar is shown (left: 0).
For the animation I've used some css3 transition (transition: left .4s ease) :)

<blink> tag in Internet Explorer

Neither the <blink> tag nor the text-decoration:blink; style in css are supported in Internet Explorer.
Is there any technique available for making blinking text in IE?
Avoid blinking, if possible - it annoys people.
But you can do it with JS/jQuery like this:
setInterval(jQuery('.blinking').toggle, 1500 );
That'll show/hide anything with the blinking class every 1.5 seconds.
So in the HTML you would do:
<span class="blinking">hello!</span>
But again, think very carefully about whether it should be blinking!
If you need something to specifically draw a user's attention (and for whatever reason regular emphasis/highlighting/etc isn't good enough), then instead of on-off blinking (where the text dissappears for half the time), consider changing the colour, or a blinking underline/border, or similar.
The key thing is, if something is important enough to visually annoy the user then it should remain readable.
You can use this code:
$(document).ready(function () {
setInterval("$('.blink').fadeOut().fadeIn();",1500);
});
and a class link this
<div class="blink">BLING BLING...</div>
see working demo http://jsfiddle.net/SGrmM/
You can also use this code:
$(document).ready(function () {
setInterval("$('.blink').fadeOut(150).fadeIn(150);",1000);
});
see working demo http://jsfiddle.net/SGrmM/1/
see booth examples in the same fiddle http://jsfiddle.net/SGrmM/2/