- Apr 2, 2018
- 258
- 492
Hi guys,
I've come across a minor problem (non-blocking), I could very well continue with the current code but it's triggering me a bit. So after a few hours searching various forums, I haven't really managed to find a fully functional solution.
1. What do I want to achieve?
I want a button with text that, when clicked, displays a vbox with its content.
The button is accompanied by a small arrow to its right, which points to the right when the vbox is hidden and is also clickable (performs the same action as clicking on the text) . When the text OR the arrow get a click, it rotates the arrow 90° downwards (or reset to 0° if this is the 2nd click, to make the vbox and its contents disappear) .
As you can see in the example, there are several buttons, each with its own child vbox and each independent of the other (when I click on one, only the child vbox of the clicked button is displayed).
2. What way did I choose to achieve this?
So, as you can see, I opted for the solution with my text in the form of a textbutton and the arrow in the form of an imagebutton. The 2 do the same actions and..., well, it works perfectly.
So you're going to say, what's the problem then?
Well, the problem with this choice is that when my mouse cursor is over the textbutton, it triggers the hover style for the text, but not the hover style for the imagebutton... (and vice versa).
So far there's nothing abnormal about it, it's normal behaviour given that it's two separate elements.
But unfortunately, that's not what I'm looking for - > when I move my mouse over one or the other, they should both have the same style.
That's where I'm struggling to find a solution.
Is there a way of triggering the other's hover style at the same time? Or change the idle style of the other element only when the first one is hovered?
I don't think I've seen anything in the documentation (
Maybe the Function() one ? Like if hovered, "found the element with the id passed in parameter and apply the style passed in parameter"
I've also tried another way with a simple button containing a text element. And in a custom style, add the image in the form of a background.
This solution solved the issue (the text and the arrow both reacted to the hover at the same time) but now it's impossible to move the arrow (stuck on the left of the text), I tried adding some left_padding or right_padding but without success. And then there's the problem of the transform to rotate the image, how do you just apply it to the background image?
I also thought of creating an imagebutton with the text directly integrated into the png, but the problems are :
Am I looking too far when the solution is perhaps very simple? Am I approaching the solution in the wrong way?
Thanks in advance to those who will look into this little problem of mine.
I've come across a minor problem (non-blocking), I could very well continue with the current code but it's triggering me a bit. So after a few hours searching various forums, I haven't really managed to find a fully functional solution.
1. What do I want to achieve?
I want a button with text that, when clicked, displays a vbox with its content.
The button is accompanied by a small arrow to its right, which points to the right when the vbox is hidden and is also clickable (performs the same action as clicking on the text) . When the text OR the arrow get a click, it rotates the arrow 90° downwards (or reset to 0° if this is the 2nd click, to make the vbox and its contents disappear) .
You don't have permission to view the spoiler content.
Log in or register now.
As you can see in the example, there are several buttons, each with its own child vbox and each independent of the other (when I click on one, only the child vbox of the clicked button is displayed).
2. What way did I choose to achieve this?
You don't have permission to view the spoiler content.
Log in or register now.
So, as you can see, I opted for the solution with my text in the form of a textbutton and the arrow in the form of an imagebutton. The 2 do the same actions and..., well, it works perfectly.
So you're going to say, what's the problem then?
Well, the problem with this choice is that when my mouse cursor is over the textbutton, it triggers the hover style for the text, but not the hover style for the imagebutton... (and vice versa).
You don't have permission to view the spoiler content.
Log in or register now.
So far there's nothing abnormal about it, it's normal behaviour given that it's two separate elements.
But unfortunately, that's not what I'm looking for - > when I move my mouse over one or the other, they should both have the same style.
That's where I'm struggling to find a solution.
Is there a way of triggering the other's hover style at the same time? Or change the idle style of the other element only when the first one is hovered?
You don't have permission to view the spoiler content.
Log in or register now.
I don't think I've seen anything in the documentation (
You must be registered to see the links
) that meets my needs.Maybe the Function() one ? Like if hovered, "found the element with the id passed in parameter and apply the style passed in parameter"
I've also tried another way with a simple button containing a text element. And in a custom style, add the image in the form of a background.
You don't have permission to view the spoiler content.
Log in or register now.
This solution solved the issue (the text and the arrow both reacted to the hover at the same time) but now it's impossible to move the arrow (stuck on the left of the text), I tried adding some left_padding or right_padding but without success. And then there's the problem of the transform to rotate the image, how do you just apply it to the background image?
I also thought of creating an imagebutton with the text directly integrated into the png, but the problems are :
- (Minor but a pain in the arse) Duplicate the image for each different text.
- How to manage just the rotation (with animation) of the arrow without affecting the text?
Am I looking too far when the solution is perhaps very simple? Am I approaching the solution in the wrong way?
Thanks in advance to those who will look into this little problem of mine.