WIP Details for trials

His Dad [07-02-15 - 04:42]
WIP Details for trials
Filename
HistOffline.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index ee2d3bd..df4bd7c 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -544,7 +544,63 @@ end
 			iup.SetAttribute(me.Trials_box, "BGCOLOR0:5", Colour_Heading_Complete)
 		end

+-- Create Trials Achievements Detail Boxes=======================

+		me.Trials_Detail_box = {}
+		me.Trials_Detail_Zbox = iup.zbox{}
+
+		local name, link
+		for key, info in pairs(Trials_Info) do	-- for each zone
+		--	print ("LAng: "..lang .. "  " ..key, dump(info))
+			me.Trials_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}
+
+			local Line = 1
+			me.Trials_Detail_box[key]:setcell(0,0, L.Ach_ID)
+			me.Trials_Detail_box[key]:setcell(0,1, L.Name)
+			me.Trials_Detail_box[key]:setcell(0,2, L.Link)
+			iup.SetAttribute(me.Trials_Detail_box[key], "READONLY", "YES")
+			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENT0", "ACENTER")
+			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENTLIN0", "ALEFT")
+			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENT1", "ALEFT")
+			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENT2", "ALEFT")
+			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH0", "30")
+			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH1", "150")
+			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH2", "250")
+			for _, id in ipairs (info.quests) do	-- get the quests of the zone
+				me.Trials_Detail_box[key].numlin = Line
+				me.Trials_Detail_box[key]:setcell(Line,0, tostring(id))
+
+				if Ach_Detail[id] == nil then
+					name = "UNKN"
+				else
+					name = Ach_Detail[id].name
+				end
+				link = SQ_dat[id].link1
+				me.Trials_Detail_box[key]:setcell(Line,1, name)
+				me.Trials_Detail_box[key]:setcell(Line,2, link)
+				-- Set Detail Colours on achievement
+				if thischar.ach[id] == nil  then
+					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Not_Complete)	-- Nope
+				end
+
+				Line= Line+1
+			end
+		-- Click on Link,
+		local thisTrialsDetail = me.Trials_Detail_box[key]	-- The function def below doesn't like the [key]
+		function thisTrialsDetail:click_cb(L,C)
+				if C == 2 then
+					iup.Help(self:getcell(L,C))		-- Launch Browser
+				else
+					return IUP_IGNORE
+				end
+			end
+
+			iup.Append(me.Trials_Detail_Zbox, me.Trials_Detail_box[key])
+		end
+
+		function me.Trials_box:enteritem_cb(L,C)
+			me.Trials_Detail_Zbox.value = me.Trials_Detail_box[tostring(L) .. tostring(C)]
+		end


 		-- Create Locations Box==============================================