Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Change Color Of Button

I have a button that toggels a variable to 1 or 2 that is used in some set analysis expressions. I need to change to backround color of the button depending on whether the variable is a 1 or a 2. I am also changing the text. All is working but I can't find the key word(s) needed to change to backround color. Help!

Thanks,

Stephen

4 Replies
its_anandrjs

Hi,

Do you have any sample if so please share t me.

Regards,

Anand

its_anandrjs

Hi,

If you have any sample please share it want to know how you toggle a variable value.

Regards,

Anand

Not applicable
Author

See Code Below (vSoloConsolidated is a variable).

Stephen

Sub ButtonToggle

set v = ActiveDocument.Variables("vSoloConsolidated")

set Button = ActiveDocument.GetSheetObject("BU84")

set Prop = Button.GetProperties

if(v.GetContent.String)= "1" then

set v = ActiveDocument.Variables("vSoloConsolidated")

                           v.SetContent  "2", True

                           Prop.Text.v = "Button Text 2"

                           Button.SetProperties Prop

else

              set v = ActiveDocument.Variables("vSoloConsolidated")

                           v.SetContent  "1", True

                           Prop.Text.v = "Button Text 1"

                           Button.SetProperties Prop

end if

end sub

Not applicable
Author

Figured it out

Prop.BkgColor.PrimaryCol.Col = RGB(12,57,255)

FYI.  Use:

ActiveDocument.GetSheetObject( "CH01" ).WriteXmlPropertiesFile "C:\MychartProp.xml"

to see all of the properties of an object. This is very helpfull to find the code that is need.

Stephen