Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
kfahri342
New Contributor III

Colour change to text box when clicked on

Hi all,

I have a few text boxes that when clicked on - it will toggle on/off a criteria I have set under Actions.

Is there a way to change the colour of the box, so I have one colour when it is toggled on and another colour for when it is toggled off.

I hope this makes sense. Let me know, otherwise.

Kind Regards

Kozan

1 Solution

Accepted Solutions
atkinsow
Valued Contributor II

Re: Colour change to text box when clicked on

See if this meets your need. 

Pressing button switches color back and forth.

Pressing Clear will cause the button to go back to default Blue.

17 Replies

Re: Colour change to text box when clicked on

May be you need to do this in Photoshop only. Then use those in your application

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Partner
Partner

Re: Colour change to text box when clicked on

Assign Variable some value like On = 1 and Off = 2.

Set the Text box color based on the Variable value like Ex. if(vColor=1,Green(), blue())

atkinsow
Valued Contributor II

Re: Colour change to text box when clicked on

create a variable that gets updated when the text box is clicked on.

Like:

let vButtonColor=0

Then in your action Set External >> Set Variable

=not $(vButtonColor)

Then in your object background color select calculated and enter a formula something like

=if((vButtonColor),Red(),Blue())

tom2qlik
Contributor

Re: Colour change to text box when clicked on

To do this create a variable for when a textbox is clicked.

In your textbox properties select actions and add.  Select "External" from the list on the left and "Set Variable" from the list on the right then hit ok.

In the value box type the formula " =if(VariableName = 0, 1, 0) "

Next click on the general tab.  Look for the button next to "Color" under background.

In the Base color area select "Calculated" and enter in the following formula into the expression box.

if(vChange=1, rgb(0,240,16), rgb(210, 210, 210))

Change the RGB values to your desired colour's.

You can apply this process to each textbox that you have and the background colour of each will change on click.

Hope this helps.

kfahri342
New Contributor III

Re: Colour change to text box when clicked on

I would expect the colour of the text to go back to the original colour if the User hits the clear button. This doesn't happen.

Anyway around this?

kfahri342
New Contributor III

Re: Colour change to text box when clicked on

I would expect the colour of the textbox  to go back to the original colour if the User hits the clear button. This doesn't happen.

Anyway around this?

atkinsow
Valued Contributor II

Re: Colour change to text box when clicked on

You would need to add an action at the document level to change the variable value.

On the OnAnySelect level.

something like

if(isnull(GetCurrentSelections()),vButtonColor,)

in the variable name field

and the

Value is still          not $(vButton)

passionate
Valued Contributor

Re: Colour change to text box when clicked on

Hi Kozan,

There are multiple solution to your query.

1. Add action to your text box which have action for clear all

2. PFA solution.

Regards,

Pankaj

kfahri342
New Contributor III

Re: Colour change to text box when clicked on

Hi, I don't fully understand how to pull this off. Are you able to do some screenshot or provide a document if not too much trouble.

Apologies for my ignorance, but I am new to this.

I have managed to complete what you mentioned in your earlier post so far, but every time I hit Clear the colour still doesn't reset :

"create a variable that gets updated when the text box is clicked on.

Like:

let vButtonColor=0

Then in your action Set External >> Set Variable

=not $(vButtonColor)

Then in your object background color select calculated and enter a formula something like

=if((vButtonColor),Red(),Blue())"