Home Forums General Programming Patch Name to uiCDLabel

This topic contains 2 replies, has 2 voices, and was last updated by lfo2vco lfo2vco 4 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13065
    lfo2vco
    lfo2vco
    Participant

    Hi, I know this is a bit of an old chestnut and there is a resolved case over at:
    http://ctrlr.org/forums/topic/uilabel-to-displayedit-program-names/

    However I have been through the methods over there and still cannot get any of them to work in this instance. Atom very kindly showed me how to view my patch name in the console, grabbing it from an incoming Buffer Dump thus:

    nameData = midiMessage:getData():getRange(1,138)
    nameChar = nameData:getRange(7,23)
    console (nameChar:getRange(2,16):toString()) -- 2 null bytes

    I may have altered Atom’s method slightly, I cannot remember! Anyway the result comes back thus: LUA>> Low Strings

    I wish to get this result into a uiCDLabel called “Patch Label”… any help as always very appreciated.

    #13072
    atom
    atom
    Moderator

    it’s like any other component, just set it’s property, if your LCD Label is named “lcd” and you want to to display “myText”

    l = panel:getComponent("lcd")
    if l ~= nil then 
         l:setProperty ("uiLabelText", "myText", false) 
    end
    
    #13082
    lfo2vco
    lfo2vco
    Participant

    Thanks Atom, still found it a struggle but got there in the end with:

    nameData = midiMessage:getData():getRange(1,138)
    nameRange = nameData:getRange(7,23)
    nameLabel = panel:getComponent("Patch Label")
    
    console (nameRange:getRange(2,16):toString())
    
    if nameLabel ~= nil then 
        	nameLabel:setProperty ("uiLabelText", (nameRange:getRange(2,16):toString()), false)
    
    	end
    
    end

    What I didn’t realise was that I could put (nameRange:getRange(2,16):toString()) where you had “myText”. That’s down to my very limited knowledge of Lua and coding in general.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Comments are closed.