Get “label” from popup submenu item

Home Forums General Programming Get “label” from popup submenu item

Tagged: , , ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #118956
    damien
    Participant
    • Topics: 14
    • Replies: 54
    • Total: 68

    Hi,

    I am working with popups for preset bank management
    I wonder how to get the name between brackets of a popup item.

    let’s say :

    UA1UnitRamReverbBank:addItem(00, "Small Room Verb", true, false, )

    I want to display “Vocal Plate 1” on a label with the function :

    UAPstItemName = XXXX -- The item name
    UAPstName = string.format("%s", UAPstItemName)
    panel:getLabel("lblPrstUA"):setText(UAPstName)

    I checked the Juce docs for popups but cannot figure out to get this :
    https://docs.juce.com/master/classPopupMenu.html
    https://docs.juce.com/master/structPopupMenu_1_1Item.html#details

    Thanks a lot for your help.

    Attachments:
    You must be logged in to view attached files.
    #118997
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 371
    • Total: 374
    • ★★
    if ret == 0 then -- the selected index of the popup
    		return
    	end
    	panel:getLabel("lblPrstUA"):setText(lookup[ret]))
    

    The way I do this in the ctrlr.org/c-plg150-an/ panel, which has many examples of this, is refer back to a lookup table of names.

    
    lookup={
    "Small room verb",
    "plate reverb",
    "large hall",
    ...
    }
    • This reply was modified 5 days, 6 hours ago by dnaldoogdnaldoog.
    #119027
    damien
    Participant
    • Topics: 14
    • Replies: 54
    • Total: 68

    Hi dnaldoog,

    I implemented a LUT like you suggested.
    It’s working well with a table like this.

    Thanks a lot! Have a good night

    Damien

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
There is currently 0 users and 28 guests online
No users are currently active
Forum Statistics
Threads: 2,393, Posts: 16,738, Members: 59,190
Most users ever online was 12 on January 22, 2019 3:47 pm
Do NOT follow this link or you will be banned from the site!