getComponentUnderMouse inside a loop inside a TimerCallback
-
I have a script that shows a combobox when hovering over a slider.
It uses 'Content.getComponentUnderMouse()', and It works great for a single slider / combobox.However, trying to scale this to be used with multiple sliders and comboboxes, I can't get the mouse hovering to register for any component inside the loop.
So, something like this works:
checkMousePositionTimer.setTimerCallback(function() { var hoveredComponent = Content.getComponentUnderMouse(); Console.print("Hovered component: " + hoveredComponent); });
But, this does not:
checkMousePositionTimer.setTimerCallback(function() { var hoveredComponent = Content.getComponentUnderMouse(); for (var j = 0; j < 2; j++) { // Only loop over the first two components for testing if (hoveredComponent == AllPanners[j] || hoveredComponent == PanModeComboboxes[j]) { Console.print("hoveredComponent: " + hoveredComponent + ", AllPanners[j]: " + AllPanners[j]); } } });
I verified that all my components are there, arrays are correct etc. Mouse-hovering is not registering on any component within a loop.
How do I get around this?
-
@gorangrooves said in getComponentUnderMouse inside a loop inside a TimerCallback:
How do I get around this?
Use a broadcaster
-
Enjoy
HiseSnippet 940.3ocsVEsaSjCE0SZGzlvBZQZ+.rlGPoRciRZyBqVzpMMooPzRKQjtnUBPHGONIlNi8HaOEhPHwC7Qvi7Ixe.bsmIYltDUZBh7Pju9dOGe7ct9ZOTIoLsVpPdUOcdBC48y9ilKLy5MivEnAGh7to+wDsgovYS0cdBQqYgHOustucBupaib+9ze2kDQDTVwTHzSjbJ6g7XtoX1gc9GdTzQjP1o73RQ2ty.pTzSFISA8rkeSTBgdFYJ6DhMrJ9Huq0OjajpQFhgogX5JCmOZl7Uhr3eBWyGGwrFsPi.hxlF0aFOJb3h8pFg71dXwNeqrc9u5eLOjub9hLvu3bfKPTNG3U4xjTq0PRdkjz1YR5V9inJdhoviUOW2ef.9fLg.o5xRIKVTk6VwumDhPXZDSNicjBLVhn9cZ1bWL72N2qVMHcqM3woFCL.+W3EvlxLGDE0SFmHEfstdPWWLO6YgAkvQAH8ES4BVCphA6+tJIIj5JWp+l.dXvehCr4Bf33wxwxWyzA6hCHpoZv0SoKVfcwxwu74u0R8XZChwPnyNUtb8OVlpY8O2ojbwBrzKhSOSiuM9AxyYJKuAKHHL7gbPDBPFAwVvGPMbovFiiKLwYiMRr1JOpUdXm9vvzyxIbRpvEW8RBkYkwN0dSsp7I35NqFt32oV0pP9SKiXMRTbgo.kMeNHr9Nf7f83BVgU5Dog8HQcGc0daM7+20jIqzm8yjRFEAauU41dpRcY.qKRiGyT6hOmDkxVFHT1cwZ4qc0pkoYUMkBTJFH3lGkvxsORFEZqQsi+5JeTdYm8XYtBgPMtS.2L+DPV8GhCjT0OynExI+xcaPqA7899fu+2G71q.9+N3PhgX6DjmPfjTBSY31uEdGxNGZkl0Wnp+gL8YFYhKikWkAiuB4rWWrjC5Luv3jNn0ho8JyT6RL8tIqIS6aYx268dHzb6fOjkJWCFZWRKeLojVRzcPecWUnetLLMhXtXSd6sY4NfSKWnyps6oPyMyKea2Zz4u4k14+pJwa4OjanyVsFqrBMBkR+HzX98k2vu+jILpoPfa6ez+soWN9MV9GKSMbwziIFE2VtbRZ7H3YBTFr5BAKRaqbpXKbxraZssYfQLQny3yvubmsr1d4NasvIJlPUxWPyNDauQ9mby.ZR3d.RU3kPfMdYiGe+lMZhhgGG7BJ0t8+Mn81pwr2FfY+M.S6M.yuuAXtyFf4ta.l+3RwXeW1AoFYb1wAXhg8c8P875KHPkkqJD8E.4Jf8x.
-
@d-healey Thank you so much! I am going to check it out right now
-
@d-healey said in getComponentUnderMouse inside a loop inside a TimerCallback:
HiseSnippet 940.3ocsVEsaSjCE0SZGzlvBZQZ+.rlGPoRciRZyBqVzpMMooPzRKQjtnUBPHGONIlNi8HaOEhPHwC7Qvi7Ixe.bsmIYltDUZBh7Pju9dOGe7ct9ZOTIoLsVpPdUOcdBC48y9ilKLy5MivEnAGh7to+wDsgovYS0cdBQqYgHOustucBupaib+9ze2kDQDTVwTHzSjbJ6g7XtoX1gc9GdTzQjP1o73RQ2ty.pTzSFISA8rkeSTBgdFYJ6DhMrJ9Huq0OjajpQFhgogX5JCmOZl7Uhr3eBWyGGwrFsPi.hxlF0aFOJb3h8pFg71dXwNeqrc9u5eLOjub9hLvu3bfKPTNG3U4xjTq0PRdkjz1YR5V9inJdhoviUOW2ef.9fLg.o5xRIKVTk6VwumDhPXZDSNicjBLVhn9cZ1bWL72N2qVMHcqM3woFCL.+W3EvlxLGDE0SFmHEfstdPWWLO6YgAkvQAH8ES4BVCphA6+tJIIj5JWp+l.dXvehCr4Bf33wxwxWyzA6hCHpoZv0SoKVfcwxwu74u0R8XZChwPnyNUtb8OVlpY8O2ojbwBrzKhSOSiuM9AxyYJKuAKHHL7gbPDBPFAwVvGPMbovFiiKLwYiMRr1JOpUdXm9vvzyxIbRpvEW8RBkYkwN0dSsp7I35NqFt32oV0pP9SKiXMRTbgo.kMeNHr9Nf7f83BVgU5Dog8HQcGc0daM7+20jIqzm8yjRFEAauU41dpRcY.qKRiGyT6hOmDkxVFHT1cwZ4qc0pkoYUMkBTJFH3lGkvxsORFEZqQsi+5JeTdYm8XYtBgPMtS.2L+DPV8GhCjT0OynExI+xcaPqA7899fu+2G71q.9+N3PhgX6DjmPfjTBSY31uEdGxNGZkl0Wnp+gL8YFYhKikWkAiuB4rWWrjC5Luv3jNn0ho8JyT6RL8tIqIS6aYx268dHzb6fOjkJWCFZWRKeLojVRzcPecWUnetLLMhXtXSd6sY4NfSKWnyps6oPyMyKea2Zz4u4k14+pJwa4OjanyVsFqrBMBkR+HzX98k2vu+jILpoPfa6ez+soWN9MV9GKSMbwziIFE2VtbRZ7H3YBTFr5BAKRaqbpXKbxraZssYfQLQny3yvubmsr1d4NasvIJlPUxWPyNDauQ9mby.ZR3d.RU3kPfMdYiGe+lMZhhgGG7BJ0t8+Mn81pwr2FfY+M.S6M.yuuAXtyFf4ta.l+3RwXeW1AoFYb1wAXhg8c8P875KHPkkqJD8E.4Jf8x.
interesting - because this doesn't honour the hover only - it console prints on mouse down and mouse up as well....I guess becausehover is still true....
-
@Lindon
its actually a bit ugly trying to get the hover ONLYHiseSnippet 990.3ocsV8ta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MywZafiPI0mBNVbE8W5OX5TF0TRvc8O6W+zbeL5WjYFtX14DihCG19WjkLFdkBkAqtPvhsSp7pY6EykaYksYfwLQjS3eguBissxdEFauzHJgPUxWRyalsOB3dNM.mDt2+D.ODCjwqF.462pYKTB7djWRo1s+2.i41LlC2BLGsEX5rEX91s.yC2BLe2Vf46euXrOE7jLiLIuc.TLZfaVpm2.AAprbUgn+CBwzwS
-
@Lindon Ah good catch! A slightly less ugly implementation might be:
bc.addListener("mouseAction", "Mouse action to show combo boxes on hover", function(component, event) { if (event.clicked || event.mouseUp || event.rightClick || event.doubleClick) return; if (event.hover) Console.print(component.getId()); });
-
@d-healey yeah I sorta tried that but it was failing to catch the dbl click for some reason - it started to work as soon as I separated it out on it own tho...
-
@Lindon @d-healey Alright, guys.
With my assistance, my blind but brilliant coding partner (chatGPT) put together this script which displays the comboboxes when hovering over the buttons. The comboboxes are visible as long as you hover over either a button or its relevant combobox, then disappear after 1 second of moving away.
HiseSnippet 1489.3ocwX80aaaCDWJIZn1atnEXe.37CExnot1IYcCMKqIwIYMX0sAyoEanHnfhh1hNxhFTzo0qHutOB6s859LsOF8g891QRIKIGm+4lhpfjHd7tS+3c+NxS5.AmPii4BK6RGNdH0x9qb5LNRFzJ.yhr1eGK6a6zFGKoBjQz1iGhiio9V11K9SJA1kVxRe8gmrMNDGQnYhrrdEmQnOiMfIyjdvl+LKLbOrO8P1fbZu1l6S3Qs3g7Q.dVzog0PL4XbO5ywJ0Vvwx9K10mI4hNRrjFaYuz1b+wcB3uMxn+qXwLuPpZPSqNfiLh2iG5qPrRpUq.Vn+Aoq6XKvKGjEEVzDE9Zm1Le1D4YQi6nm.kYQ93g8BEg2hEfWy7vqQN3MCHYmCRKYfzcc5PDrgxrYT34Kc1OBRNcwPXOOTL5ZsveTxoEGzHRVe.9X5dBXvDKbeTiFKif+Ta8x5rdceZWpnENLzCh7wtRwHJLW4G9Pz9QLICGx9cZkxfGi4gz5jPJV3Va8JkqTFxbwRzIXAxajT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3w1ysGVy3g+477vstVbrhQj+Dt4sLeYPVp421Lfx5EHyKY.dhYmjtag8hyKHRBp+8mUPjjWZa+4DDIo1+8lADm8E2uiSat+nPrr32QP8wSRl.NAovKuqdA8nXlbb9Z0arOtvUEh204.ljDLaLtvLvHrMxmBLl7IYp3ra2tPWaY.bIm890OMe+EqegORxh50FKELUZ94iFzgORPnvSOJBdyAUpeA0V.lwMRoBcnQ95A+GbkLYS0X6jIalNo0.LQveCwrUt5i9bKsD.SQ5u2UIm1pwnIGI43zndCqALe1aHD0x+Avw+y1lUlCaVcNrYs4vlucNr4QygMe2bXy2eg1n9zeaMRxGXJG.AGrq97Sa6civ.yRyBs9ekbJ4EC
I think this could be a highly practical script for a number of situations where you want to keep visual things neat and tidy.