12-14-16, 10:26 AM | #1 |
Module options not displaying..
I am following along this thread to create modules for my latest build of SmartRes2. Obviously, I am missing something, because the options for SmartRes2_Chat are not showing up in SmartRes2, either by Interace/AddOns, or the LDB/minimap buttons.
I don't have SmartRes2_Chat set as LoadOnDemand, but I'd like to; I'm trying to debug first. There are no errors in either SmartRes2 or SR2C. BugSack is quiet. About posting my code. While both the core and the module are tiny, I think it best to post both, because I can't tell which is not working. Therefore, I am attaching .zip files. Sorry about the SVN hooks and files, please ignore those. And I certainly do not expect anyone to make commits. What I do see when opening Interface/AddOn is exactly what you'd expect with no modules. The main options tab and the profiles tab. And yes, I know that SmartRes2_Chat currently does nothing, but at the very least its options should be displayed at this point. |
|
12-14-16, 01:25 PM | #2 |
I don't have much time at the moment, but look at sStats and its modules.
|
|
12-15-16, 09:50 AM | #3 |
Seerah, thank you for the the tip. Because you handle modules differently, it didn't help me. I am using AceAddon-3.0 to handle modules.
As far as I can tell, because there are no errors unless I purposely break something, the module is being loaded. The disconnect is getting the module options into the core display. I have tried putting in a saved variables line into SmartRes2_Chat's toc, and tried without. I have tried both an SV and matching it as the name in RegisterNamespace, and treating the name as a simple string. In the section 24 - 30, I have tried multiple variations of options.args.blah. I have tried so many variants of line 28 it makes my head swim. Originally I had line 28 exactly as Phanx wrote in the linked thread above, only substituting name, module for k, v, but those are just variable names. Except for the third argument for AceDialog, AddToBlizOptions has been passed SmartRes2, name, module, and a few combinations thereof. What you see is the latest iteration. I am at a total loss as to why something so simple isn't working. And this is why I attached the whole addon zips. Lua Code:
... And the module's OnInit Lua Code:
|
|
12-15-16, 01:59 PM | #4 |
Did you look at the GetModuleOptions function on line 353 of sStats.lua?
It's called in this bit in the OnInitialize function (lines 498-500) Lua Code:
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh Last edited by Seerah : 12-15-16 at 02:01 PM. |
|
12-17-16, 10:14 PM | #5 |
I looked at your code, slept on it, mulled it over, looked at it again. While I did learn some things, I found myself confused because your code knows the module options, like X, Y, input text. Your options are static.
However, my options for the modules are dynamic, so I don't think I can borrow your code. If I am wrong, please elaborate! In the meantime, I tried some things. For instance, I moved the defaults and options fetch functions for the module out of their own .lua files and into the core module code. Also, I adjusted the get/set functions to db[info[#info]] format. That done, I made sure everything else exactly matched the code Phanx wrote for BasicUI, as cokedrivers said his Buffs module and core addon were working. So far so good, except I still don't see my module's options displaying with SmartRes2 set as the parent. Right, that means I added some print statements. In SmartRes2:OnInit()'s module iterator, it looks like this: Lua Code:
That gives me something to work with, but I have no clue why it isn't picking up the module... |
|
12-18-16, 02:04 PM | #6 |
The insertion of module options is the same, no matter where it comes from. In sStats, the core provides the module options by inserting the data table into the main options table. Any module that wants to provide additional options that the core does not know about, would then insert into the appropriate table.
If the core does not handle the module options table, then the module itself would insert its options data table into the main options table. Isolated out of my GetModuleOptions function. Lua Code:
/edit: and what is your self:IterateModules() method doing? What does it return?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh Last edited by Seerah : 12-18-16 at 02:08 PM. |
|
12-20-16, 12:48 AM | #7 |
I'm still working on trying to get it to work, but now there will be a delay until after the holidays. Just wanted to say something so you weren't hanging, wonder if I have fixed it - I haven't yet.
|
|
12-20-16, 11:48 AM | #8 |
Good news everyone! I got the slime flowing again!! Er, I mean I figured out how to get the chat module to display in the main options window after looking at KUI Nameplates code.
However, it is not obeying the default values. All the defaults for the Chat module that are Boolean are set to true, but the display has them as false, or empty checkboxes. What I don't know for sure is whether that's because I have handler = module, or because the options table for the module get/set are wrong with self.db.profile.blah where "self" is module.db, or both are wrong. I have not handled the SV random table code yet within Chat.lua, because it probably will be easier to find out how to do that once I figure out how/why the Booleans aren't working. Baby steps. For reference, here is first the code for SmartRes2.lua, and then Chat.lua (the module code). Seerah, as muddled as my brain is, I want to thank you very much for your help to this point. Without your prompting, I would never have gotten this far. Lua Code:
Lua Code:
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Module options not displaying.. |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|