[SOLVED] Variables in CSS?

Discussion and feedback on Construct 2

Post » Wed Nov 16, 2016 10:06 pm

Hi there,

simple but also complicated question:
Is there any way to use compare global variables into CSS in C2?

The background:
I want to change the cursor style depending on a variable.
Yeah, I'm aware of the Cursor: set style action, but that doesn't include "not-allowed" as of yet, and that's what I need...

If there's another way to do this apart from CSS, I'm fine with that too.
Last edited by randomly on Wed Nov 30, 2016 4:28 pm, edited 1 time in total.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 16, 2016 11:09 pm

Can you explain a bit more? I don't get what you want under compare global variable into CSS.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Wed Nov 16, 2016 11:34 pm

@glerikud
Well, I want to set the cursor property to "not-allowed" on an object if [value] = 1.
If [value] = 0, I want to set the cursor style to "normal".

This would be possible without CSS, if there was an action to set the cursor style to "not-allowed" inside C2.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Nov 17, 2016 9:56 am

You can do a workaround using the Browser object's Execute Javascript action. Is this what you want to achieve?
https://dl.dropboxusercontent.com/u/166 ... r_css.capx
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Sat Nov 19, 2016 2:58 pm

@glerikud Thanks for your answer, unfortunately, I'm not able to download r240 atm, because of internet issues.
But I'll have a look at it asap.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Nov 20, 2016 8:35 am

Take your time :) Just let me know how that solution worked out for you.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Wed Nov 30, 2016 12:49 am

@glerikud
Just looked through your .capx.

Awesome! Thanks! Short code, big result.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 30, 2016 2:44 pm

I'm glad I could help. Happy developing. ;)
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717


Return to Construct 2 General

Who is online

Users browsing this forum: Tokinsom and 8 guests