Quantcast

Minor fixes to the ScrollFrame in MobListGUI.

F16Gaming [10-23-12 - 01:12]
Minor fixes to the ScrollFrame in MobListGUI.

Make ScrollFrame stay consistent between Hide/Show.
Filename
MobList.lua
diff --git a/MobList.lua b/MobList.lua
index bec55f1..c5cb849 100644
--- a/MobList.lua
+++ b/MobList.lua
@@ -134,12 +134,12 @@ function ML:Show()
 	if not created then
 		ML:Create()
 	end
-	if frame:IsShowing() then return end
+	if frame:IsShown() then return end
 	frame:Show()
 end

 function ML:Hide()
-	if not frame or not frame:IsShowing() then return end
+	if not frame or not frame:IsShown() then return end
 	frame:Hide()
 end

@@ -311,6 +311,10 @@ function ML:Create()
 	frame.statusLabel:SetText(STATUS_TEXT:format(1, limit, #Mobs))

 	self:UpdateEntries(LastOffset)
+
+	frame:SetScript("OnShow", function() ML:UpdateMobs() ML:UpdateEntries() end)
+
+	created = true
 end

 function ML:UpdateMobs(sort)
@@ -336,7 +340,7 @@ function ML:UpdateEntries(offset)
 		end
 		return
 	end
-	offset = tonumber(offset) or 0
+	offset = (tonumber(offset) or LastOffset) or 0
 	LastOffset = offset
 	local limit = ROW_COUNT
 	if limit > #Mobs then