Home › Forums › General › Programming › typed name dialog?
Tagged: typed input
- This topic has 5 replies, 2 voices, and was last updated 6 years, 9 months ago by human fly.
-
AuthorPosts
-
June 29, 2017 at 5:58 pm #72422
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?)June 30, 2017 at 8:48 am #72425bump. 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?
June 30, 2017 at 9:18 am #72426b-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)June 30, 2017 at 10:13 am #72428so 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 return end -- //////////////////////////// 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)) end end
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)July 2, 2017 at 5:48 pm #72435Thanks 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)
buildString=function() -- 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) end
or
buildString=function() -- 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) end
Attachments:
You must be logged in to view attached files.July 2, 2017 at 8:56 pm #72439ahem…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 ! -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.