WIP- mouseover broken

His Dad [01-10-17 - 19:10]
WIP- mouseover broken
Filename
HistOffline.lua
data/utility.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index cc6ee1b..7b48285 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -313,36 +313,10 @@ end
 					}

 -- Mouseover
-    matrix = dung.Grp[i].box
-	function matrix:mousemove_cb(l, c) 	-- odd issue with [] in function
-		if l == 0 or c == 0 then
-			detail.title = ""
-			return
-		end
-
-		local key = Grp_Dat[i].key[l]
-		if key == nil then
-			detail.title= "key is nil"
-			return
-		end
-
-		local ach = Grp_Dat[i].reverse_id[key]
-
-		if ach == nil then
-			detail.title = "No reverse lookup on " .. key
-			return
-		end
-		if Ach_Detail[ach] == nil then
-			detail.title = "No Achievement for " .. ach
-			print (detail.title)
-			return
-		end
-		detail.title = Ach_Detail[ach].description
-
-	end
-
-
-	--set lines Heading
+	dung.Grp[i].box.dat=Grp_Dat[i]
+	dung.Grp[i].box.mousemove_cb = box_mousemove_funct(self,l,c)
+
+		--set lines Heading
 	dung.Grp[i].box:setcell(0,0, L.Location)
 	--Set Line titles
 	for line,key in ipairs(Grp_Dat[i].key) do
@@ -387,34 +361,9 @@ end
 							iup.fill{},
 						}

-    matrix = dung.Craglorn[i].box
-	function matrix:mousemove_cb(l, c) 	-- odd issue with [] in function
-		if l == 0 or c == 0 then
-			detail.title = ""
-			return
-		end
-
-		local key = Craglorn_Dat[i].key[l]
-		if key == nil then
-			detail.title= "key is nil"
-			return
-		end
-
-		local ach = Craglorn_Dat[i].reverse_id[key]
-
-		if ach == nil then
-			detail.title = "No reverse lookup on " .. key
-			return
-		end
-		if Ach_Detail[ach] == nil then
-			detail.title = "No Achievement for " .. ach
-			print (detail.title)
-			return
-		end
-		detail.title = Ach_Detail[ach].description
-
-	end
-
+	dung.Craglorn[i].box.dat=Craglorn_Dat[i]
+	dung.Craglorn[i].box.mousemove_cb = box_mousemove_funct(self,l,c)
+
 	--set lines Heading
 	dung.Craglorn[i].box:setcell(0,0, L.Location)
 	--Set Line titles
@@ -1143,31 +1092,8 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)

 	dung.DLC.box = iup.matrix {numcol=#accounts[acc].playerIDs ,  numlin=#DLC2key, widthdef=100}

-	function dung.DLC.box:mousemove_cb(l, c)
-		if l == 0 or c == 0 then
-			detail.title = ""
-			return
-		end
-
-		local key = DLC_Dat.key[l]
-		if key == nil then
-			detail.title= "(DLC) Key is nil"
-			return
-		end
-
-		local ach = DLC_Dat.reverse_id[key]
-
-		if ach == nil then
-			detail.title = "(DLC) No reverse lookup on " .. key
-			return
-		end
-		if Ach_Detail[ach] == nil then
-			detail.title = "(DLC) No Achievement for " .. ach
-			print (detail.title)
-			return
-		end
-		detail.title = Ach_Detail[ach].description
-	end
+	dung.DLC.box.dat=DLC_Dat
+	dung.DLC.box.mousemove_cb = box_mousemove_funct(self,l,c)

 	--Set Line titles
 	for i, key in ipairs(DLC2key) do
@@ -1213,32 +1139,9 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)


 		dung.Trials.box = iup.matrix {numcol=0,  numlin=#trial2key, widthdef=100}
-
-		function dung.Trials.box:mousemove_cb(l, c)
-		if l == 0 or c == 0 then
-			detail.title = ""
-			return
-		end
-
-		local key = Trial_Dat.key[l]
-		if key == nil then
-			detail.title= "(Trials) Key is nil"
-			return
-		end
-
-		local ach = Trial_Dat.reverse_id[key]
-
-		if ach == nil then
-			detail.title = "(Trials) No reverse lookup on " .. key
-			return
-		end
-		if Ach_Detail[ach] == nil then
-			detail.title = "(Trial) No Achievement for " .. ach
-			print (detail.title)
-			return
-		end
-		detail.title = Ach_Detail[ach].description
-	end
+	dung.Trials.box.dat=Trial_Dat
+	dung.Trials.box.mousemove_cb = box_mousemove_funct(self,l,c)
+



diff --git a/data/utility.lua b/data/utility.lua
index dc6cb99..e2ae767 100644
--- a/data/utility.lua
+++ b/data/utility.lua
@@ -106,26 +106,25 @@ reverse_key = function (Adata)

 end

-box_mousemove_funct = 	function (self, l, c, datfile)
--- needs datfile to be set for the context
-
+box_mousemove_funct = 	function (self, l, c)
+-- we have previously added .dat to the box
 		if l == 0 or c == 0 then
 			detail.title = ""
 			return
 		end

-		if datfile == nil then
-			detail.title = "datfile is nil"
+		if self.dat == nil then
+			detail.title = "box.dat is nil"
 			return
 		end

-		local key = datfile.key[l]
+		local key = self.dat.key[l]
 		if key == nil then
 			detail.title= "key is nil"
 			return
 		end

-		local ach = datfile.reverse_id[key]
+		local ach = self.dat.reverse_id[key]

 		if ach == nil then
 			detail.title = "No reverse lookup on " .. key