Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color Button

Hey Guys, I need to change the color button in a macro but with a button macro property. For example:

set button1 = ActiveDocument.getsheetobject("BU75")
set buttonprop = button1.GetProperties

buttonpro.color = "#12345" or buttonpro.color = "rgb(255,0,0')" or etc...

but I need the method for the button object.

Thanks [;)]

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello Marco,

Check this:

Sub ChangeBtnColor set vStatus = ActiveDocument.GetVariable("vButtonClicked") s = vStatus.GetContent.String set btn = ActiveDocument.GetSheetObject("BU01") set prop = btn.GetProperties if s = "1" then prop.BkgColor.PrimaryCol.Col = RGB(255,0,0) prop.TextColor.PrimaryCol.Col = RGB(255,255,255) btn.SetProperties prop vStatus.SetContent "0", true else prop.BkgColor.PrimaryCol.Col = RGB(0,0,255) prop.TextColor.PrimaryCol.Col = RGB(0,0,0) btn.SetProperties prop vStatus.SetContent "1", true end if End Sub


I use a variable to check if the button as been clicked. You can skip that part.

Hope it helps!

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hello Marco,

Check this:

Sub ChangeBtnColor set vStatus = ActiveDocument.GetVariable("vButtonClicked") s = vStatus.GetContent.String set btn = ActiveDocument.GetSheetObject("BU01") set prop = btn.GetProperties if s = "1" then prop.BkgColor.PrimaryCol.Col = RGB(255,0,0) prop.TextColor.PrimaryCol.Col = RGB(255,255,255) btn.SetProperties prop vStatus.SetContent "0", true else prop.BkgColor.PrimaryCol.Col = RGB(0,0,255) prop.TextColor.PrimaryCol.Col = RGB(0,0,0) btn.SetProperties prop vStatus.SetContent "1", true end if End Sub


I use a variable to check if the button as been clicked. You can skip that part.

Hope it helps!

Not applicable
Author

Miguel, your help was very useful, it work perfect..!!! 😉 Thank you very much Wink

Not applicable
Author

Hi Miguel,

Is this for one button?

How can i make it to detect multiple buttons?

I'm trying to avoid repeating the script for different buttons action.

Thanks.