| Blockland Forums > Modification Help |
| Left Mouse Button for GUI ".accelerator" |
| << < (2/2) |
| Ephialtes:
Well I use them all over RTB so you're doing something wrong. |
| M:
You can use GuiMouseEventCtrl::onMouseDown(%this), but ObjectName::onMouseDown(%this) doesn't work at all ie, they don't seem to inherit properly at all. --- Code: ---function GuiMouseEventCtrl::onMouse*(%this,%what,%ever,%else) { if(%this.getName() !$= "") { if(isFunction(%this.getName(),"onMouse*")) { eval(%this @ ".onMouse*(" @ %this @ "," @ %what @ "," @ %ever @ "," @ %else @ ");"); } } } --- End code --- Copy-paste for each action (* being Down, Up, Enter, Leave, four copies) I'm using that and it works fine (even though I'm only using %this and no other arguments) |
| Space Guy:
Package it otherwise you'll break every other mod that uses the same methods. |
| Bauklotz:
Well, I got this working and 'HI' was echoed to console. --- Code: ---package onMouse { function GuiMouseEventCtrl::onMouseDown(%this,%mod,%pos,%click) { if(%this.getName() $= "some_name_here") echo(HI); else Parent::onMouseDown(%this,%mod,%pos,%click); } }; activatePackage(onMouse); --- End code --- But the problem is, clicking a not-on-top GuiMouseEventCtrl doesn't have any effect, and what I want to do is that I am making a new GuiBitmapCtrl that follows the mouse when I press a key, and the GuiMouseEventCtrl is re-made on top and follows too, but "HI" is not printed to console when clicking. |
| Navigation |
| Message Index |
| Previous page |