How do I set Textbox ID (optional) w/Event

Get help using Construct 2

Post » Tue Sep 22, 2015 10:00 pm

I want to change the Textbox Property field ID (optional). Is there way to reset the ID name based on an Run time event not just a manual in the Editor. This is not the UID, nor the IID of Textbox object field created with each object. I am referring to the Properties dialog that has the Properties fields; Text, Placeholder, Tooltip... and at the bottom of the list, "ID (optional)" field which is defined as having the property, "An ID for the control allowing it to be styled with CSS from the HTML." I want to reset the ID name based on a Run time event. Just like I can "Set tooltip", I want the Textbox Set ID (optional) to a new name in order to change its #Name CSS appearance.

During Edit, Textbox named "Activity" manually set Properties "ID (optional)", to "ActivityA", in order to change its appearance within a single style sheet using a new name ID (optional). I know it is possible to swap between style1.css, style2.css, etc, however, I do not want to create new CSS files for every object's new appearance. If it is possible to change the ID (optional) field, than all that needs to happen is to change the Textbox object pointer to from #Activity" to "#ActivityA" and the new style elements would be applied. With that, I can get a new style for some of the CSS elements without swapping out entire CSS files by just changing the Textbox ID based conditon such as, var Textbox = "Is Active". I know that I can use the builtin "Set CSS style" action to reset each style element. However, my project(s) will have hundreds of these types of action that I do not wish to have to add or edit each one with every minor CSS style change. I would be nice to be able to make global changes to a project by making minor CSS file edits and let the code do the rest. Thanks for any help with this question/desired feature.

I hope this is just something that I have yet to find because my work life would be much better if it exist. It would be nice to have an object On created ACE option to set the ID also. :)

A simple sample of an ACE and the linked CSS style.css data is below.

Editor
Textbox named "Activity"
Set Property ID (optional), = "ActivityA"

During Run time,
If Activity Is Active
Textbox Set ID ActivityA


Sample CSS file style1.css

Activity, #ActivityS, #AdditionalText, #Adjective {
font-size: 14px;
font-weight: normal;
text-align: center;
border-width: 2px;
border-radius: 20px;
border-color: rgb(0,0,0)
}

#Activity:hover, {
border-color: rgb(255,0,0)
}

#Activity {
background-color: rgb(255,107,51);
}

#ActivityA {
border-color: rgb(255,0,0);
}

#AdditionalText {
background-color: rgb(255,25,255);
}

#Adjective {
background-color: rgb(127,255,212);
}
B
70
S
9
G
8
Posts: 24
Reputation: 8,731

Return to How do I....?

Who is online

Users browsing this forum: Huemerson, Lancifer, newt, ultrafop and 12 guests