View Single Post
11-26-13, 08:24 AM   #27
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
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.
__________________
Grab your sword and fight the Horde!
  Reply With Quote