View Single Post
11-26-13, 08:43 AM   #29
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by Lombra View Post
Technically it should work, I guess, but you are currently creating the frames all over again each time you press that button. You can't do that. Create all the frames outside of any function and then just do Config_BaseFrame:Show() in OnClick.

A few other fairly important pointers:

When you're creating frames and naming them:
Code:
CreateFrame("frame", "Config_BaseFrame", UIParent)
that's actually creating a global variable Config_BaseFrame. Now global variables aren't disastrous, but (usually) there's no need for them, and there's no upside to using them if you don't have to. If you do want to use global variables/names, you should at least name them more specifically. "AddonNameConfig_BaseFrame" for example. Ideally though, you should just skip the global and use a local reference:
Code:
local Config_BaseFrame = CreateFrame("frame", nil, UIParent)
The button should probably not be referred to as "frame" and "OptionsFrame". Try to have somewhat descriptive names for functions. It's not at all apparent what the OptionFrame function does from the name.
point taken and noted, will adjust the Global Local on a future build, first i want to get the Functions down then i will "Prettyfy" it
  Reply With Quote