Wednesday, April 18, 2012

Slider not updating?

Hi,

I'm currently playing arround with Lua and WoW's API but I am currently struggling with a problem with the sliders

I've used WoW UI Designed to make the layout, maybe that is the problem, maybe not.

anyway:

Everytime I show the form, it'll update the form with the current settings.

Everything works: well actually the checkboxes works

But at the slider i keep getting this problem:


Quote:




Date: 2008-04-27 17:33:04

ID: 51

Error occured in: Global

Count: 1

Message: ..\AddOns\Partyscan\Partyscan.lua line 102:

attempt to index a nil value

Debug:

[C]: ?

Partyscan\Partyscan.lua:102: Partyscanshowdiag()

Partyscan\Partyscan.lua:38: value()

..\FrameXML\ChatFrame.lua:3032: ChatEdit_ParseText()

..\FrameXML\ChatFrame.lua:2724: ChatEdit_SendText()

..\FrameXML\ChatFrame.lua:2745: ChatEdit_OnEnterPressed()

[string "*:OnEnterPressed"]:1:

[string "*:OnEnterPressed"]:1

AddOns:

Ace2

Partyscan, v1.0

Swatter, v5.0.PRE.2966




if i look back at the line 102:


Code:
getglobal(PartyscanForm:GetName().."SliderOffset"):SetValue(PartyscanDBPC.autoleave);

It's actually the same as my checkboxes, and asfar as I checked, also on some wowwiki howto's.

except I can't use this:GetName (it instant errors) so i took the formname.

If I look back how my slider is named: its $parentSliderOffset

But it is in a seperated frame called $parentSliderzz

I've tripple checked if the variable wasn't wrong but it is really there


Code:
PartyscanDBPC.autoleave = 2;

I've tried to change "SliderOffset" to "Sliderzz" but also then (tho quite abit different error message) it gives the error about a nil value.

In the XML file I have this code for the slider:


Code:
      <Frame name="$parentSliderzz">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508889-59c2-4f83-ae10-27aaad48391b" />-->
<Size>
<AbsDimension x="298" y="40" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="76" y="-298" />
</Offset>
</Anchor>
</Anchors>
<Frames>
<Slider name="$parentSlider" enableMouse="true" minValue="1" maxValue="5" defaultValue="1" 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">
<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>
</Slider>
</Frames>
</Frame>

It's alot of code for a slider, but it was set this way by WoW UI Designer. (Yea, the quick way)

Am I doing something wrong here?.. well I think I do but I can't figure it out.

Anyone who can give me a hint?|||NVM! found it, now i need to see how i can fix it furthermore :)

I had to remove frames tag which where arround the slider.

Working now!

EDIT*

you only needed to change 1 thing


Code:
<Frame name="$parentSliderzz">

to


Code:
<Frame>

this is for the most problems if you use WoW UI Designer. it adds a frame arround a object with a name... it needs to removed to work (at least i guess, since it works now on this way)

No comments:

Post a Comment