Thread: Trying to Learn
View Single Post
06-30-19, 03:41 PM   #32
Aeriez
A Fallenroot Satyr
Join Date: May 2007
Posts: 24
So I've been making a lot of progress on the look and feel of the whole thing. However, I tried making a filter for the list (checkboxes for each class). On click, it runs the update function omitting any classes unchecked. It works perfectly... Until the list gets smaller than the rows displayed... Then the whole frame disappears as if it was hidden. Any insight on what may cause that?

I have SetText("") to simply clear out the text of any rows that go beyond the number of entries (27 rows total, if there's only 25 entries in the WorkingTable then it should blank out the last 2 lines... or so I thought).

Lua Code:
  1. function DKPTable_Update(self)
  2.     local numOptions;
  3.     local index, row
  4.     local offset = FauxScrollFrame_GetOffset(core.DKPTable)
  5.     local classFiltered = {};
  6.     core.WorkingTable = {}
  7.     for k,v in pairs(classes) do
  8.       if (core.ConfigTab1.checkBtn[k]:GetChecked() == true) then
  9.         classFiltered[v] = true;
  10.       else
  11.         classFiltered[v] = false;
  12.       end
  13.     end
  14.     for k,v in pairs(DKP_DKPTable) do
  15.       if(classFiltered[DKP_DKPTable[k]["class"]] == true) then
  16.         tinsert(core.WorkingTable, v)
  17.       end
  18.     end
  19.     numOptions = #core.WorkingTable;
  20.     for i=1, core.TableNumrows do
  21.         index = offset + i
  22.         row = core.DKPTable.Rows[i]
  23.         if (i <= numOptions) then
  24.           local c = GetCColors(core.WorkingTable[index].class);
  25.           row.DKPInfo[1].data:SetText(core.WorkingTable[index].player)
  26.           row.DKPInfo[1].data:SetTextColor(c.r, c.g, c.b, 1)
  27.           row.DKPInfo[2].data:SetText("N/A")
  28.           row.DKPInfo[3].data:SetText(core.WorkingTable[index].dkp)
  29.           row.DKPInfo[3].adjusted:SetText("("..core.WorkingTable[index].dkp - core.WorkingTable[index].previous_dkp..")");
  30.         else
  31.           row.DKPInfo[1].data:SetText("")
  32.           row.DKPInfo[2].data:SetText("")
  33.           row.DKPInfo[3].data:SetText("")
  34.           row.DKPInfo[3].adjusted:SetText("");
  35.         end
  36.         if (index == SelectedData) then
  37.           row:SetNormalTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp")
  38.         else
  39.           row:SetNormalTexture(nil)
  40.         end
  41.         if core.WorkingTable[index] then
  42.             row:Show()
  43.             row.index = index
  44.         else
  45.             row:Hide()
  46.         end
  47.     end
  48.     FauxScrollFrame_Update(core.DKPTable, numOptions, core.TableNumrows, core.TableHeight)
  49. end

EDIT: I have tried reactively adjusting core.TableNumrows (number of rows to draw) based on numOptions (number of entries in the table).. But that doesn't seem to effect anything

Last edited by Aeriez : 06-30-19 at 05:27 PM.
  Reply With Quote