View Single Post
02-24-15, 04:15 PM   #21
flow0284
A Cyclonian
Join Date: Jan 2015
Posts: 40
Soo das hier hab ich aus deiner Vorlage gemacht, soweit gibt es keine Fehlermeldungen mehr beim anklicken, jedoch werden auch keine Checkboxen angezeigt

Lua Code:
  1. Options_Child:SetScript("OnShow",
  2.             function(self)
  3.             PlaySound("igMainMenuOptionCheckBoxOn" or "igMainmenuOptionCheckBoxOff")
  4.             --checkboxes begin
  5.             local expansion = Options_Child.name
  6.             print(expansion.." clicked")
  7.  
  8.             --wenn noch keine checkboxen vorhanden dann erstmal erstellen
  9.             if not self.herbCheckboxes then
  10.                 self.herbCheckboxes = {}
  11.                 --alle kräuter der jeweiligen untertabelle durchgehen und jeweils eine checkbox erstellen
  12.                 for itemID, optionValue in pairs(MillButton_Herblist[expansion]) do
  13.                     --name des krauts für das label der checkbox holen
  14.                     local itemName = GetItemInfo(itemID)
  15.                     --ankerpunkt für die erste checkbox
  16.                     local tAnchorPointY = -10
  17.                     --checkbox erstellen (siehe helper function unten) und für späteren zugriff referenz auf checkbox-objekt mit itemid vom kraut als index in herbCheckboxes speichern
  18.                     self.herbCheckboxes[itemID] = Addon:CreateOptionsCheckButton(self, itemName)
  19.                     --passend anordnen
  20.                     self.herbCheckboxes[itemID]:SetPoint("TOPLEFT", self.parent, "TOPLEFT", 10, tAnchorPointY)
  21.                     --ankerpunkt für die nächste checkbox
  22.                     tAnchorPointY = tAnchorPointY - self.herbCheckboxes[itemID]:GetHeight()
  23.                 end
  24.             end
  25.  
  26.            
  27.             --alle inhalte self.herbCheckboxes durchgehen und den aktuellen wert (checked/nicht checked bzw. true/false) für die checkbox entsprechend der db festlegen
  28.             for itemID, checkboxObj in pairs(self.herbCheckboxes) do
  29.                 --wert der checkbox entsprechend der tabelle festlegen
  30.                 checkboxObj:SetChecked(MillButton_Herblist[expansion][itemID])
  31.                 --bei wertänderung in der db speichern
  32.                 checkboxObj:SetScript("OnClick", function()
  33.                     MillButton_Herblist[self:GetParent().name][self.itemID] = self:GetChecked()
  34.                 end)
  35.             end
  36.  
  37.             --checkboxes end
  38.         end)
  39.        
  40.     end
  41.    
  42.     Options:SetScript("OnShow", nil)
  43.        
  44. end)
  45.    
  46. SLASH_MILLBUTTON1 = "/millbutton"
  47. SLASH_MILLBUTTON2 = "/mbtn"
  48. SlashCmdList.MILLBUTTON = function() InterfaceOptionsFrame_OpenToCategory(Options) end
  49.  
  50.  
  51. -- Checkbox HELPERS Beginn
  52. function Addon:CreateOptionsCheckButton(pParentFrame, pLabelText)
  53.     local tCheckBoxFrame = CreateFrame("CheckButton", nil, pParentFrame)
  54.     tCheckBoxFrame:SetWidth(25)
  55.     tCheckBoxFrame:SetHeight(25)
  56.     tCheckBoxFrame:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up")
  57.     tCheckBoxFrame:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down")
  58.     tCheckBoxFrame:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight")
  59.     tCheckBoxFrame:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check")
  60.     tCheckBoxFrame:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled")
  61.     tCheckBoxFrame:SetFrameStrata("HIGH")
  62.     tCheckBoxFrame:Show()
  63.  
  64.     local tFS = tCheckBoxFrame:CreateFontString(nil, "OVERLAY")
  65.     tCheckBoxFrame.fontstring = tFS
  66.     tFS:SetFont("Fonts\\ARIALN.TTF", 12)
  67.     tFS:SetFontObject(GameFontNormalSmall)
  68.     tFS:SetText(pLabelText)
  69.     tFS:SetTextColor(1, 1, 1, 1)
  70.     tFS:SetJustifyH("LEFT")
  71.     tFS:SetJustifyV("TOP")
  72.     tFS:SetPoint("LEFT", tCheckBoxFrame, "RIGHT", 0, 0)
  73.     tFS:Show()
  74.  
  75.     return tCheckBoxFrame
  76. end
  77. -- Checkbox HELPERS Ende

Ich hab mich da bestimmt irgendwo "verlaufen"...

/letztes edit für heute:
jetzt bekomm ich die Checkboxen zwar angezeigt aber die hängen alle auf einander..

das hier hab ich geändert, also aus self.parent wurde SubOptionPanel:
Lua Code:
  1. self.herbCheckboxes[itemID]:SetPoint("TOPLEFT", SubOptionPanel, "TOPLEFT", 10, tAnchorPointY)
  2.                     --ankerpunkt für die nächste checkbox
  3.                     tAnchorPointY = tAnchorPointY - self.herbCheckboxes[itemID]:GetHeight()

Last edited by flow0284 : 02-24-15 at 05:18 PM.
  Reply With Quote