View Single Post
06-19-17, 06:21 PM   #4
volchantv
A Defias Bandit
Join Date: Jun 2017
Posts: 2
hey, thanks for your answers

I got it kind of working



Lua Code:
  1. local _, core = ...;
  2. core.Config = {};
  3.  
  4. local Config = core.Config;
  5. local UIConfig;
  6.  
  7. local defaults = {
  8.   theme = {
  9.     r = 0,
  10.     g = 0.8,
  11.     b = 1,
  12.     hex = "00ccff"
  13.   }
  14. }
  15.  
  16. function Config:Toggle()
  17.   local menu = UIConfig or Config:CreateMenu();
  18.   menu:SetShown(not menu:IsShown());
  19. end
  20.  
  21. function Config:GetThemeColor()
  22.   local c = defaults.theme;
  23.   return c.r, c.g, c.b, c.hex;
  24. end
  25.  
  26. local function ScrollFrame_OnMouseWheel(self, delta)
  27.   local newValue = self:GetVerticalScroll() - (delta * 20);
  28.  
  29.   if (newValue < 0) then
  30.     newValue = 0;
  31.   elseif (newValue > self:GetVerticalScrollRange()) then
  32.     newValue = self:GetVerticalScrollRange();
  33.   end
  34.  
  35.   self:SetVerticalScroll(newValue);
  36. end
  37.  
  38. function Config:CreateMenu()
  39.   UIConfig = CreateFrame("Frame", "TchinFrame", UIParent, "BasicFrameTemplateWithInset");
  40.   UIConfig:SetSize(500, 560);
  41.   UIConfig:SetPoint("CENTER");
  42.   UIConfig:SetMovable(true);
  43.   UIConfig:EnableMouse(true);
  44.   UIConfig:SetFrameStrata("HIGH")
  45.   UIConfig:RegisterForDrag("LeftButton");
  46.   UIConfig:SetScript("OnDragStart", UIConfig.StartMoving);
  47.   UIConfig:SetScript("OnDragStop", UIConfig.StopMovingOrSizing);
  48.  
  49.   UIConfig.title = UIConfig:CreateFontString(nil, "OVERLAY");
  50.   UIConfig.title:SetFontObject("GameFontHighlight");
  51.   UIConfig.title:SetPoint("LEFT", UIConfig.TitleBg, 5, 0);
  52.   UIConfig.title:SetText("Tchïn Raid Scheduler");
  53.  
  54.   UIConfig.ScrollFrame = CreateFrame("ScrollFrame", nil, UIConfig, "UIPanelScrollFrameTemplate");
  55.   UIConfig.ScrollFrame:SetPoint("TOPLEFT", TchinFrame.InsetBg, "TOPLEFT", 8, -8);
  56.   UIConfig.ScrollFrame:SetPoint("BOTTOMRIGHT", TchinFrame.InsetBg, "BOTTOMRIGHT", -3, 60);
  57.   UIConfig.ScrollFrame:SetClipsChildren(true);
  58.   UIConfig.ScrollFrame:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel);
  59.  
  60.   UIConfig.child = CreateFrame("Frame", nil, UIConfig.ScrollFrame);
  61.   UIConfig.child:SetSize(475, 450);
  62.   UIConfig.ScrollFrame:SetScrollChild(UIConfig.child);
  63.  
  64.  
  65.  
  66.   UIConfig.ScrollFrame.ScrollBar:ClearAllPoints();
  67.   UIConfig.ScrollFrame.ScrollBar:SetPoint("TOPLEFT", UIConfig.ScrollFrame, "TOPRIGHT", -20, -22);
  68.   UIConfig.ScrollFrame.ScrollBar:SetPoint("BOTTOMRIGHT", UIConfig.ScrollFrame, "BOTTOMRIGHT", -15, 22);
  69.  
  70.   UIConfig.editBox = CreateFrame("EditBox", "TchinEditBox", UIConfig, "TchinInputBoxTemplate");
  71.   UIConfig.editBox:SetPoint("TOPLEFT", UIConfig.child, 5, -5);
  72.   UIConfig.editBox:SetWidth(430);
  73.   UIConfig.editBox:SetText("Paste the list here.");
  74.   UIConfig.editBox:SetAutoFocus(false);
  75.   UIConfig.editBox:SetMultiLine(true);
  76.   UIConfig.editBox:SetMaxLetters(2000);
  77.  
  78.   UIConfig.inviteBtn = CreateFrame("Button", nil, UIConfig, "GameMenuButtonTemplate");
  79.   UIConfig.inviteBtn:SetPoint("CENTER", UIConfig, "BOTTOM", 0, 40);
  80.   UIConfig.inviteBtn:SetSize(120, 30);
  81.   UIConfig.inviteBtn:SetText("Invite Members");
  82.   UIConfig.inviteBtn:SetNormalFontObject("GameFontNormal");
  83.   UIConfig.inviteBtn:SetHighlightFontObject("GameFontHighlight");
  84.  
  85.   UIConfig:Hide();
  86.   return UIConfig;
  87. end

but i'm gonna try your solution, looks way better
  Reply With Quote