I've needed to create an example file for some time, so I'm going to go do that and then post it. But in short, you set an additional variable, such as vNorthAmerica to getcurrentselections(). Then you base the color on whether or not getcurrentselections() returns the same value as what is in vNorthAmerica.
I've done this with macros in a live application. I need to see if it works with actions too, though it's a little riskier, as I don't think there's any guarantee on a multi-core machine that the selections will be set before you set the variable.
It turns out I'd already created an example back when I was first trying to solve this problem, and I simply forgot I had it. See attached. Hopefully that will work for you.
testSelectionGroups2.qvw 140.8 K
First off thanks for the help and the great example you provided. This has given me so much more than what I was asking for. I am not very experienced in macos so it’s going to take me a little bit to apply this in my app but it look like it will work. Your formatting the color with an expression vs my hiding and reappearing buttons is so much better.
I do have one additional question because of my lack of experience with macros. In your example how would I select “Type A” and “Type C” by excluding “Type B”? I want to accomplish this through exclusion because eventually I could add a “Type D” and “Type F” which I would want selected as well.
Thanks again for the help.
Your solution works but I am not 100% there. In your example I want to use the buttons to make selections for "type" only without resetting selections in "status" or "product". I would also like to be able to make selections in all list box except "Type" after a button has been used to set the "type" and keep that type's button color as active=green.
Click button "Type A" it selects "Type A" in Type list box and the button turns green.
Select "Status L" from the Status list box and the "Type A" button stays green.
Clear all selections and button "Type A" turns back to grey.
Select "Product X", "Product Y", and "Status L"
Click button "Type A" and "Type A" is selected from the list box button turns green and your selections "Product X", "Product Y", and "Status L" stay active.
Not sure this is possible.
My macros are clearing all selections at the beginning. Don't do that. You can also get selections for a specific field instead of all selections. So if you want a "not Type B" button, skip the clear, and then set the variable to only the selections for the Type field.
So for instance, in what I posted, I can replace the CZ macro with this:
activedocument.fields("Type").select "Type B"
And it won't clear, will only set the type field, and then will only care about the type field when dealing with the color of the associated button.
Edit: Oops, need to change the button color expression to match. This should work:
John it’s been a while and I am looking to expand on my button selections. Below is my example following our previous examples. I would like to a button to stay green until something is selected in “Type” filed then turn grey. The button works for clearing the type filed however the color doesn’t and I have a feeling it’s not working because no value is set.
I was trying to avoid listing all types since they are continually being added.