View Single Post
Old 07-29-2017, 05:21 PM   #40
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
You can do that easily yourself by rewriting the appropriate method for whichever element you want. i.e:

Code:
--Load all the classes

GUI.New("mnu_mymenu", "Menubox", ...whatever the Menubox params are...)

function GUI.elms.mnu_mymenu:onmouseup()

  -- Run the existing code for the menu
  -- This could be after your extra code instead if you want
  GUI.Menubox.onmouseup(self)






  DoMyStuff(self.retval)

end
Or, if you need to do that with multiple elements, you can easily create a new class based on Menubox and rewrite the method for that:

Code:
-- Load all your libraries

GUI.MyMenuBox = GUI.Menubox

function GUI.MyMenuBox:onmouseup()

  -- As above

end
See the example scripts for an, er, example of this in action. The code/formatting above might not be correct.

Thanks for your last edit, i will go to that part next
some days ago i had to use this:
Code:
function GUI.elms.menu1:onmouseup()
(...)
   GUI.Menubox.onmouseup(self)
end
and it worked.


but now i had the need to use this, to make the onmouse work for many elements:
Code:
function GUI.MyMenuBox:onmouseup()
    GUI.Menubox.onmouseup(self)
end
and i have an error: "stack overflow" on the console. I still didnt find how to solve! would be nice!


Edit: meanwhile i changed function GUI.Checklistnmouseup()and seems better now
Code:
local mouseopt = self.dir == "h" 	and (GUI.mouse.x - (self.x + 0.5*self.chk_w))
	 or	(GUI.mouse.y - (self.y + self.cap_h  ))
altho i don't like much that between checkboxes that space is always "clickable". . In this case for the checkbox before.But it is what it is ! it's great anyway.thank you

Last edited by deeb; 07-29-2017 at 08:13 PM.
deeb is offline   Reply With Quote