COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 05-12-2015, 02:05 AM   #1
Jansku
Human being with feelings
 
Join Date: May 2013
Location: Oulu
Posts: 36
Default multilevel menu

Hi all (again)!

I'm trying to create a menu with icaption control so that it would list my files from my hdd.

Display (displays currently selected item name) and when click'd, you'll see the list below of files
- item 1 (in root folder)
- item 2 (in root folder)
-- submenu1 (subfolder)
- item 3 (in submenu1)
- item 4 (in submenu1)
-- submenu 2 (subfolder)
- item 5 (in submenu2)

Submenu items should be placed under submenu under the main menu

This is what i have:
Display (displays currently selected item name) and when click'd, you'll see the list below of files
- item 1 (in root)
- item 2 (in root)
- item 3 (in subfolder1)
- item 4 (in subfolder1)
- item 5 (in subfolder2)

This is my string:
Code:
GetParam(kDataSelectionListUpper)->InitEnum("Data Selection List 1", 0, (int)dataLibrarian->dataFiles.size());
    for(int i=0;i<dataLibrarian->dataFiles.size();i++){
        GetParam(kDataSelectionListUpper)->SetDisplayText(i, dataLibrarian->dataFiles[i]->name.c_str());
    }
    upperDataSelectionControl = (ICaptionControl*)((ControlAction*)GetParam(kDataSelectionListUpper)->getData())->controls[0];
Each of the items has identifiers for folder like the folder name where the file is located but I can't turn that identifier into a submenu/folder/directory for the main popup.
Usually this kind of structure is on apps where you have File -> Open Recent -> list of items pops up on mouse over.

Any help appreciated (I think there might be few others needing a menu like that as well) :-)
Jansku is offline   Reply With Quote
Old 05-12-2015, 05:08 AM   #2
Jansku
Human being with feelings
 
Join Date: May 2013
Location: Oulu
Posts: 36
Default

Oh man I just found about popup menu because I didn't realize it was just for this purpose! (feeling dumb).

Well now, how can I get my items to the list like I suggested?
Jansku is offline   Reply With Quote
Old 05-12-2015, 05:16 AM   #3
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 279
Default

The IPlug MultiTargets example contains a PopUp Menu with subfolders.
Take this as a start for the menu structure.
stw is offline   Reply With Quote
Old 05-12-2015, 05:18 AM   #4
Jansku
Human being with feelings
 
Join Date: May 2013
Location: Oulu
Posts: 36
Default

Quote:
Originally Posted by stw View Post
The IPlug MultiTargets example contains a PopUp Menu with subfolders.
Take this as a start for the menu structure.
Yeah sorted, the only issue is that the menu / list content is changing based on the content saved into the folder so that is where i'm stuck now. :P
Jansku is offline   Reply With Quote
Old 05-12-2015, 05:35 AM   #5
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 279
Default

Quote:
Originally Posted by Jansku View Post
Yeah sorted, the only issue is that the menu / list content is changing based on the content saved into the folder so that is where i'm stuck now. :P
I do something similar for a preset menu in my actual plugin. But this is limited to only one subfolder and thus not a completely dynamic solution. So i guess it doesn't fit your needs.
Basically i scan the folders and its items, names and filetypes, write them into an array and create my main and submenus with that.
stw is offline   Reply With Quote
Old 05-12-2015, 05:45 AM   #6
Jansku
Human being with feelings
 
Join Date: May 2013
Location: Oulu
Posts: 36
Default

Quote:
Originally Posted by stw View Post
I do something similar for a preset menu in my actual plugin. But this is limited to only one subfolder and thus not a completely dynamic solution. So i guess it doesn't fit your needs.
Basically i scan the folders and its items, names and filetypes, write them into an array and create my main and submenus with that.
That is exactly what I'm doing as well :-) I have a single number for each subfolder so is not possible to use that id with:
Code:
for(int i=0;i<dataLibrarian->folders.size();i++){
        mSubMenu.AddItem("fetch bank name here");
        mSubMenu.AddItem("fetch bank name here");
        mSubMenu.AddItem("fetch bank name here");
        mMainMenu.AddItem("folder name here", &mSubMenu);
    }
? I'm not sure if you can use some sort of [i] identifier for mSubMenu. Just a thought.
Jansku is offline   Reply With Quote
Old 05-12-2015, 06:13 AM   #7
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 279
Default

Quote:
Originally Posted by Jansku View Post
That is exactly what I'm doing as well :-) I have a single number for each subfolder so is not possible to use that id with:
Code:
for(int i=0;i<dataLibrarian->folders.size();i++){
        mSubMenu.AddItem("fetch bank name here");
        mSubMenu.AddItem("fetch bank name here");
        mSubMenu.AddItem("fetch bank name here");
        mMainMenu.AddItem("folder name here", &mSubMenu);
    }
? I'm not sure if you can use some sort of [i] identifier for mSubMenu. Just a thought.
Just an example how i do it. (Beware i'm a noob with these kind of things but maybe it helps ;-) )

Code:
static const int SMENUS = 128;

// in the constructor i create my subMenu members and set the items to 0 //

	{
		subMenus = new(IPopupMenu[SMENUS]);
		lastMenu = &menu;
		for ( int i = 0; i <= SMENUS; i++ ){
			subItems[i] = 0;
		}
	}	

//naming of the submenus //

void createSubNames (const char* name, int sMenuNr){ menu.AddItem(name, &subMenus[sMenuNr]);}

// creating submenu items //

void createSubItem(const char* name, int sMenuNr){
		subMenus[sMenuNr].AddItem(name);
		subItems[sMenuNr] ++;
	}
stw is offline   Reply With Quote
Old 05-12-2015, 06:25 AM   #8
Jansku
Human being with feelings
 
Join Date: May 2013
Location: Oulu
Posts: 36
Default

Quote:
Originally Posted by stw View Post
Just an example how i do it. (Beware i'm a noob with these kind of things but maybe it helps ;-) )
I'll have to carry on tomorrow. off to home!
Jansku is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:07 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.