Grid2

Grid2

9M Downloads

Grid2 API points

guilliotine13 opened this issue ยท 2 comments

commented

Couldn't find a comment box under Curseforge or a Discord for Grid2, so apologies if this is the wrong place.

I have been wondering if API points exist for Grid2. The use case would be to access/extract the frames after they have been sorted with the sorting that takes place within Grid2. This will be used to determine if Frame1 is "party3", the tank and if Frame2 is "party1", the healer and so on. Any way to fetch the current ordering of units, basically.

Thanks in advance!

Note: I have realized that the indicator for that exists as "unit-index". I'm more curious about fetching it through Lua.

commented

SecureButton_GetUnit(SecureFrame) or SecureButton_GetModifiedUnit(SecureFrame) wow api functions return the unit for the specified frame.

Your question is a bit vague, i dont know what is your starting point, are you coding a addon,a weakaura ? do you already have a unit frame, a secure group header ?

Your question is confusing too because you are talking about the unit names: party1, party2, etc, but those numbers/indexes are not related to the frames display order.

Grid2 unit frames are managed by blizzard code, you have the relevant code here (the linked code creates, sorts and displays the unit frames):

https://github.com/tomrus88/BlizzardInterfaceCode/blob/master/Interface/FrameXML/SecureGroupHeaders.lua

So for example if you have the secure group header (the parent of the unit frames) the list of unit frames can be queried calling:

securegroupheaderframe:GetAttribute("child1") -- for the first frame
securegroupheaderframe:GetAttribute("child2") -- second frame
securegroupheaderframe:GetAttribute("child3") -- etc

another more direct way is:

securegroupheaderframe[1] -- for the first frame
securegroupheaderframe[2] -- for the second frame
securegroupheaderframe[3] -- etc

And if you have a unit frame, for example in the frame variable, you can retrieve the securegroupheader parent frame with this code;

local securegroupheaderframe = frame:GetParent()

commented

Thank you so much for your detailed response!

I thought that sorting was handled internally by Grid2, did not realize that it was handled by Blizzard. I will look into the methods you have provided.

To clarify, I am going to use this in my own addon and was curious which frame represents which unit name/unit ID.

Once again, thanks for the response, love the addon and your work!