1. So I've been toying around with the different addons in the book to get a better feel for how this all works. I am currently trying to make BasicUnitFrames(chapter27) customizable in-game by creating a frame that consists of 2 sliders - one for the width and one for the height of the buttons. I have created the frame & sliders in the XML file and have attached the following functions to them (This one is for the width slider):

      function BasicUnitFrames_Options_val2_OnLoad(self,vText,Min,Max,Step)
          self.text = vText;
          getglobal(self:GetName().."Text"):SetText(vText);
          getglobal(self:GetName().."Low"):SetText(Min);
          getglobal(self:GetName().."High"):SetText(Max);
          self:SetMinMaxValues(Min,Max);
          self:SetValueStep(Step);
      end
    
      function BasicUnitFrames_Options_OnValueChanged(self)
          self.healthbar:SetWidth(self:GetValue())
      end
    

    It shows up just fine w/out any errors, but when I try to adjust the slider I get the following error:

     Message: Interface\AddOns\TauntMaster\TauntMaster.lua:83: attempt to index field 'healthbar' (a nil value)
     Time: 12/31/09 20:59:36
     Count: 1
     Stack: Interface\AddOns\TauntMaster\TauntMaster.lua:83: in function `TauntMaster_Button_OnValueChanged'
     [string "*:OnValueChanged"]:1: in function <[string "*:OnValueChanged"]:1>
    
     Locals: self = Width {
      0 = <userdata>
      text = Width {
      }
     }
     (*temporary) = nil
     (*temporary) = nil
     (*temporary) = nil
     (*temporary) = nil
     (*temporary) = "attempt to index field 'healthbar' (a nil value)"
    

    I believe the issue is being caused by 'self.healthbar' - although it works great in other functions I am assuming that it causes problems in this particular function because I am working within a different frame??

    What could I do to fix this problem??

    In your OnValueChanged function, self is the slider, not the unit frame. Rather than using self, you'll need to access the frames themselves. In fact, you'll want to change all frames, right?

    Yes I'd like the slider to adjust the width of each button that is created in the addon - (I'm thinking of how something like healbot allows you to adjust the size of the buttons using their config menu).

    Then you'll need to iterate over all of the buttons and change each of them when the settings change.