Attached is a short vid of an LED being manipulated by a DRO. The code to accomplish this is also provided here for anyone to use.
There is a bug in the LED wherein the LED will hide, but will not unhide. I have reported this in the bug thread and when it gets fixed, I can continue with the idea of having LED's appear and indicate the status of various operating conditions via size, color, location or other parameters.
The videos are intended as 'proof of concept' and not what an actual practical screen might look like. I do have in mind to have an LED similar to that shown in the vid to pop up and indicate an 'overspeed' or 'overpower' condition at a spindle. The video shows cycling thru all colors, but most likely in practice only green yellow and red might be used for the application described.
So we have covered both kinds of image buttons and LEDs and how to retrieve and set the parameters of all. That should get people started down the road to 'Purdy' Screens. I have deadlines coming up so this will be it for me for a while, but I'll stay subscribed and answer questions if I can. As is typical of this forum, there are lots of reads and very little participation. Please don't be afraid to post questions, or whatever you are working on. There is no such thing as a stupid question, so don't even worry about that.
I mentioned earlier in the thread that using exponents as color numbers could be an advantage and that is shown in the calculations in the code fragment.
-- Lua Code fragment for calculating LED color from dro Values
-- Mach4 Screen
-- © 2015 www.theCUBEstudio.com
-- NOTE: dro is named 'droRPM'
-- the dro gets its values from a slider that is not shown in the code
local CurrentRPMstring = scr.GetProperty('droRPM','Value'); -- grab the value in the RPM dro NOTE: is is a string
local CurrentRPM = tonumber(CurrentRPMstring); -- convert to number
-- convert slider value into an integer between 0 and 7 to use as color number
-- NOTE: color 'numbers' are exponents
-- dro values come from slider. Slider values are 0 to 2000 so for max of 7, divisor will be 2000/7 = 285
-- only the integer part of the number is required so find that using math.modf
local colorCalcVar = math.modf(CurrentRPM/285);
--*********************************** -- debugging stuff leave commented out *************************************
--wx.wxMessageBox (CurrentRPMstring)
--wx.wxMessageBox (tostring(CurrentRPM))
--wx.wxMessageBox (tostring(colorCalcVar))
-- mc.mcRegSetValue(RPMcmdRegHandle,RPMSliderValue); -- this sends data to modbus for use by the InTurn™ Controller
-- datat can be sent anywhere desired by adding the appropriate code here
--****************************************************************************************************************
if (CurrentRPM == 0)then -- if spindle is stopped, turn off LED
scr.SetProperty('ledBarRPM','Hidden','1');
else -- if Spindle is moving, turn on LED and set calculated color
scr.SetProperty('ledBarRPM','Hidden','0');
scr.SetProperty('ledBarRPM','Color',tostring(2^colorCalcVar)) -- note calculated color 'number' is the exponent
end