It requires Vadi's 'CSSMAN' script, but aside from that it should run standalone.
Neither part of the gauge is clickable, with nothing printed to the main window, and nothing showing in the debug window to indicate that anything has happened at all.
Does anyone have any ideas?
I have a vague workaround idea if it is not possible to make gauges clickable, of putting each gauge inside a label the same size as the gauge, and then putting another label inside that label, transparent and hopefully on top of the gauge, then making that transparent label clickable. But that will mean I end up with a very convoluted parent>child structure (as the gauges will be in a hbox, which will be in a label, in turn in a container...
I understand gauges to be comprised of two labels, so it should be possible to make them clickable.
Code: Select all
GUI.GaugeBackCSS = CSSMan.new([[
background-color: rgba(0,0,0,0);
border-style: solid;
border-color: white;
border-width: 1px;
border-radius: 5px;
margin: 5px;
qproperty-alignment: 'AlignCenter | AlignTop';
]])
GUI.GaugeFrontCSS = CSSMan.new([[
background-color: rgba(0,0,0,0);
border-style: solid;
border-color: white;
border-width: 1px;
border-radius: 5px;
margin: 5px;
qproperty-alignment: 'AlignCenter | AlignBottom';
]])
-------------------------------
function gauge_pressed(sys)
print(sys .. ' pressed')
end
-------------------------------
GaugeTest = Geyser.Gauge:new({
name = "GaugeTest",
x = 700, y=300,
width = 80, height = 400,
orientation='vertical',
})
GaugeTest.back:setStyleSheet(GUI.GaugeBackCSS:getCSS())
GUI.GaugeFrontCSS:set("background-color","red")
GaugeTest.front:setStyleSheet(GUI.GaugeFrontCSS:getCSS())
GaugeTest:setValue(math.random(100),100)
GaugeTest.back:echo("Gauge test")
-------------------------------
GaugeTest.front:setClickCallback('gauge_pressed', 'Gauge test')
GaugeTest.back:setClickCallback('gauge_pressed', 'Gauge test')