View Single Post
07-05-17, 03:19 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Group frames don't respond to OnShow/OnHide?

Hi all,

It's been a while since I posted my last oUF related thread here

So, I'm currently spawning my raid group frames like the following:

Lua Code:
  1. local koverwatch = LSM:Fetch("font", "koverwatch");
  2.  
  3. for i = 1, NUM_RAID_GROUPS do
  4.     local overrideName = "Raid" .. i;
  5.  
  6.     width = db.raid.width;
  7.     height = db.raid.height;
  8.     point, relativeFrame, relativePoint, ofsx, ofsy = unpack(db.raid.position);
  9.    
  10.     if i >= 2 then
  11.         ofsx = ofsx + ((width + 3) * ((i - 1) % 4));
  12.     end
  13.  
  14.     if i >= 5 then
  15.         ofsy = ofsy + (height + 3) * 5 + 28;
  16.     end
  17.  
  18.     local group = self:SpawnHeader(
  19.         overrideName,
  20.         nil,
  21.         "custom [group:raid] show; hide",
  22.         -- attributes
  23.         "oUF-initialConfigFunction", ("self:SetWidth(%d); self:SetHeight(%d);"):format(width, height),
  24.         "showRaid", true,
  25.         "showParty", false,
  26.         "showPlayer", true,
  27.         "showSolo", false,
  28.         "groupFilter", tostring(i),
  29.         "point", "LEFT",
  30.         -- "xOffset", ,
  31.         -- "yOffset", ,
  32.         "maxColumns", 5,
  33.         "unitsPerColumn", 1,
  34.         "columnSpacing", 8,
  35.         "columnAnchorPoint", "TOP"
  36.     );
  37.     group:SetPoint(point, relativeFrame, relativePoint, ofsx, ofsy);
  38.     group:SetScript("OnShow", function(self)
  39.         self.headText:Show();
  40.     end);
  41.     group:SetScript("OnHide", function(self)
  42.         self.headText:Hide();
  43.     end);
  44.  
  45.     local headText = group:CreateFontString("$parentHeadText", "OVERLAY");
  46.     headText:SetFont(koverwatch, 14, "OUTLINE");
  47.     headText:SetPoint("BOTTOM", group, "TOP");
  48.     headText:SetText("Group " .. i);
  49.     headText:Hide();
  50.  
  51.     group.headText = headText;
  52. end

I'm currently trying to display a text, "Group N", on top of each group's frame, but it seems like those frames don't call OnShow/OnHide scripts

So, I've tested it without headText being hidden on creation and here's what it looks like at the moment.



From "Group 1" to "Group 7" are properly positioned while "Group 8" is off...

So, my conclusion here is that each of groups are created and already visible since I'm in raid group (and that's why it's not calling OnShow/OnHide scripts), but are not yet sized correctly until that particular group gets a member in it and that's why it's causing this.

However, I'm still unsure of how I could fix this

Any helps, please?!

Thank you!!

Last edited by Layback_ : 07-05-17 at 03:21 AM.
  Reply With Quote