typed name dialog?

Home Forums General Programming typed name dialog?


This topic contains 5 replies, has 2 voices, and was last updated by  human fly 11 months, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #72422

    human fly
    • Topics: 123
    • Replies: 1036
    • Total: 1159
    • ★★★★

    maybe someone has a suggestion for a typed input
    Name dialog ? – this has to be limited to 10 characters,
    and each has a sysex parameter. so i would like to type
    in a name, and for that then to determine what the midi
    value is …er: oh, that’s going to be more complicated..
    matching input against the characters for a 32-127 range.
    (do i really have to use a combo for each character?)


    human fly
    • Topics: 123
    • Replies: 1036
    • Total: 1159
    • ★★★★

    bump. i have managed to ‘get’ characters into a table,
    (using method in ‘updatepatchname’ from a Carl Licroy panel)
    and can insert spaces where needed etc.

    i can rebuild these as numerical values (useful later for bulk
    dump/load), and i can just copy/get from one text label to another.

    i really would like typed input (limited to 10 characters) direct
    to the label text entry property. seems a more natural way of composing
    a preset title.

    can this be done?


    human fly
    • Topics: 123
    • Replies: 1036
    • Total: 1159
    • ★★★★

    b-b-b-b-BUMP 😉 SOLVED:
    the uiLabel modulator has parameters at the bottom of
    the page:’Editing..’ with everything i need, including
    max. number of characters.

    judging by overwhelming response to this issue, that
    was a big fat RTFM :p
    (worth a mention in the forthcoming *manual* revision)


    human fly
    • Topics: 123
    • Replies: 1036
    • Total: 1159
    • ★★★★

    so if that interests anyone, the lua that seems to
    work for that is:

    -- Called when a modulator value changes
    enterToneName = function(mod, value)
    	-- This variable stops index issues during panel bootup
    	if panel:getRestoreState() == true or panel:getProgramState() == true then
    	-- //////////////////////////// RETRIEVING PATCH NAME ///////////////////////////////
    	-- we take the text from the LCD_Text modulator and convert it to Lua type of string, that's why 
    	-- there is the L() macro, otherwise we'd get a String() instance, that might not work well with 
    	-- the native Lua library
    	NewPatchName = L(panel:getModulatorByName("label_ToneNameDisplay"):getComponent():getProperty("uiLabelText"))
    -- Store each character in variable --and convert it from ASCII to numerical code
    	character1 = string.byte(NewPatchName,1)
    	character2 = string.byte(NewPatchName,2)
    	character3 = string.byte(NewPatchName,3)
    	character4 = string.byte(NewPatchName,4)
    	character5 = string.byte(NewPatchName,5)
    	character6 = string.byte(NewPatchName,6)
    	character7 = string.byte(NewPatchName,7)
    	character8 = string.byte(NewPatchName,8)
    	character9 = string.byte(NewPatchName,9)
    	character10 = string.byte(NewPatchName,10)
    -- insert space for empty characters --or method crashes at nil value
    	if character1 == nil then character1 = "32" else character1 	= ""..character1 end
    	if character2 == nil then character2 = "32" else character2 	= ""..character2 end
    	if character3 == nil then character3 = "32" else character3 	= ""..character3 end
    	if character4 == nil then character4 = "32" else character4 	= ""..character4 end
    	if character5 == nil then character5 = "32" else character5 	= ""..character5 end
    	if character6 == nil then character6 = "32" else character6 	= ""..character6 end
    	if character7 == nil then character7 = "32" else character7 	= ""..character7 end
    	if character8 == nil then character8 = "32" else character8 	= ""..character8 end
    	if character9 == nil then character9 = "32" else character9 	= ""..character9 end
    	if character10 == nil then character10 = "32" else character10 = ""..character10 end
    	if value~=nil
    	then panel:getComponent("label_ToneNameDest"):setPropertyString("uiLabelText",(NewPatchName))

    i’ve got label’a’ and label ‘b’, and an ‘update’ button
    that sends the data across, onValueChange or onMouseDown,
    with character limit set to 10 in properties. it seems to
    interpret ascii, so ’32’ is the numerical value for ‘space’.

    i’m not sure how the ascii interpretation happens, please tell
    if you know 🙂 (or if you see ways of improving this)


    • Topics: 0
    • Replies: 11
    • Total: 11

    Thanks for pointing out that “L() macro” -thing!

    It’s possible to append a whitespace using “..” operator:
    newString = "string1" .. " " .. "string2"

    Here’s “buildString” -function from your panel (http://ctrlr.org/forums/topic/needing-combo-box-to-output-specfic-syses-strings/#post-72418)

    	-- This stops issues during panel bootup
    	if panel:getRestoreState() or panel:getProgramState() then return end
    	local byte1 =  L(panel:getComponent("prefix3") :getText())
    	local byte2 =  L(panel:getComponent("manufDevID") :getText())
    	local byte3 =  L(panel:getComponent("address") :getText())
    	local byte4 =  L(panel:getComponent("suffix3") :getText())
    	completeSyxExData = byte1 .. " ".. byte2 .. " " .. byte3 .. " " .. byte4
    	panel:getComponent("destText3"):setPropertyString("uiLabelText", completeSyxExData)


    	-- This stops issues during panel bootup
    	if panel:getRestoreState() or panel:getProgramState() then return end
    	completeSyxExData = 
    		L(panel:getComponent("prefix3") :getText()) 	.. " " ..
    		L(panel:getComponent("manufDevID"):getText()) 	.. " " ..
    	 	L(panel:getComponent("address") :getText()) 	.. " " ..
    		L(panel:getComponent("suffix3") :getText())
    	panel:getComponent("destText3"):setPropertyString("uiLabelText", completeSyxExData)
    You must be logged in to view attached files.

    human fly
    • Topics: 123
    • Replies: 1036
    • Total: 1159
    • ★★★★

    ahem…that macro thing was not me – i don’t actually know
    what a ‘macro’ IS ..i cribbed that from a Carl Licroy panel.
    (well, i think i know, but some further definition would be
    useful. not something i’ve looked into yet)

    so it’s for me to thank you for the little tutorial 🙂
    i usually need a little time to digest things – but i think
    i can see what’s going on there. thanks !

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

You must be logged in to reply to this topic.

There is currently 0 users and 16 guests online
No users are currently active
Forum Statistics
Threads: 2,130, Posts: 14,980, Members: 9,858
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!