Simple example frame with LibDBIcon minimap button (for review)
This is a simple example of an addon with a frame and minimap button(using LibDBIcon-1.0).
Since I'm fairly new to addon development I thought I would post this to see if there is anything I should do differently. This will require a Libs directory in the MyAddon directory that contains the LibDBIcon-1.0 library. This is the .toc file: Lua Code:
Here is the embeds.xml file: Lua Code:
Here is the lua file: Lua Code:
|
LibDBIcon has dependancies on LibStub and LibCallBackHandler. Those should both be included in your addon (lib folder) and .toc (or other .XML include file eg. embeds.xml) in case the user doesn't have another addon that does include them (libs aren't automatically included or loaded).
Frame names are also added to the global table and should also be unique "CodgerAddonFrame" instead of "MyAddonFrame". If it has a name (and is unique) you can use it in your show/hide code Lua Code:
Edit: Missed the "MyAddon" in: Code:
local icon = LibDBIcon:Register("MyAddon", { |
Updated example frame with LibDBIcon minimap button
This is a simple example of an addon with a frame and minimap button(using LibDBIcon-1.0).
The Addon has been renamed to "MyAddonFrameExample" to incorporate some necesssary changes noted in the forum thread above by Fizzelmizz (Thank you!!) The addon consists of three files and a Libs directory containing the four required libraries. The three files are located in the "MyAddonFrameExample" directory and are:
embeds.xml
Here is the MyAddonFrameExample.toc file: Lua Code:
Here is the embeds.xml file: Lua Code:
Here is the core.lua file: Lua Code:
|
That actual code isn't using LibDataBroker-1.1 but I'm guessing it's all meant to come together with the previous code (or other).
As a frame that shows/hides using the minimap button, it works as is. |
Lib dependency
Ok. I'm still trying to figure this stuff out. Thanks again for your thoughtful and instructional replies.
The reason I thought I needed it was an entry in the Libs\LibDBIcom-1.0\embeds.xml file Lua Code:
rather than the Libs\LibDBIcom-1.0\LibDBIcon-1.0.lua file in my addon embeds.xml file as it appears to have the libraries and dependencies in the LibDBIcon xml file. However when I tried to do that the LibDBIcon xml file contained a split line which generated an error. I didn't want to change my local LibDBIcon library as others who use this example may not have a working version of the library to depend on and the example would fail so I included all four of the libraries in my addon embeds.xml file. |
You have two (for want of a better term) "primary" libraries (although your posted code only uses LibDBIcon)
Both of these use (depend on) LibStub (a library for managing library versioning) and LibCallBackHandler (for handling callbacks). If your included a libraries depend on another library (or more) then the "sub-libraries" also need to be included in your addon and listed in the .toc (or via an xml file that does this). Other addons may also use/include the same libraries (and sub-libraries). The loading of these is managed via LibStub. Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> |
Codger, if you want to have a look at a relatively simple addon that uses the libdatabroker part of the library you can grab a copy of my AltILevel addon I created 10 years ago. It was still working as of the start of dragonflight. But with some of the minimap having changes this patch ( Tracking frame name changed .. again ) I might have to test it out again rofl.
https://www.wowinterface.com/downloa...AltILevel.html |
Xinfo doesn't seem to be creating a menu?
I loaded the Xinfo addon but I'm not seeing a menu come up?
|
Quote:
But, on clicking that button, it should start generating a list of your characters as you log them in. Like in the screenshots on the addon page. Edit: Just double checked in case it had bugged out and it still works as expected. An addon like chocolatebar ( only one available when I tested at the start of dragonflight ) is needed, and you need to select to show text or show label as I have no icon for the addon. After that mousing over, left clicking or right clicking will show a variety of windows/menus. |
New version using LibDataBroker
This fixes an issue affecting coordination with other addons.
I noticed that although the icon was being shown on the mini-map, addons that combined mini-map buttons would not display this addons icon. This version fixes that problem by adding libdatabroker to handle communication between this addon and others that may need to coordinate with it; including as examples; leatrix plus and titan panel. This addon is using the four libraries: CallbackHandler-1.0, LibDataBroker-1.1, LibDBIcon-1.0 and LibStub. Here is the MyAddonFrameExample.toc file: Lua Code:
Here is the embeds.xml file: Lua Code:
Here is the core.lua file: Lua Code:
|
New version. Added a missing library (AceDB).
So I must have been lucky enough in my previous testing to have had another addon installed that loaded AceDB-3.0. A new Wow install due to a computer crash revealed the bug due to the missing library. I also added a saved variable for the database and renamed it from BunniesDB to MyAddonFrameExampleDB and included it in the .toc file.
This addon is using the five libraries: CallbackHandler-1.0, LibDataBroker-1.1, AceDB-3.0, LibDBIcon-1.0 and LibStub. Here is the MyAddonFrameExample.toc file: Lua Code:
Here is the embeds.xml file with the added library. The order of the libraries is important/: Lua Code:
And the core.lua file: Lua Code:
|
All times are GMT -6. The time now is 05:03 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI