View Single Post
07-03-12, 08:26 PM   #10
sigEleven
A Murloc Raider
Join Date: Jun 2012
Posts: 7
Although I have done programming work for the DoD, this is obviously not one of those projects. I'm not sure why this seems ridiculous to you. I have supplied the code of calling the same function in two different ways, 1 via XML (code already provided), and 2 in lua (code already provided), which from my understanding, should have the same effect. Although, in my testing, they do not (the XML does not seem to call the function), so I was asking if anyone else could duplicate this, or provide an explanation.

It seems ridiculous to me, that you want me to post the entirety of the code for this add-on (which is thousands of lines, over multiple files), in order to replicate the creation of a simple drop down menu. I really don't want to deal with the hassle, especially with trolls like Torhal already on this thread, flaming about a few KB of memory, and global namespace usage, while providing no relevant information to the topic. Also, you have not clearly stated what information you're looking for. My best guess would be the function that is being called.

Bottom line, it's not worth the hassle. It's obviously not some silly mistake on my part, as none of you caught it, and it will be far easier just to deal with the creation of the objects in lua, than to try elaborate work arounds. I'll supply the information again, and include the function this time, in case someone finds this thread, and is actually interested.

The Function:
Lua Code:
  1. function UNIQUEGLOBALFORTORHAL_MYBUTTON12345_Initiallize(self, level)
  2.    local info = UIDropDownMenu_CreateInfo()
  3.    local items = {'Opt1', 'Opt2', 'Opt3'};
  4.    for k,v in pairs(items) do
  5.       info = UIDropDownMenu_CreateInfo()
  6.       info.text = v
  7.       info.value = v
  8.       info.func = UNIQUEGLOBALFORTORHAL_MYBUTTON12345_OnClick
  9.       UIDropDownMenu_AddButton(info, level)
  10.    end
  11.  
  12.    --Flame on about the fact I didn't unallocate the memory for these variables when I was done with them.
  13. end

XML initialization - results in no population of the drop down (function does not seem to be called)
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">
<Frame name = "UNIQUEGLOBALFORTORHAL_MYFRAME12345">
   <!-- positioning, inheritance, sizing, artwork ... blah, blah, blah -->
   <Scripts>
      <OnLoad>UNIQUEGLOBALFORTORHAL_MYFRAME12345_OnLoad</OnLoad>
   </Scripts>
   <Frames>
      <Button name="UNIQUEGLOBALFORTORHAL_MYBUTTON12345" inherits="UIDropDownMenuTemplate"> 
         <!-- positioning, inheritance, sizing, artwork ... blah, blah, blah -->
         <Scripts>
            <OnLoad>  UIDropDownMenu_Initialize(UNIQUEGLOBALFORTORHAL_MYBUTTON12345, UNIQUEGLOBALFORTORHAL_MYBUTTON12345_Initiallize)</OnLoad>
          </Scripts>
      </Button>
   </Frames>
</Frame>
</Ui>
lua initialization - results as expected
Lua Code:
  1. function UNIQUEGLOBALFORTORHAL_MYFRAME12345_OnLoad()
  2.    UIDropDownMenu_Initialize(UNIQUEGLOBALFORTORHAL_MYBUTTON12345, UNIQUEGLOBALFORTORHAL_MYBUTTON12345_Initiallize)
  3. end

Flame on that I have an extra 'l' in 'Initiallize'

Originally Posted by Phanx View Post
I'm not a moderator, but your request seems ridiculous. You asked for help, but gave us basically no details about what you need help with. We offered a few suggestions. You said they didn't work. I told you you'd need to give us more details if you want better suggestions. You'd rather close the thread than show us your code? Really? Are you working on a top-secret World of Warcraft addon for the NSA?
__________________
There are 10 types of people who exist in this world, those who get it, and those who don't.
  Reply With Quote