View Single Post
09-28-17, 01:21 PM   #3
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Originally Posted by Kakjens View Post
In my addon that does something similar I used :Hide() before making the object visible.
Minor fix: after
Lua Code:
  1. if not OrderHallCommandBar then return end
you might want to declare a
Lua Code:
  1. local prevName
prevName is used as placing later on actually
Code:
if prevName == nil then
	currency[name]:SetPoint("LEFT", OrderHallCommandBar.Currency, "RIGHT", 10, 0)
	prevName = name
else
	currency[name]:SetPoint("LEFT", currency[prevName].text, "RIGHT", 10, 0)
	prevName = name
end
as i is not 1, 2, 3.. for isWatched it's 4, 10, 13 in my case, otherwise i'd have used currency[i] in the first place.
Bearing in mind flexibility as not every char/user would want to use the exact same currencies i use, there's my dilemma, therefore i used prevName as a variable to use currency[prevName].
i tried polluting a table and using a counter variable, so i could have used (e.g) slots[i], but that brought other issues.
Like i said i tried much working around this so i could effectively use a flexible system that displays the isWatched currencies (up to 3 as limited per defaultUI).
it's very likely just a structural problem with my code, as it does kinda work.
before i had it hardcoded in, later on used saved vars where i could add an item to the list, but it always required an uireload. And that's what i want to prevent here

edit: just had an idea pop up.
As the Default UI dictates 3 or less currencies i could create the frames beforehand and use :Hide() and :Show() as you've mentioned before. I'll try that now, thanks!

Last edited by Lolzen : 09-28-17 at 01:32 PM.
  Reply With Quote