Thread Tools Display Modes
08-21-08, 04:58 AM   #1
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Basic help with FauxScrollFrame

I have some really simple code:

Code:
local scf = CreateFrame("SCROLLFRAME", "TestScrollFrame", UIParent, "FauxScrollFrameTemplate")
scf:SetPoint("CENTER", "UIParent", "CENTER", 0, 0)
scf:SetWidth(100)  
scf:SetHeight(100) 
scf:SetBackdrop({bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile="", tile = false, tileSize = 0, edgeSize = 0, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
scf:SetScript("OnVerticalScroll", function() DEFAULT_CHAT_FRAME:AddMessage("test") end)
scf:EnableMouse(true)
scf:Show()
This should show a frame and the message "test" on any scroll event. The problem is, the frame is show ... but there's no message.

Maybe I'm just blind ... or stupid ... or both ... but I absolutely can't see why there's no message shown.
Could someone please give me a hint what's wrong with this?
  Reply With Quote
08-21-08, 08:28 AM   #2
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
try something like that in wowlua

Code:
local scf = CreateFrame("ScrollFrame", "TestScrollFrame", UIParent, "UIPanelScrollFrameTemplate")
local scc = CreateFrame("Frame", "TestScrollChild", scf)
scf:SetScrollChild(scc)
scf:SetPoint("CENTER", "UIParent", "CENTER", 0, 0)
scc:SetPoint("TOPLEFT", "TestScrollFrame", "TOPLEFT", 0, 0)
scf:SetWidth(100)  
scf:SetHeight(100) 
scc:SetWidth(300)  
scc:SetHeight(300) 
scf:SetHorizontalScroll(-50)
scf:SetVerticalScroll(50)
scf:SetBackdrop({bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", edgeFile="", tile = false, tileSize = 0, edgeSize = 0, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
scf:SetScript("OnVerticalScroll", function() DEFAULT_CHAT_FRAME:AddMessage("test") end)
scf:EnableMouse(true)
scf:Show()
scc:Show()
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)

Last edited by Mera : 08-21-08 at 08:32 AM.
  Reply With Quote
08-21-08, 10:11 AM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Hm. Ok. Thanks a lot. This is working.

Nevertheless I still would love to know why my code isn't working.
  Reply With Quote
08-21-08, 10:48 AM   #4
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Why do you want to use FauxScrollFrame? It is, by far, one of the worst tools to use and you almost always have a better way of doing it.

To quote purl:
(12:46:28) (purl) i guess fauxscrollframe is one of the first Lua/XML systems written by Blizzard for the WoW user interface. Its learning curve resembles an inverted L, and Zootfizzle hates it. Along with cogs, it is in the top five on his "dead to me" list.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
08-21-08, 12:14 PM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I don't want to.
I just would like to know what's wrong with my code. It's just general curiosity.
  Reply With Quote
08-22-08, 07:19 AM   #6
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
Originally Posted by Duugu View Post
I don't want to.
I just would like to know what's wrong with my code. It's just general curiosity.
difficult to say I don't know myself because on paper it looks fine but I see you have a missing ScrollChild you have to set with SetScrollChild, not sure but it is possible to be required to scroll in a defined area because your code actually doesnt let us scroll something so you can setup any event OnVerticalScroll nothing will happen else ingame it doesn't spawn error so I guess it is about a missing anchor point, width or a behaviour with the changes made by Blizzard upon the time and its restricted lua code, most recent addon's codes I have read are using UIPanelScrollFrameTemplate, haven't for FauxScrollFrame or just recently in cladhaire's book wow programming, it use to describe the use of FauxScrollFrame if you really need it go for it.
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)

Last edited by Mera : 08-22-08 at 07:26 AM.
  Reply With Quote
08-22-08, 11:30 AM   #7
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
In fact it's the missing ScrollChild.
Thanks again.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Basic help with FauxScrollFrame


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