Naming clips in edit

Hi!

first of all thanks you for the great forum and software I love it so much!

where the problem is: :slight_smile:
I would like to enable users to name the clips they recorded (my code is based on the MidiRecordingDemo). (I am quite a newbie)
As a user I would like to right click on the clip an rename it

Thank you very much

Naming a clip is simple, just call clip->setName(...). Check out the ClipComponent class (part of the MidiRecordingDemo), it has a reference to its clip as a class member.

The mouseDown handler is probably a good place to start, something like this perhaps:

void ClipComponent::mouseDown (const MouseEvent& event)
{
    editViewState.selectionManager.selectOnly (clip.get());
    if (event.mods.isPopupMenu()) {  // or possibly isRightButtonDown()
        juce::String newName = "Test";
        clip->setName(newName);
    }
}

Obviously you will want to ask the user for a name, for that you can construct a juce::AlertWindow and use addTextEditor().

1 Like

thank you so much! I will give it a try! amazing!

Dear Erik,
thanks again for your help.
It works and I learned a lot on the way. Now it is clean up time though :wink: my code so far is a mess.

all the best from hamburg

1 Like

Wonderful! :joy: