1. I'm having some issues with some slider code... The this: method seems to be failing me on this and pretty much any button. I haven't been able to figure out why. Here is the xml I have for the slider.

    I get this error message. "1x <string>:"recruiterFormHorizontalSlider1Slider:OnLoad":1: attempt to call global 'recruiterFormHorizontalSlider1' (a table value)

           <Frame name="$parentHorizontalSlider1">
             <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508889-59c2-4f83-ae10-27aaad48391b" />-->
             <Size>
               <AbsDimension x="363" y="45" />
             </Size>
             <Anchors>
               <Anchor point="TOPLEFT">
                 <Offset>
                   <AbsDimension x="15" y="-51" />
                 </Offset>
               </Anchor>
             </Anchors>
             <Frames>
               <Slider name="$parentSlider" enableMouse="true" minValue="0" maxValue="100" defaultValue="0" valueStep="1" orientation="HORIZONTAL">
                 <Size>
                   <AbsDimension x="128" y="17" />
                 </Size>
                 <Anchors>
                   <Anchor point="LEFT" />
                   <Anchor point="RIGHT" />
                 </Anchors>
                 <Backdrop bgFile="Interface\Buttons\UI-SliderBar-Background" edgeFile="Interface\Buttons\UI-SliderBar-Border" tile="true">
                   <BackgroundInsets>
                     <AbsInset left="3" right="3" top="6" bottom="6" />
                   </BackgroundInsets>
                   <TileSize>
                     <AbsValue val="8" />
                   </TileSize>
                   <EdgeSize>
                     <AbsValue val="8" />
                   </EdgeSize>
                 </Backdrop>
                 <Layers>
                   <Layer>
                     <FontString name="$parentTitle" font="Fonts\FRIZQT__.TTF" text="$parentHorizontalSlider1">
                       <Anchors>
                         <Anchor point="BOTTOM" relativePoint="TOP" />
                       </Anchors>
                       <FontHeight>
                         <AbsValue val="10" />
                       </FontHeight>
                       <Color r="1" g="0.8196079" b="0" />
                       <Shadow>
                         <Color r="0" g="0" b="0" />
                         <Offset>
                           <AbsDimension x="1" y="-1" />
                         </Offset>
                       </Shadow>
                     </FontString>
                     <FontString name="$parentLow" font="Fonts\FRIZQT__.TTF" text="Low">
                       <Anchors>
                         <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" />
                       </Anchors>
                       <FontHeight>
                         <AbsValue val="10" />
                       </FontHeight>
                       <Color r="1" g="1" b="1" />
                       <Shadow>
                         <Color r="0" g="0" b="0" />
                         <Offset>
                           <AbsDimension x="1" y="-1" />
                         </Offset>
                       </Shadow>
                     </FontString>
                     <FontString name="$parentHigh" font="Fonts\FRIZQT__.TTF" text="High">
                       <Anchors>
                         <Anchor point="TOPRIGHT" relativePoint="BOTTOMRIGHT" />
                       </Anchors>
                       <FontHeight>
                         <AbsValue val="10" />
                       </FontHeight>
                       <Color r="1" g="1" b="1" />
                       <Shadow>
                         <Color r="0" g="0" b="0" />
                         <Offset>
                           <AbsDimension x="1" y="-1" />
                         </Offset>
                       </Shadow>
                     </FontString>
                   </Layer>
                 </Layers>
                 <ThumbTexture name="$parentThumb" file="Interface\Buttons\UI-SliderBar-Button-Horizontal">
                   <Size>
                     <AbsDimension x="32" y="32" />
                   </Size>
                 </ThumbTexture>
                            <Scripts>
                                <OnLoad> -- Problem seems to be here --
                                    getglobal(this:GetName().."Text"):SetText("Offset");
                                    getglobal(this:GetName().."High"):SetText("12");
                                    getglobal(this:GetName().."Low"):SetText("-12");
                                    this:SetMinMaxValues(-12,12);
                                    this:SetValueStep(1);
                                </OnLoad>
                                <OnValueChanged> grokClockConfigFrameOption_OnClick();  </OnValueChanged>
                            </Scripts>
               </Slider>
             </Frames>
           </Frame>
    
  2. The error you posted does not in any way match your code, but this will not

     getglobal(this:GetName().."Text"):SetText("Offset");
     getglobal(this:GetName().."High"):SetText("12");
     getglobal(this:GetName().."Low"):SetText("-12");
     this:SetMinMaxValues(-12,12);
     this:SetValueStep(1);
    

    There is no variable named this and hasn't been for quite some time. If you mean to be referring to the frame for which the OnLoad is firing, you want to use self.

  3. The error you posted does not in any way match your code, but this will not

     getglobal(this:GetName().."Text"):SetText("Offset");
     getglobal(this:GetName().."High"):SetText("12");
     getglobal(this:GetName().."Low"):SetText("-12");
     this:SetMinMaxValues(-12,12);
     this:SetValueStep(1);
    

    There is no variable named this and hasn't been for quite some time. If you mean to be referring to the frame for which the OnLoad is firing, you want to use self.

    Yea the this I thought was referring to the frame... I'm I've used this in another section for calling the onload for the main frame and didn't get any error or problems that I have noticed...

    Strange... So I guess Self replaced this some time back and I'm trying to use example code that is out dated.

  4. self, not Self. There's a big difference =) I can't say much else without the real error and code.

  5. I'm definitly not understanding what the error means... I changed the code to self instead of this... and got this error instead...

     1x <string>:"recruiterFormHorizontalSlider1Slider:OnLoad":1: attempt to index a nil value
    
     Locals:
    
       ---
    

    doing by best here to understand what exactly these errors mean so I can understand the problem... I think I'm way out there on this one.

  6. Here is the XML file http://pastey.net/145294 Here is the LUA file http://pastey.net/145295

  7. You ask for getglobal(self:GetName().."Text"):SetText("Offset"); only that's not actually anywhere in your definition. So the expression getglobal(self:GetName().."Text") returns nil, and then you index that to do :SetText().

    I hate the XML files produced by wowuides.

  8. You ask for getglobal(self:GetName().."Text"):SetText("Offset"); only that's not actually anywhere in your definition. So the expression getglobal(self:GetName().."Text") returns nil, and then you index that to do :SetText().

    I hate the XML files produced by wowuides.

    I'm starting to see why. My original thought was it would make it easier to lay things out and then I could go in and make adjustments and changes from there... but its proving to be more trouble than its worth.

    Where I'm getting the getglobal code is from the http://www.wowwiki.com/CreatingGUIconfigurationoptions#Checkboxesand_Sliders

    I've been reading over it several times and I can't seem to figure out where they are defining getglobal(self:GetName().."Text"):SetText("Offset"); either...

    I think I'm missing something in my head... just not seeing it... I'm sure this is a HammerHead sort of problem... lol

  9. Yeah, I am not quite sure what to tell you.

  10. Yeah, I am not quite sure what to tell you.

    I think my troubles are a combination of trying to use the wowuide created junk, and then trying to figure out how to do a slider from sample code written back with version #1600...

    So I'm mixing things together and getting a royal cluster... lol

    I'll just have to hit the book when I get home... :-) Should have brought it with me!

  11. I've gotten the sliders to work finally... by looking at your examples

    http://wowprogramming.com/docs/scripts/OnValueChanged

    Its definitly confusing though trying to look at the script based examples compared to the xml files... the conversion between the two confuses the hell out of me... I'll get it eventually though...

    Thanks!

  12. The conversion between the two is quite literally 1 for 1, everything you can do with one you can do with the other. I can try and help for simple examples, to convert things.

  13. Ok... one liner from the OnValueChanged on the site...

    slider:SetScript("OnValueChanged", function(self, value)

    What does this translate to in xml?

  14. I'm still confused about this Self deal...

    In my main frame script section I have...

     <OnLoad>
       Recruiter_OnLoad(self)
     </OnLoad>
    

    And it works fine.. no errors.

    I have this in my slider script section and I get an error about accessing a gobal nil. Which I assume must be the "self" since the value attrib is passing and working.

     <OnValueChanged>
       Recruiter_Slider1_OnClick(self,value);  
     </OnValueChanged>
    

    Just confused as to why self works in some places and not others... Its used in your slider example... but yet I can't seem to get it to not error for me... It works... but still posts an error.

     slider:SetScript("OnValueChanged", function(self, value)
    

    The exact error I get is : but it still functions... so kinda confusing.

     1x <string>:"Recruiter_SubSlider1:OnValueChanged":1: attempt to call global 'Recruiter_Slider1_OnClick' (a nil value)
    
  15. I'm still confused about this Self deal...

    In my main frame script section I have...

     <OnLoad>
       Recruiter_OnLoad(self)
     </OnLoad>
    

    And it works fine.. no errors.

    That's because it's correct.

    I have this in my slider script section and I get an error about accessing a gobal nil. Which I assume must be the "self" since the value attrib is passing and working.

     <OnValueChanged>
       Recruiter_Slider1_OnClick(self,value);  
     </OnValueChanged>
    

    No, the error you linked has nothing to do with self, and everything to do with the fact that the function Recruiter_Slider1_OnClick doesn't exist. The errors ALWAYS tell you precisely what is wrong.

    Just confused as to why self works in some places and not others... Its used in your slider example... but yet I can't seem to get it to not error for me... It works... but still posts an error.

     slider:SetScript("OnValueChanged", function(self, value)
    

    This isn't valid syntax, so no idea what you're doing here. You'd need at least an end and another ) to finish it.

    The exact error I get is : but it still functions... so kinda confusing.

     1x <string>:"Recruiter_SubSlider1:OnValueChanged":1: attempt to call global 'Recruiter_Slider1_OnClick' (a nil value)
    

    As I said, that doesn't exist at the point that the handler is being called.

  16. Ok... one liner from the OnValueChanged on the site...

    slider:SetScript("OnValueChanged", function(self, value)

    What does this translate to in xml?

    umm, the rest of the code isn't here.. but assuming the surrounding slider:

     <Slider>
       <Scripts>
         <OnValueChanged>
           -- Some code here that uses self and value
         </OnValueChanged>
       </Scripts>
     </Slider>
    

    Also, please please PLEASE when you are posting an error or any code, highlight the block of code and click the right-most button in the editor toolbar. It makes it so much nicer to read. You can also preview your post before clicking save to ensure it displays properly.

  17. Ok... Thats what I thought the first time around was that the error was saying that "RecruiterSlider1OnClick" didn't exist... but the problem is.. it does exist... To prove to myself that it did indeed exist I added a print("value of slider" .. value") in the RecruiterSlider1OnClick() function. The print gets called perfectly... I move the slider and the print shows the value changing. It stops when I stop moving the slider.

    So since it is executing code contained with in the "RecruiterSlider1OnClick" function and its doing so on the <OnValueChanged> event... How can it not exist?

    I'm assuming here that there is some order of execution failure or something like that... Where the function doesn't exist when I get the error but does exist once the addon is loaded. If that is the case... how does one avoid these kinds of errors?

  18. Ok... Thats what I thought the first time around was that the error was saying that "RecruiterSlider1OnClick" didn't exist... but the problem is.. it does exist... To prove to myself that it did indeed exist I added a print("value of slider" .. value") in the RecruiterSlider1OnClick() function. The print gets called perfectly... I move the slider and the print shows the value changing. It stops when I stop moving the slider.

    So since it is executing code contained with in the "RecruiterSlider1OnClick" function and its doing so on the <OnValueChanged> event... How can it not exist?

    Because it doesn't exist when the XML file is first loaded, I'm assuming.

    I'm assuming here that there is some order of execution failure or something like that... Where the function doesn't exist when I get the error but does exist once the addon is loaded. If that is the case... how does one avoid these kinds of errors?

    If the XML file is loaded and the value on the slider is set, then the code will be executed. If your Lua file has not loaded at this point, it will obviously error.

    If your XML file references code in your Lua files, you should load the Lua files first.

  19. You hit it right on the head, the problem was that I was setting a value for default on both sliders... as soon as I removed that from the xml part... the error disappear...

    I would have been pulling my hair out over that one for a long time!

    big thanks!

  20. Ok... been beating my head against this for a few hours now...

    Where should I be setting the default value on a slider so that it starts out showing the slider icon?

    If I set it in the xml It works but produces the errors we were talking about earlier... If I try to set it in the lua... it generates a different error but pretty much the same thing...

    I can't seem to set the default anywhere with out an error... if I leave it out... the slider works fine... just can't see the slider control until you click.

  21. Never mind... I figured out my issue... needed to change the lord order in the toc... for some reason I didn't think you could do that... lol... Hammerhead... thats me...

    On to other problems!