adding a GUI for addon options
So I want to know how to add a GUI to an addon. I thought to myself, "Minimap is easy to modify, should be a good place to start off with a GUI." pMinimap is alilttle more complicated than I'd how to learn from :P
can people give me tips or lead me in the right direction pls :) so far i'm looking @ pMinimap & sThreatMeter2 --to be more specifc. I would like the config to in the AddOns tab in the default Blizzard options panels. |
Sometimes, you can't just *add* a GUI to another addon. If that addon's functions and variables are locals, they are only accessible through that addon - not from something outside of it. Another thing with a beginner trying to add a GUI to a different addon is that you have to learn the API of that addon and that author's style/practices.
It's best just to write something simple for yourself with a simple GUI (like one or two checkboxes). |
srry left out they were my addons :P
one or two checkboxes sounds great lol i just have nfi where to start. and the widgets page in wowprogramming is MASSIVE |
Look at the code for AddOns which you know have a config options GUI, and study those. That should, at least, narrow down what you need to reference on WowProgramming.
|
Make sure that they are addons which don't use LibAceConfig-3.0
|
stuck...
i know the problem... (i think) but im not experienced nuff to fix it i have two seperate tables. e.g. the original alTestOne = true and the saved variable alTestOne = true now when I click the button i've made on the GUI. the savedvariable boolean changes, but nothing changes on my UI.. Is my UI taking its value from the original alTestOne? if yes how do i fix it? hope i xplained it well nuff :P |
Quote:
|
Quote:
|
Quote:
Code:
alUI_DB = {} The box stays unticked. so for some reason the box is taking the savedvariable boolean. but... |
Where is the UI code for the check box ?
This is roughly what I do to get checkboxes to work: Code:
--Create the Button Edit: Note though that the Saved Variables Table doesn't have to be set up this way to work. As long as the value that is stored in the saved variables is set and used and the OnClick script set and acted on then it should work as descirbed. |
Code:
local frame = CreateFrame("CheckButton", "alUIConfigButton1", al) |
Well, your two pieces of code are fine as they are but apart from setting your variable in one and printing it in another you are not showing how they work together.
For example, you have that print statement to see if your variable is set. When is that set to run ? In the main chunk of the code, in a function called when an event is triggered, in a function called from another function etc. Also, when is BadBoy CheckBox code set up ? Is it after you have initialised and loaded the saved variables ? Using the code you supplied it should work in the following order if in the same lua file : Code:
|
Quote:
Well. My .toc / .xml e.g. Code:
defaults.lua Quote:
but yeah i have no idea when Checkbox code is run tbh. after still reading wowwiki. I'm going to put it all in one lua file. But question -ideally when or how should default settings be initialised? I see addon setting them on event, but my defaults handle the UI where or not something should be enabled so i kinda need them to load first. |
Quote:
|
Assuming the SavedVariables is set up in your TOC it will automatically load up when the ADDON_LOADED event is called.
For a simplish addon these 3 events should be all you need to use. The PLAYER_LOGOUT event is only really needed if you don't use the saved variables directly but copy them into local variables for ease of access. Just make sure to store them back to the saved variables during this LOGOUT event. Code:
if event == ADDON_LOADED then |
why do so many peple use Ace? whats the benefits?
|
I Figured I would piggyback this thread and ask a few questions myself.
I have looked around for libaceconfig I was not able to find any refrence to it. I however did find LibGUIFacroty. I have made quite a few addons and most of what i know has come from tearing apart other users addons and looking. I would really like to add a gui for my addons for configuration. Is there a idot's guide on how to make a gui ? |
|
All times are GMT -6. The time now is 08:03 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI