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 5 days, 18 hours ago.

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

    human fly
    Participant
    • Topics: 117
    • Replies: 985
    • Total: 1102
    • ★★★★

    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 5 days, 18 hours 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 0 users and 23 guests online
No users are currently active
Forum Statistics
Threads: 2,099, Posts: 14,729, Members: 7,420
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!