resizing multiple objects with Lua

Home Forums General Programming resizing multiple objects with Lua

This topic contains 0 replies, has 1 voice, and was last updated by  human fly 3 months, 1 week ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #83506

    human fly
    Participant
    • Topics: 123
    • Replies: 1050
    • Total: 1173
    • ★★★★

    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 3 months, 1 week ago by  human fly. Reason: correction
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There is currently 1 user and 13 guests online
Quimquim
Forum Statistics
Threads: 2,139, Posts: 15,095, Members: 10,956
Most users ever online was 5 on March 28, 2018 6:11 pm
Do NOT follow this link or you will be banned from the site!