Addon command to mimic "Keep Groups Together"

Looking for a single command to put in an addon that reproduces the action of the UI checkbox found at:

Esc > Interface > Game > Raid Profiles > Keep Groups Together

I know I can do this in a macro with:

/click CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether

Just wondering if there’s a single command that would do the same in an addon.

So far, here’s what I’ve come up with.

  • I can test the state of the checkmark in the UI’s checkbox with this:

CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether:GetChecked()

  • I can put a checkmark in the UI’s checkbox with this, but it doesn’t actually change the groupmode of the raid frames (using “false” unchecks it):

CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether:SetChecked(true)

CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether:SetChecked(false)

  • I can change the groupmode of the raid frames to match having the Keep Groups Together checkbox checked (true) with this, but it doesn’t actually change the checkbox:

CompactRaidFrameContainer_SetGroupMode(CompactRaidFrameContainer, “discrete”)

  • I can change the groupmode of the raid frames to match having the Keep Groups Together checkbox unchecked (false) with this, but, similarly, it doesn’t actually change the checkbox:

CompactRaidFrameContainer_SetGroupMode(CompactRaidFrameContainer, “flush”)

I think I can use multiple commands to check (or uncheck) the checkbox and then separately change the groupmode of the raid frames, but, again, just wondering if there’s a single (or better) method when doing this in an addon.

Thanks for any constructive feedback you might have.

That’s a ridiculously long name.

CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether:Click()

is the equivalent of

/click CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether

As you probably know, this is protected in combat. Click() won’t work in combat like /click does, since the latter is secure. To work around this protection if necessary, you can set up a macrotext secure button to do a /click.

2 Likes

Thank you so much.

And… you hit the nail on the head: ridiculously long string. I’m working on putting this in an addon to optimize an already overly crowded macro that I like to have this function in.

My early testing is showing me able to call CompactUnitFrameProfilesGeneralOptionsFrameKeepGroupsTogether:Click() even during CombatLockdown, but I’ll hold in reserve separate calls to updating the checkbox and changing the groupmode until I’ve tested it thoroughly.

Thanks again!

AIO is showing a raidOptionKeepGroupsTogether CVar