Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Change Button Color Conditionally!

Dear Community,

I am trying to change the button (text object) color dynamically.

I am using a variable 'vButtonColor' set as 0/1 to calculate the color of the object. Also, the text of the active button must be bold.

While it is done, how can I change the color of all inactive buttons to gray while the active button remains green?

Please find the document attached herewith.

Regards & Thanks,

-Khaled.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you need to be able to distinguish between the different buttons pressed, so you need to use separate variables for each button or one variable and setting different variable values.

I am using a new variable vActiveSheet and just setting the target sheet id in the action.

Then I use conditional colors for the background / text color depending on the variable value.

Instead of setting the variable in the button / text box action, you could also use the action in OnActivateSheet trigger in the sheet properties, so it also works when selecting your sheet on the tab row. Since I assume you want to hide this tab row anyway, the implemented method should be enough.

Regards,

Stefan

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

From your example, you want to change the text box colour based on the active tab?

These examples change the tab colour when the user changes the current tab:

http://community.qlik.com/message/115252#115252

http://community.qlik.com/message/31575#31575

You could use the same logic to change the text object colour.

But if I may make a suggestion. Your tab selection text object exists on each tab. Why not set the active tab colour manually on each tab? See the attached.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
swuehl
MVP
MVP

I think you need to be able to distinguish between the different buttons pressed, so you need to use separate variables for each button or one variable and setting different variable values.

I am using a new variable vActiveSheet and just setting the target sheet id in the action.

Then I use conditional colors for the background / text color depending on the variable value.

Instead of setting the variable in the button / text box action, you could also use the action in OnActivateSheet trigger in the sheet properties, so it also works when selecting your sheet on the tab row. Since I assume you want to hide this tab row anyway, the implemented method should be enough.

Regards,

Stefan

Not applicable
Author

Hi...

Thank you Jon and Swehi.....i was looking for just the same 🙂

Regards,

-Khaled