View Single Post
11-29-13, 05:50 PM   #36
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by ravagernl View Post
You're mixing lazy creation of a frame and toggling the same frame in the wrong way. You only need to toggle the frame if it was already created, otherwise you know that it isn't visible yet so you just need to create it.

Lua Code:
  1. [...]
  2.  
  3. function MyAddon_ShowOptionFrame()
  4.     -- Does the frame already exist?
  5.     if not HeeloWorldFrame then
  6.         -- Nope. Create it now:
  7.         CreateFrame("frame", "HeeloWorldFrame", UIParent)
  8.         HeeloWorldFrame:SetWidth(300)
  9.         HeeloWorldFrame:SetHeight(75)
  10.         HeeloWorldFrame:SetPoint("CENTER", UIParent,"CENTER", 0, 0)
  11.         HeeloWorldFrame:SetFrameStrata("BACKGROUND")
  12.         HeeloWorldFrame:SetFrameLevel(1)   
  13.         HeeloWorldFrame:SetAlpha(1)
  14.         HeeloWorldFrame:SetBackdrop(backdrop)
  15.     else
  16.         -- frame already exists, so toggle it.
  17.         HeeloWorldFrame:SetShown(not HeeloWorldFrame:IsShown())
  18.     end
  19. end
  20.  
  21. [...]
ok i know im new at this but now i feel like an utter idiot, thank you much!!!
  Reply With Quote