Home › Forums › General › Programming › String problem
- This topic has 15 replies, 3 voices, and was last updated 9 years, 11 months ago by atom.
-
AuthorPosts
-
May 24, 2014 at 7:13 pm #23849
What’s wrong here?
-- Called when a modulator value changes -- @mod http://ctrlr.org/api/class_ctrlr_modulator.html -- @value new numeric value of the modulator -- label = function(mod, value) updlbl = panel:getComponent("TrigSel") lb1 = panel:getComponent("01SoundLabel"):getComponentText() lb2 = panel:getComponent("02SoundLabel"):getComponentText() lb3 = panel:getComponent("03SoundLabel"):getComponentText() lb4 = panel:getComponent("04SoundLabel"):getComponentText() --updlbl:setProperty("uiListBoxContent",string.format("%s \n %s \n %s \n %s",lb1,lb2,lb3,lb4),false) -- string expected , got user data panel:getComponent("modulator-5"):setText(lb1) panel:getComponent("modulator-7"):setText(lb2) panel:getComponent("modulator-8"):setText(lb3) panel:getComponent("modulator-9"):setText(lb4) -- the components texts are displayed correctly in four texts end
it seems setText get lb1 as text format with “” or convert user data in string .that’s working but string.format get it as user data I don’t know
why. I tried to quote lb1 with string.format and %q ,tried string.sub too.
I search on google but no successThis is a listbox that get current rows selected of four other listboxes
I would try to do.the script is applied to the four mods.any idea ??
May 24, 2014 at 8:12 pm #23850–updlbl:setProperty(“uiListBoxContent”,string.format(“%s \n %s \n %s \n %s”,lb1,lb2,lb3,lb4),false)
Try this (not tested)
updlbl:setPropertyString(“uiListBoxContent”,string.format(“%s \n %s \n %s \n %s”,lb1,lb2,lb3,lb4),false)
May 24, 2014 at 10:08 pm #23857I ve already tried
Could i try different way to “mix” these strings or not and put them in
the listbox ?May 25, 2014 at 12:57 am #23867the console returns string however
Attachments:
You must be logged in to view attached files.May 25, 2014 at 10:02 am #23874Remove “false” at the end.
This line is working for me
list1:getComponent():setPropertyString("uiListBoxContent", string.format("%s%s%s",text12,"\n",text11))
- This reply was modified 9 years, 11 months ago by dasfaker.
May 25, 2014 at 12:04 pm #23877Yes I did removed the bool
not tried to format the separators… done
but there is still the bad argument #2may be the result is in char index and setText converts it to string
while PropertyString not… strange
or the result lacks “” and setText add itupdlbl:setPropertyString(“uiListBoxContent”,lb1)
WORKING
updlbl:setProperty(“uiListBoxContent”,lb1,false)
NOT WORKINGbut the mix isn’t working
updlbl:setPropertyString(“uiListBoxContent”,string.format(“%s%s%s%s%s%s%s”,lb1,”\n”,lb2,”\n”,lb3,”\n”,lb4))
tried this :
updlbl:getSelectedRow(1):setPropertyString(“uiListBoxContent”,lb1)
updlbl:getSelectedRow(2):setPropertyString(“uiListBoxContent”,lb2)attempt to index a number value…
selectRow() ??May 25, 2014 at 1:39 pm #23878even if I do :
updlbl = panel:getComponent("TrigSel") lb1 = panel:getComponent("01SoundLabel"):getComponentText() panel:getComponent("modulator-5"):setText(lb1) console(lb1) lb2 = panel:getComponent("02SoundLabel"):getComponentText() panel:getComponent("modulator-7"):setText(lb2) console(lb2) lb3 = panel:getComponent("03SoundLabel"):getComponentText() panel:getComponent("modulator-8"):setText(lb3) console(lb3) lb4 = panel:getComponent("04SoundLabel"):getComponentText() panel:getComponent("modulator-9"):setText(lb4) console(lb4) z1 = panel:getComponent("modulator-5"):getText() z2 = panel:getComponent("modulator-7"):getText() z3 = panel:getComponent("modulator-8"):getText() z4 = panel:getComponent("modulator-9"):getText() updlbl:setPropertyString("uiListBoxContent",string.format("%s%s%s%s%s%s%s",z1,"\n",z2,"\n",z3,"\n",z4))
Same problem. LUA issue ?
May 25, 2014 at 1:46 pm #23879Could there be some duplicated name? Some variable with the same name as some modulator or some data?
May 25, 2014 at 2:52 pm #23886no
A new panel checked the modulator list names ,vst indexes …updlbl = panel:getComponent("TrigSel") lb1 = panel:getComponent("01SoundLabel"):getComponentText() panel:getComponent("modulator-5"):setText(lb1) console(lb1) lb2 = panel:getComponent("02SoundLabel"):getComponentText() panel:getComponent("modulator-7"):setText(lb2) console(lb2) lb3 = panel:getComponent("03SoundLabel"):getComponentText() panel:getComponent("modulator-8"):setText(lb3) console(lb3) lb4 = panel:getComponent("04SoundLabel"):getComponentText() panel:getComponent("modulator-9"):setText(lb4) console(lb4) z1 = panel:getComponent("modulator-5"):getText() --w1 = string.format("%q",z1) z2 = panel:getComponent("modulator-7"):getText() --w2 = string.format("%q",z2) z3 = panel:getComponent("modulator-8"):getText() --w3 = string.format("%q",z3) z4 = panel:getComponent("modulator-9"):getText() --w4 = string.format("%q",z4) --string.gsub(panel:getComponent("modulator-5"):getText(), "(%w+)", print) tried to print :) lbl = string.gsub("z1,z2,z3,z4",",","\n") i = "\n" --lbl = string.format("%q%s%q%s%q%s%q",lb1,i,lb2,i,lb3,i,lb4) no updlbl:setPropertyString("uiListBoxContent",string.format("%s",lbl)) -- i get row 1:z1 row2:z2 etc.. texts :( but it's a start . how to convert a function to string ? -- string.format ?? :D --updlbl:setPropertyString("uiListBoxContent",lb1)
nothing to do ..
May 25, 2014 at 5:04 pm #23899here is the panel
If someone wants to lookAttachments:
You must be logged in to view attached files.May 25, 2014 at 10:27 pm #23915The problem here is that the listBox content is user data, and not a string. Can’t find a way to extract a string from there.
The best solution I see is, as you know the content of the listBoxes, create a list with the content of the listBoxes (list = {“BassDrum 1″,”BassDrum 2″,”Bass”,
“Bass Saw”…}) and as you can get the row selected on the list box, pass this value to the list, this way you get a string.May 25, 2014 at 10:50 pm #23916Thank you Dasfaker
You’re right it’s damage to add a table while I keep especialy 24 litbox contents for easy use
I planned to add a tab with the 24 + 1 listboxes
I double click on the soundselect listbox goes to selected sound label tab. I click on a label the tab goes to the soundselect listbox
if I don’t click until 10 sec it returns to soundselect listboxwell I plan to get label listboxes component text ,transforms them as a table ,get label boxes values and string.format with tables that’s sure method
At least I’ll write a table
Thank you again DasfakerMay 26, 2014 at 12:02 am #23918I get it !
label = function(mod, value) updlbl = panel:getComponent("TrigSel") lb1 = panel:getComponent("01SoundLabel"):getComponentText() panel:getComponent("modulator-5"):setText(lb1) lb2 = panel:getComponent("02SoundLabel"):getComponentText() panel:getComponent("modulator-7"):setText(lb2) lb3 = panel:getComponent("03SoundLabel"):getComponentText() panel:getComponent("modulator-8"):setText(lb3) lb4 = panel:getComponent("04SoundLabel"):getComponentText() panel:getComponent("modulator-9"):setText(lb4) z1 = panel:getComponent("modulator-5"):getProperty("uiLabelText") z2 = panel:getComponent("modulator-7"):getProperty("uiLabelText") z3 = panel:getComponent("modulator-8"):getProperty("uiLabelText") z4 = panel:getComponent("modulator-9"):getProperty("uiLabelText") i = "\n" lbl = string.format("01: %s%s02: %s%s03: %s%s04: %s",z1,i,z2,i,z3,i,z4) updlbl:setPropertyString("uiListBoxContent",string.format("%s",lbl))
I need to check inside the label cpp if I see magic formula inside
“Called when the contents of a Label are changed” or in the component
Atom ?May 26, 2014 at 10:47 am #23951What would you like to know ? I don’t think i got the question.
May 26, 2014 at 3:04 pm #23952Hi Atom
I would like to know how I could replace texts used to get the component text and to send to string.format formula ?
getComponentText -> label:setText = string
getComponentText -> string.format or whatever string.* = userdata
label:getProperty(“uiLabelText”) -> string.format = string
possible to convert ?May 26, 2014 at 3:07 pm #23953I still don’t get it, you want to replace “texts” used to get “component text” and send to string.format formula >
I really don’t know what do you mean…
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.