resizing multiple objects with Lua

Home Forums General Programming resizing multiple objects with Lua

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #83506
    human fly
    Participant
    • Topics: 124
    • Replies: 1070
    • Total: 1194
    • ★★★★

    quick share of a little trick discovered this morning
    to save work resizing 96 objects 🙂

    mods called “kb”..(1-96), want to resize them all.
    some are white keys(longer), some are black keys(shorter).
    -want to change white height from 64 to 48, and black 54 to 38.

    function tempheight()
    
    	for i=1,96 do 
    	local kybd = panel:getComponent("kb"..i)
    	local ksize=tostring(kybd:getProperty("componentRectangle")) 
    	local strgprefx = string.sub(ksize,1,-3)
    	local height=tonumber(string.sub(ksize,-2))
    
    		if height		==64 then 
    		kybd:setProperty("componentRectangle",(strgprefx.."48"),false)
    		elseif height	==54 then 
    		kybd:setProperty("componentRectangle",(strgprefx.."38"),false)
    		end
    	end
    end
    • This topic was modified 4 years, 1 month ago by human fly. Reason: correction
Viewing 1 post (of 1 total)
  • The forum ‘Programming’ is closed to new topics and replies.
There is currently 0 users and 30 guests online
No users are currently active
Forum Statistics
Threads: 2,495, Posts: 17,374, Members: 77,605
Most users ever online was 12 on January 22, 2019 3:47 pm
Ctrlr