Quantcast
Scroll Frame Buttons not visible - WoWInterface
Thread Tools Display Modes
12-06-20, 10:36 PM   #1
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 104
Scroll Frame Buttons not visible

Hi all

Whoot got it all working.

The major things I learnt to get this working;
Make sure that you are calling the correct frame, even if it looks the same, (I had an extra space).
Make sure all variables are local, even if they are in a local function.
Make the step value that same as the button height, this ensures the scroll stops at the maximum of the list.

This is my final update code chunk;
Lua Code:
  1. local function updateDeathKnightSpellList()
  2.     FauxScrollFrame_Update(
  3.         DeathKnightScrollFrame,
  4.         #SpellChatGlobalTable1,
  5.         NumberList.scrollButtonNumber,
  6.         NumberList.scrollButtonWidth
  7.     )
  8.     for index = 1, NumberList.scrollButtonNumber do
  9.         local offset = index + FauxScrollFrame_GetOffset(DeathKnightScrollFrame)
  10.         local button = DeathKnightScrollFrame.buttons[index]
  11.         button.index = offset
  12.         if offset <= #SpellChatGlobalTable1 then
  13.             button:SetText(SpellChatGlobalTable1[offset])
  14.             button:Show()
  15.         else
  16.             button:Hide()
  17.         end
  18.     end
  19. end

And my final scroll frames;
Lua Code:
  1. local DeathKnightScrollParent = CreateFrame("Frame", "DeathKnightScrollParent", DeathKnightFrame, "BackdropTemplate", "TooltipBorderedFrameTemplate")
  2. DeathKnightScrollParent:SetBackdrop(
  3.     {
  4.         bgFile = nil,
  5.         insets = nil,
  6.         tileSize = nil,
  7.         tile = false,
  8.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  9.         edgeSize = NumberList.edgeSize
  10.     }
  11. )
  12. DeathKnightScrollParent:SetBackdropBorderColor(unpack(ColourList.deathKnight))
  13. DeathKnightScrollParent:SetSize(NumberList.scrollFrameWidth, NumberList.scrollFrameHeight)
  14. DeathKnightScrollParent:SetPoint("TOP", DeathKnightFrameaddSpellButton, "BOTTOM", 0, -5)
  15.  
  16. local DeathKnightScrollFrame =
  17.     CreateFrame("ScrollFrame", "DeathKnightScrollFrame", DeathKnightScrollParent, "FauxScrollFrameTemplate")
  18. DeathKnightScrollFrame:SetPoint("TOPLEFT", 0, -8)
  19. DeathKnightScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  20. DeathKnightScrollFrame:SetScript(
  21.     "OnVerticalScroll",
  22.     function(self, offset)
  23.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.scrollButtonHeight, updateDeathKnightSpellList)
  24.     end
  25. )
  26.  
  27. DeathKnightScrollFrame.buttons = {}
  28. for index = 1, NumberList.scrollButtonNumber do
  29.     DeathKnightScrollFrame.buttons[index] =
  30.         CreateFrame("Button", "btn" .. index, DeathKnightScrollParent, "OptionsListButtonTemplate")
  31.     local button = DeathKnightScrollFrame.buttons[index]
  32.     button:SetSize(NumberList.scrollFrameWidth, NumberList.scrollButtonHeight)
  33.     button:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.scrollButtonHeight - 8)
  34.     button:SetScript(
  35.         "OnClick",
  36.         function(self)
  37.             print("Test Print -  " .. SpellChatGlobalTable1[self.index])
  38.         end
  39.     )
  40. end

Here is a link to the scroll frame example that I have been referencing.

Thanks to all for your suggestions and help.

Cheers
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz

Last edited by Walkerbo : 12-11-20 at 03:13 AM.
  Reply With Quote
12-07-20, 01:40 AM   #2
Zax
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 96
In this case, I would try first to add this debug line before "SetText()" at line 7:
Code:
print("index=", index, "offset=", offset, "SpellChatGlobalTable1[offset]=", SpellChatGlobalTable1[offset])
Don't know if it will help.
  Reply With Quote
12-07-20, 08:26 PM   #3
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 104
Just like I said there was a total small thing that prevented that buttons displaying.

In the update function I tried to update the scrollFrame which was not actually a frame in my code, I replaced it with the correct DeathKnightFrameScrollChild frame and now the buttons display.

However, I still have not been able to get the scroll frame to scroll.

I have been checking out other addons to see how they scroll without any success, so any further help would be great.


@Zax your suggestion of adding in a debug print does help, it is far too often that I could probably identify problems much earlier if I simply added debug prints
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
12-08-20, 01:22 AM   #4
Zax
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 96
I recently used this tutorial and it works:
https://wow.gamepedia.com/Making_a_s...lFrameTemplate

Though I had to replace:
Code:
FauxScrollFrame_Update(MyModScrollBar,50,5,16);
with
Code:
FauxScrollFrame_Update(MyModScrollBar,50,5,16, nil, nil, nil, nil, nil, nil, true);
  Reply With Quote
12-08-20, 11:51 PM   #5
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 104
Hi Zax

Thanks for that, I have tried adding all of the elements however that change had no effect.

I have not got the scroll frame working properly.
I can do a manual scroll by grabbing the scroll button and dragging.
But note the manual scrolls way beyond the last button which is also something that should not happen.

So I am still stuck on this one.

Here is an updated gif showing what is happening.

I really cannot see how this doesn't work, and it has got me banging my head against the desk.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
12-09-20, 01:56 AM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,609
I have yet to identify the cause of the overscrolling myself. Likely a number misrepresented somewhere that is telling it that there are more entries.
__________________
  Reply With Quote
12-10-20, 11:20 PM   #7
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 104
Hi Xrystal

I have got some of this working.
In my update function, I made the variables at line 9 & 10 local.
In my frame code, I made the variable at line 31 local.

So the last issue I have left is that I can still scroll beyond the end of the list of buttons.

I have updated my OP to reflect the current status of my issue.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
12-11-20, 03:16 AM   #8
Walkerbo
A Flamescale Wyrmkin
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 104
Whoot finally got it solved.

I had to make the step value the same as the button height.

I have edited the OP so all searching can see it first up.

Cheers all
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz

Last edited by Walkerbo : 12-11-20 at 03:22 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Scroll Frame Buttons not visible

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