Forum Replies Created
-
AuthorPosts
-
i seem to be able to see them here.
i’ll have to try to build this with care separately; i’m having
trouble trying to do it within my current method, as it has
xxx menu entries at the moment. there is stuff there that is new
to me, takes a little while to process – but i get the gist of it.so i would need, somehow to make my popup refer to the same table
that is used for fetching the itemNames, rather than having it all
doubled up. you’re quick, manam i seeing that you did change that background colour, from your gif?
I hope there’s a way to get the menu item names – that would be easier than fetching from a table 🙂
Good luck for your project 🙂
Now the code should work…(this forum doesn’t work correctly if there is a letter “i” inside square brackets.)
that was quick – is that your popup with green text and black bg?
That’s just a text label.
For some reason, I can’t paste the correct code inside the “code tags”…
This line:
pMenu:addColouredItem(i, itemNames, Colour(0xff21c630), true, false, Image())
should be:
pMenu:addColouredItem(i, itemNames[ i ], Colour(0xff21c630), true, false, Image())edit: square brackets and letter “i” don’t work in this forum…
Here’s a gif:
Attachments:
You must be logged in to view attached files.EDIT: now this should work
I don’t know how to get a text from a menu item, but maybe this would work:
-- Create a table for menu item names itemNames = { "blablabla", "blablabla2", "blablabla3" } -- Create a popupMenu local pMenu = PopupMenu() -- Create menu items from the "itemNames" -table for itemIndex=1, #itemNames do pMenu:addColouredItem(itemIndex, itemNames[itemIndex], Colour(0xff21c630), true, false, Image()) end -- Show the menu local ret = pMenu:show(0,0,0,0) -- Return if nothing is selected if ret == 0 then return end -- Print the correct name from the "itemNames" -table -- Here you could send the name to a label console(itemNames[ret])
Maybe it is possible, but I don’t know how to use this info :)…
https://www.juce.com/doc/classPopupMenu#a0888091ddab0f599bb9d2fab28153f6bPublic Types
enum ColourIds {
backgroundColourId = 0x1000700, textColourId = 0x1000600, headerTextColourId = 0x1000601, highlightedBackgroundColourId = 0x1000900,
highlightedTextColourId = 0x1000800
}
A set of colour IDs to use to change the colour of various aspects of the menu. More…oh great, thanks ! one more thing resolved
will try that.
‘addColouredItem’ – for each entry? – where did you find that?
any indication that the popup background might be able to be
coloured? or (…) current selected item ? ;-Di’ve used ‘image()’ for some frames i would otherwise have in
an image strip, that works – can’t remember if i’ve tried to
have coloured ones, these are monochrome atm.I found it here
https://www.juce.com/doc/classPopupMenu#abca9890f63f22575c190c0115a1f3acfand here:
https://github.com/RomanKubiak/ctrlr/blob/master/Source/UIComponents/CtrlrMIDI/CtrlrMIDIMon.cpp#L108
I don’t know if it’s possible to change the bg-color…
This seem to work for menu item text color:
Tone_params:addColouredItem(1, "toneName1 00 00/VSTindex1", Colour(0xff21c630), true, false, Image())
Confirmed.
It seems to unfreeze when selecting the same color property again…it’s hard to explain, see the gif below 🙂Attachments:
You must be logged in to view attached files.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)
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. -
AuthorPosts