Thread Tools Display Modes
05-26-09, 02:35 AM   #1
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
Question Check Button and Slider Hassles!

Hi all, I have a problem with a couple of check buttons and slilders.

1. Show or hide minimap button.....
You have to click the check box twice to get the map button to show or hide. Don't understand why it's doing it. :/

The code:

Code:
            <OnClick>
                if DWMPackMinimapButton.ShowMinimapButtonCheckButton then
                    DWMPackMinimapButton.ShowMinimapButtonCheckButton = false
                    DWMPackMinimapButton:Hide()
                else
                    DWMPackMinimapButton.ShowMinimapButtonCheckButton = true
                    DWMPackMinimapButton:Show()
                end
                self:SetChecked(DWMPackMinimapButton.ShowMinimapButtonCheckButton)
            </OnClick>
2. Lock/Unlock the frame.... I can lock or unlock the frame ok buut it clings to the cursor and you have to click it twice as per above to unlock it.

The code:
Code:
            <OnClick>
                if DWMPackBaseFrame.FrameLockCheckButton then
                    DWMPackBaseFrame.FrameLockCheckButton = false
                    DWMPackBaseFrame:StartMoving();
                else
                    DWMPackBaseFrame.FrameLockCheckButton = true
                    DWMPackBaseFrame:StopMovingOrSizing();
                end
                self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
            </OnClick>
3. Sliders... Scale slider

The scale slider only has 2 settings so it seems, 100% and 50% even though it has a step value of 1. When you go to adjust it, it jumps to 50% and won't move via increments like it should.

The code:
Code:
      <Frame name="FrameScaleSlider">
        <Size>
          <AbsDimension x="232" y="50" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="3" y="-214" />
            </Offset>
          </Anchor>
        </Anchors>
        <Frames>
          <Slider name="FSSlider" enableMouse="true" minValue="50" maxValue="100" defaultValue="100" valueStep="1" orientation="HORIZONTAL">
            <Size>
              <AbsDimension x="128" y="17" />
            </Size>
            <Anchors>
              <Anchor point="LEFT" />
              <Anchor point="RIGHT" />
            </Anchors>
            <Scripts>
                <OnValueChanged>
                    DWMPackBaseFrame:SetScale(value / 100);
                </OnValueChanged>
            </Scripts>
            <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="Sets Frame Size">
                  <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="50%">
                  <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="100%">
                  <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>
I don't have the code for the Minimap Position slider and Minimap Radius sliders because the scripts wouldn't work and no matter what I tried I got lost and failed. Any suggestions to get these sliders working would be appreciated.

Thanks in advance.
__________________
To give is to receive so the more that you give the more that you receive.

Last edited by Samsan : 05-26-09 at 04:18 AM.
  Reply With Quote
05-30-09, 09:01 PM   #2
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Answer to your PM:

Originally Posted by Samsan View Post
1. Show or hide minimap button.....
The code:

Code:
            <OnClick>
                if DWMPackMinimapButton.ShowMinimapButtonCheckButton then
                    DWMPackMinimapButton.ShowMinimapButtonCheckButton = false
                    DWMPackMinimapButton:Hide()
                else
                    DWMPackMinimapButton.ShowMinimapButtonCheckButton = true
                    DWMPackMinimapButton:Show()
                end
                self:SetChecked(DWMPackMinimapButton.ShowMinimapButtonCheckButton)
            </OnClick>
Lemme ask you this: when you click the button does it always stay checked?

2. Lock/Unlock the frame.... I can lock or unlock the frame ok buut it clings to the cursor and you have to click it twice as per above to unlock it.

The code:
Code:
            <OnClick>
                if DWMPackBaseFrame.FrameLockCheckButton then
                    DWMPackBaseFrame.FrameLockCheckButton = false
                    DWMPackBaseFrame:StartMoving();
                else
                    DWMPackBaseFrame.FrameLockCheckButton = true
                    DWMPackBaseFrame:StopMovingOrSizing();
                end
                self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
            </OnClick>
I know something is wrong here, but I can't put my finger on it at the moment. Hmmm....

3. Sliders... Scale slider

The scale slider only has 2 settings so it seems, 100% and 50% even though it has a step value of 1. When you go to adjust it, it jumps to 50% and won't move via increments like it should.

The code:
Code:
      <Frame name="FrameScaleSlider">
        <Size>
          <AbsDimension x="232" y="50" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="3" y="-214" />
            </Offset>
          </Anchor>
        </Anchors>
        <Frames>
          <Slider name="FSSlider" enableMouse="true" minValue="50" maxValue="100" defaultValue="100" valueStep="1" orientation="HORIZONTAL">
            <Size>
              <AbsDimension x="128" y="17" />
            </Size>
            <Anchors>
              <Anchor point="LEFT" />
              <Anchor point="RIGHT" />
            </Anchors>
            <Scripts>
                <OnValueChanged>
                    DWMPackBaseFrame:SetScale(value / 100);
                </OnValueChanged>
            </Scripts>
            <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="Sets Frame Size">
                  <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="50%">
                  <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="100%">
                  <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>
Honestly, I tried to work with sliders/scroll frames and just couldn't get it to work correctly either. I wound up simply using the Faux template for scroll frames.

Keep in mind that I'm not savvy with XML really. I found it too much of a hassle (as you're learning I see) and went to strictly LUA. At least that way it would spit errors with line references where as XML will simply just not work.
  Reply With Quote
05-30-09, 09:19 PM   #3
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
2. Lock/Unlock the frame.... I can lock or unlock the frame ok buut it clings to the cursor and you have to click it twice as per above to unlock it.

The code:
Code:
            <OnClick>
                if DWMPackBaseFrame.FrameLockCheckButton then
                    DWMPackBaseFrame.FrameLockCheckButton = false
                    DWMPackBaseFrame:StartMoving();
                else
                    DWMPackBaseFrame.FrameLockCheckButton = true
                    DWMPackBaseFrame:StopMovingOrSizing();
                end
                self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
            </OnClick>
Just looked over it again and noticed what was wrong. When the button is clicked, you just want to change the button/setting correct? With your current setup it's doing what it's supposed to: the frame will always be "moving" until you uncheck the button. I'm assuming you're simply looking to lock dragging. In which you would:

XML BUTTON:
Code:
            <OnClick>
                if DWMPackBaseFrame.FrameLockCheckButton then
                    DWMPackBaseFrame.FrameLockCheckButton = false
                else
                    DWMPackBaseFrame.FrameLockCheckButton = true
                end
                self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
            </OnClick>
On the frame itself, when you specify the movement script you would make the lock check. In your frame's script tag:
Code:
<Scripts>
	<OnDragStart>function(self)
		if DWMPackBaseFrame.FrameLockCheckButton == true then return end <!- do nothing, frame locked ->
		else
			self:StartMoving()
		end
	</OnDragStart>
	<OnDragStop>self:StopMovingOrSizing()</OnDragStop>
</Scripts>
Now I'm sure I screwed up the formatting (again, haven't used XML in ages) but should give you a general idea to make it work correctly.
  Reply With Quote
05-30-09, 10:54 PM   #4
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
Sliders and checkboxs

Thx for that, basically as you said, I just needed the checkboxes to tick untick which they do ... I also realized that I need to explain my problems much more clearly...sorry about the confusion. I ended up leaving the script running from the xml checkbox, figured that when you unlocked the frame, locked by default, it would move with the cursor still over the checkbox and release when locked or checked again. I got a bit fuzzed by it. There are 4 sliders in the options, Frame Scale, Background Alpha, Minimap Radius and Minimap position.

The checkboxes I have finally sorted out, thx heaps...they are checked by default so when adding the line "self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)" it caused the button to be double checked in essence so it required selection, then activation.

The frame scale slider just has the 2 settings for some reason and wont shrink incrementally, just jumps from 100 to 50 even though its set to move at "step value=1".

The minimap position slider doesn't seem to work nor does the radius slider but I need to look into lua script for those and an xml thingy to link it from the sliders...lol or the xml scripts.

My main issue is the buttonText in lua rep frame with scrollframe .... "arrrgh" though causing an error...it worked to start with then through an error "can't index local buttonText."

OH by the way I have given you a plug on the main options screen when it opens as a thx for all the help you're giving me. If you would like your mods or something added/mentioned let me know plz and I'll add it in there for you...free advertising...lol
__________________
To give is to receive so the more that you give the more that you receive.

Last edited by Samsan : 05-31-09 at 12:37 AM.
  Reply With Quote
05-31-09, 02:46 AM   #5
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Samsan View Post
Thx for that, basically as you said, I just needed the checkboxes to tick untick which they do ... I also realized that I need to explain my problems much more clearly...sorry about the confusion. I ended up leaving the script running from the xml checkbox, figured that when you unlocked the frame, locked by default, it would move with the cursor still over the checkbox and release when locked or checked again. I got a bit fuzzed by it. There are 4 sliders in the options, Frame Scale, Background Alpha, Minimap Radius and Minimap position.

The checkboxes I have finally sorted out, thx heaps...they are checked by default so when adding the line "self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)" it caused the button to be double checked in essence so it required selection, then activation.

The frame scale slider just has the 2 settings for some reason and wont shrink incrementally, just jumps from 100 to 50 even though its set to move at "step value=1".

The minimap position slider doesn't seem to work nor does the radius slider but I need to look into lua script for those and an xml thingy to link it from the sliders...lol or the xml scripts.

My main issue is the buttonText in lua rep frame with scrollframe .... "arrrgh" though causing an error...it worked to start with then through an error "can't index local buttonText."

OH by the way I have given you a plug on the main options screen when it opens as a thx for all the help you're giving me. If you would like your mods or something added/mentioned let me know plz and I'll add it in there for you...free advertising...lol
Heh. Credit appreciated, plugs not really needed. Most tend to frown upon "advertisements" for other mods.

You'd have to post/PM the lua for me to look at. I have a feeling that you may have things a bit backwards with your local declarations.

EDIT: Just out of curiosity, what value are you passing to the scale?

Last edited by Sythalin : 05-31-09 at 02:50 AM.
  Reply With Quote
05-31-09, 06:27 AM   #6
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
Smile Sliders and checkboxs

The minimap button radius tag:
Code:
<Slider name="MBRSlider" enableMouse="true" minValue="0.5" maxValue="1" defaultValue="1" valueStep="0.1" orientation="HORIZONTAL">
with scripts:
Code:
<Scripts>
<OnValueChanged>
<!--DWMPackMinimapButton:SetButtonRadius(value);  commented out cause of errors.. Button pos was a similar script-->
</OnValueChanged>
</Scripts>

The minimap button pos tag:
Code:
<Slider name="MBPSlider" enableMouse="true" minValue="0" maxValue="360" defaultValue="197" valueStep="1" orientation="HORIZONTAL">
Frame Scale slider:
Code:
       <Frame name="FrameScaleSlider">
        <Size>
          <AbsDimension x="232" y="50" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="3" y="-214" />
            </Offset>
          </Anchor>
        </Anchors>
        <Frames>
          <Slider name="FSSlider" enableMouse="true" minValue="50" maxValue="100" defaultValue="100" valueStep="1" orientation="HORIZONTAL">
            <Size>
              <AbsDimension x="128" y="17" />
            </Size>
            <Anchors>
              <Anchor point="LEFT" />
              <Anchor point="RIGHT" />
            </Anchors>
            <Scripts>
                <OnValueChanged>
                    DWMPackBaseFrame:SetScale(value / 100);
                </OnValueChanged>
            </Scripts>
            <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="Sets Frame Size">
                  <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="50%">
                  <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="100%">
                  <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>
__________________
To give is to receive so the more that you give the more that you receive.

Last edited by Samsan : 05-31-09 at 06:30 AM.
  Reply With Quote
05-31-09, 06:42 AM   #7
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
OK her goes the mess LUA:

DWMP_NUM_FACTIONS_DISPLAYED = 15;
DWMPACKREPSCROLLFRAME_FACTIONHEIGHT = 26;
DWMPACKREPFRAME_ROWSPACING = 23;

--------------------------------------------------------------------------
-- Recolors Blizzards Rep Frame Bars and Watched Rep Bar per faction level
--------------------------------------------------------------------------
DWMP_FACTION_BAR_COLORS = {
[1] = {r = 1.0, g = 0, b = 0}, -- 36000 Hated - Red
[2] = {r = 1.0, g = 0.5019608, b = 0}, -- 3000 Hostile - Orange
[3] = {r = 1.0, g = 0.8196079, b = 0}, -- 3000 Unfriendly - Yellow
[4] = {r = 0.8, g = 0.9, b = 0.8}, -- 3000 Neutral - Grey
[5] = {r = 1.0, g = 1.0, b = 1.0}, -- 6000 Friendly - White
[6] = {r = 0, g = 0.6, b = 0.1}, -- 12000 Honored - Green
[7] = {r = 0, g = 0, b = 1.0}, -- 21000 Revered - Blue
[8] = {r = 0.5803922, g = 0, b = 0.827451}, -- 1000 Exalted - Purple
};

------------------------------
-- Tracking information table
------------------------------
--~ DWMPackRepData = { };

--~ DWMPackRepData["RCFactions"] = {
--~ [1] = "FACTIONS_DARKSPEAR",
--~ [2] = "FACTIONS_ORGRIMMAR",
--~ [3] = "FACTIONS_SILVERMOON",
--~ [4] = "FACTIONS_THUNDERBLUFF",
--~ [5] = "FACTIONS_UNDERCITY",
--~ [6] = "FACTIONS_DARNASSUS",
--~ [7] = "FACTIONS_EXODAR",
--~ [8] = "FACTIONS_GNOMEREGAN",
--~ [9] = "FACTIONS_IRONFORGE",
--~ [10] = "FACTIONS_STORMWIND",
--~ };

--~ DWMPackRepData["HodirFaction"] = {
--~ [1] = "UlduarRelic",
--~ [2] = "CrystalShard",
--~ };

--~ DWMPackRepData["CanarionFaction"] = {
--~ [1] = "CooilfangArms",
--~ [2] = "LackeyEars",
--~ };
--~ DWMPackRepData["Aldor"] = {
--~ [1] = "KiljadenMarks",
--~ [2] = "SargerasMarks",
--~ [3] = "FelArms",
--~ };
--~ DWMPackRepData["Scryers"] = {
--~ [1] = "FirewingSignet",
--~ [2] = "SunfurySignet",
--~ [3] = "ArcaneTomes",
--~ };

--local oldReputationFrame_Update;

function DWMPackRepFrame_OnLoad(self)
--oldReputationFrame_Update = ReputationFrame_Update;
--ReputationFrame_Update = DWMPackRepFrame_Update;
local DWMPackRepFrame_UpdateFrame
self:RegisterEvent("UPDATE_FACTION");
local _, race = UnitRace("player")
end

-- Round function for percentages
function round(x)
return floor(x + 0.5)
end

function DWMPackRepScrollFrame_Update(self)

local numFactions = GetNumFactions();
local numFactions, totalCount = GetNumFactions();
local line, name, _, standingID, bottomValue, topValue, earnedValue, _, _, isHeader, _, hasRep, isWatched, _;
--local name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo(factionIndex);
local self, button, buttonText, FactionName, FactionItems, FactionStanding, FactionPercent, FactionSession, FactionNumbers, FactionRepToGo;
local dwmpackrepIndex, factionIndex;
local columnTable;
local dwmpackrepOffset = FauxScrollFrame_GetOffset(DWMPackRepScrollFrame);
local color = DWMP_FACTION_BAR_COLORS[standingID];

local showScrollBar = nil;
if ( numFactions > DWMP_NUM_FACTIONS_DISPLAYED ) then
showScrollBar = 1;
end
local displayedText = "";
if ( numFactions > DWMP_NUM_FACTIONS_DISPLAYED ) then
displayedText = format(button.buttonText);
end

local i;

for i = 1, GetNumFactions() do

name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild= GetFactionInfo(i);
dwmpackrepIndex = dwmpackrepOffset + i;
button = getglobal("DWMPackRepEntryButton"..i);
button.dwmpackrepIndex = dwmpackrepIndex;
FactionName, FactionItems, FactionStanding, FactionPercent, FactionSession, FactionNumbers, FactionRepToGo = GetText(dwmpackrepIndex);
columnTable = { FactionName, FactionItems, FactionStanding, FactionPercent, FactionSession, FactionNumbers, FactionRepToGo};
if isHeader then
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionName");
button.buttonText:SetText(name);
return;
end
if isHeader == 1 and hasRep == nil and barValue ~= 0 then
hasRep = 1
if description == '' then
description = GRAY_FONT_COLOR_CODE .. '(hidden reputation)' .. FONT_COLOR_CODE_CLOSE
end
end
return name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep;
end
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionName");
button.Text:SetText(name);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionItems");
button.Text:SetText("items");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionStanding");
button.Text:SetText(standingText);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionPercent");
button.Text:SetText(math.floor( (earnedValue-bottomValue)/(topValue-bottomValue) * 100).."% ");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionSession");
button.Text:SetText("session");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionNumbers");
button.Text:SetText(earnedValue-bottomValue.."/"..topValue-bottomValue);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionRepToGo");
button.Text:SetText(topValue-earnedValue);


for i = 1, NumFactions() do
name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild= GetFactionInfo(i);
if not isHeader then
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionName");
buttonText:SetText(name);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionItems");
buttonText:SetText("items");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionStanding");
buttonText:SetText(standingText);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionPercent");
buttonText:SetText(math.floor( (earnedValue-bottomValue)/(topValue-bottomValue) * 100).."% ");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionSession");
buttonText:SetText("session");
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionNumbers");
buttonText:SetText(earnedValue-bottomValue.."/"..topValue-bottomValue);
buttonText = getglobal("DWMPackRepEntryButton"..i.."FactionRepToGo");
buttonText:SetText(topValue-earnedValue);
end

standingText = ""
if standingID == 1 then
standingText = "|cff8b0000Hated|r";
elseif standingID == 2 then
standingText = "|cffff1919Hostile|r";
elseif standingID == 3 then
standingText = "|cffff8C00Unfriendly|r";
elseif standingID == 4 then
standingText = "|cffc0c0c0Neutral|r";
elseif standingID == 5 then
standingText = "|cffffffffFriendly|r";
elseif standingID == 6 then
standingText = "|cff19ff19Honored|r";
elseif standingID == 7 then
standingText = "|cff4169e1Revered|r";
elseif standingID == 8 then
standingText = "|cff9932ccExalted|r";
end
DWMPackRepScrollFrame:Show();
end
end

function DWMPackRepFrame_OnLoad()
local numFactions = GetNumFactions();
name, description, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed, hasRep, isWatched, isChild = GetFactionInfo();
for i=1,50 do
DWMPackRepIndexData[i] = name.."items"..standingText..math.floor( (earnedValue-bottomValue)/(topValue-bottomValue) * 100).."% ".."session"..earnedValue-bottomValue.."/"..topValue-bottomValue..topValue-earnedValue;
end
DWMPackRepScrollFrame:Show()
end

--~ function DWMPackRepScrollFrame_Update()
--~ local DWMPackRepIndexData = { };
--~ local line, lineplusoffset
--~ FauxScrollFrame_Update(DWMPackRepScrollFrame,50,15,20)
--~ -- 50 is max entries, 15 is number of lines, 20 is pixel height of each line
--~ for line = 1, 15 do
--~ lineplusoffset = line + FauxScrollFrame_GetOffset(DWMPackRepScrollFrame)
--~ if lineplusoffset < 50 then
--~ _G["DWMPackRepEntryButton"..line]:SetText(DWMPackRepIndexData[lineplusoffset])
--~ _G["DWMPackRepEntryButton"..line]:Show()
--~ else
--~ _G["DWMPackRepEntryButton"..line]:Hide()
--~ end
--~ end
--~ end

function DWMPackRepFrame_OnEvent(self, event, ...)
if ( event == "UPDATE_FACTION" ) then
if ( self:IsVisible() ) then
DWMPackRepFrame_Update();
end
end
end

function DWMPackRepFrame_OnShow(self)

if ( DWMPackRepFrame:IsShown() ) then
DWMPackRepFrame_Update();
DWMPackRepScrollFrame_Update(self);
end
end
__________________
To give is to receive so the more that you give the more that you receive.
  Reply With Quote
05-31-09, 06:42 AM   #8
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
OK her goes the mess XML:

<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">

<Button name="DWMPackRepEntryButtonTemplate" virtual="true">
<Size>
<AbsDimension x="670" y="22" />
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentFactionName" inherits="GameFontNormal" justifyH="LEFT">
<Size>
<AbsDimension x="140" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="7" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionItems" inherits="GameFontHighlight" justifyH="CENTER">
<Size>
<AbsDimension x="50" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionName" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="5" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionStanding" inherits="GameFontHighlight" justifyH="LEFT">
<Size>
<AbsDimension x="80" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionItems" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="25" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionPercent" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="47" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionStanding" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="10" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionSession" inherits="GameFontHighlight" justifyH="CENTER">
<Size>
<AbsDimension x="55" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionPercent" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="19" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionNumbers" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="90" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionSession" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="37" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentFactionRepToGo" inherits="GameFontHighlight" justifyH="RIGHT">
<Size>
<AbsDimension x="60" y="14"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentFactionNumbers" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="18" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont style="GameFontNormalSmall" />
<Scripts>
<OnLoad>
self:SetFrameLevel(self:GetFrameLevel() + 1);
</OnLoad>
</Scripts>
</Button>
<Button name="DWMPackRepColumnHeaderTemplate" hidden="false" virtual="true">
<Size>
<AbsDimension x="110" y="22" />
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentText" inherits="GameFontNormalSmall" justifyH="LEFT"/>
</Layer>
</Layers>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="39" y="-90" />
</Offset>
</Anchor>
</Anchors>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont style="GameFontNormalSmall" />
<Scripts>
<OnLoad>
self:SetFrameLevel(self:GetFrameLevel() + 1);
</OnLoad>
</Scripts>
</Button>

<Frame name="DWMPackRepFrame" alpha="0.85" hidden="false" parent="DWMPackBaseFrame" toplevel="true" enableMouse="true">
<Size>
<AbsDimension x="690" y="365" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackBaseFrame">
<Offset>
<AbsDimension x="27" y="-89" />
</Offset>
</Anchor>
</Anchors>
<TitleRegion setAllPoints="true" />
<Frames>

<ScrollFrame name="DWMPackRepScrollFrame" inherits="FauxScrollFrameTemplate" enableMouse="true">
<Size>
<AbsDimension x="690" y="360"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepFrame">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self, offset, 16, DWMPACKREPFRAME_FACTIONHEIGHT, DWMPackRepScrollFrame_Update);
</OnVerticalScroll>
<OnShow>
DWMPackRepScrollFrame_Update(self);
</OnShow>
</Scripts>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size>
<AbsDimension x="31" y="259"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-2" y="3"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.484375" top="0" bottom="1.0"/>
</Texture>
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size>
<AbsDimension x="31" y="108"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-2" y="-4"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.515625" right="1.0" top="0" bottom="0.421875"/>
</Texture>
</Layer>
</Layers>
</ScrollFrame>

<Button name="DWMPackRepEntryButton1" inherits="DWMPackRepEntryButtonTemplate" id="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="35" y="-25"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton2" inherits="DWMPackRepEntryButtonTemplate" id="2">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton1" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton3" inherits="DWMPackRepEntryButtonTemplate" id="3">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton2" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton4" inherits="DWMPackRepEntryButtonTemplate" id="4">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton3" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton5" inherits="DWMPackRepEntryButtonTemplate" id="5">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton4" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton6" inherits="DWMPackRepEntryButtonTemplate" id="6">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton5" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton7" inherits="DWMPackRepEntryButtonTemplate" id="7">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton6" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton8" inherits="DWMPackRepEntryButtonTemplate" id="8">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton7" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton9" inherits="DWMPackRepEntryButtonTemplate" id="9">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton8" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton10" inherits="DWMPackRepEntryButtonTemplate" id="10">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton9" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton11" inherits="DWMPackRepEntryButtonTemplate" id="11">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton10" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton12" inherits="DWMPackRepEntryButtonTemplate" id="12">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton11" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton13" inherits="DWMPackRepEntryButtonTemplate" id="13">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton12" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton14" inherits="DWMPackRepEntryButtonTemplate" id="14">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton13" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton15" inherits="DWMPackRepEntryButtonTemplate" id="15">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton14" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<!--<Button name="DWMPackRepEntryButton16" inherits="DWMPackRepEntryButtonTemplate" id="16">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton15" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton17" inherits="DWMPackRepEntryButtonTemplate" id="17">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton16" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton18" inherits="DWMPackRepEntryButtonTemplate" id="18">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton17" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton19" inherits="DWMPackRepEntryButtonTemplate" id="19">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton17" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>
<Button name="DWMPackRepEntryButton20" inherits="DWMPackRepEntryButtonTemplate" id="20">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepEntryButton19" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Button>-->

<Button name="DWMPackRepColumnHeader1" inherits="DWMPackRepColumnHeaderTemplate" text="Faction">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="7" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader2" inherits="DWMPackRepColumnHeaderTemplate" text="Items Left">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="158" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader3" inherits="DWMPackRepColumnHeaderTemplate" text="Standing">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="230" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader4" inherits="DWMPackRepColumnHeaderTemplate" text="Percent">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="323" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader5" inherits="DWMPackRepColumnHeaderTemplate" text="Session Gains">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="403" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader6" inherits="DWMPackRepColumnHeaderTemplate" text="Raw Numbers">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="503" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="DWMPackRepColumnHeader7" inherits="DWMPackRepColumnHeaderTemplate" text="Rep To Go">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="DWMPackRepScrollFrame" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="598" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</Button>
</Frames>
<Scripts>
<!--<OnLoad function="DWMPackRepFrame_OnLoad"/>
<OnShow function="DWMPackRepFrame_OnShow"/>
<OnEvent function="DWMPackRepFrame_OnEvent"/>
<OnUpdate function="DWMPackRepFrame_OnUpdate"/>
<OnMouseWheel function=""/>-->
</Scripts>
</Frame>
</Ui>
__________________
To give is to receive so the more that you give the more that you receive.
  Reply With Quote
05-31-09, 06:47 AM   #9
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
Smile Np..

Originally Posted by ChaosInc View Post
Heh. Credit appreciated, plugs not really needed. Most tend to frown upon "advertisements" for other mods.

You'd have to post/PM the lua for me to look at. I have a feeling that you may have things a bit backwards with your local declarations.

EDIT: Just out of curiosity, what value are you passing to the scale?
above are the rep pages lua and xml in full with the buttonText errors.

I think I really suck at this but am persisting, I guess you can see why I asked for someone to write it for me....lol Also I can zip/rar and email the project complete thus far if needed, I don't mind at all... Just appreciate the help .
__________________
To give is to receive so the more that you give the more that you receive.
  Reply With Quote
05-31-09, 09:31 AM   #10
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
Originally Posted by Samsan View Post
above are the rep pages lua and xml in full with the buttonText errors.

I think I really suck at this but am persisting, I guess you can see why I asked for someone to write it for me....lol Also I can zip/rar and email the project complete thus far if needed, I don't mind at all... Just appreciate the help .
Again, don't feel bad. In all honesty, you sound exactly like I did not even a year ago. My projects were trial-and-error learning processes for me while asking others for help, so I know how you feel.

Also, let me introduce you to a friend of mine: Pastey

Trying to read code at that length in forums is a mess, not to mention very spammy. If you would, please edit/repost em and post the links instead.
  Reply With Quote
05-31-09, 11:20 AM   #11
Samsan
An Aku'mai Servant
 
Samsan's Avatar
Join Date: May 2009
Posts: 33
Smile Love Patsy...Thx

Now that's a great friend lol ty

Here's the links to the scripts, I can post the entire project if you need it.

the lua script - http://pastey.net/115170
the xml script - http://pastey.net/115171

Also found it a tad easier using the wow gui for the options. It will be interesting to see how I go there, but I've got the sliders working and a checkbutton so far. Haven't been at it long so I'll pm you with the results... 3.30am almost so thx again for all the help. cheers
__________________
To give is to receive so the more that you give the more that you receive.

Last edited by Samsan : 05-31-09 at 11:24 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Check Button and Slider Hassles!

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off