Click here to Skip to main content
15,908,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Traversing array Pin
Christian Graus15-May-02 23:20
protectorChristian Graus15-May-02 23:20 
GeneralRe: Traversing array Pin
Jon Hulatt15-May-02 23:21
Jon Hulatt15-May-02 23:21 
GeneralRe: Traversing array Pin
alex.barylski16-May-02 1:08
alex.barylski16-May-02 1:08 
GeneralRe: Traversing array Pin
Jon Hulatt16-May-02 2:52
Jon Hulatt16-May-02 2:52 
GeneralRe: Traversing array Pin
Christian Graus15-May-02 23:05
protectorChristian Graus15-May-02 23:05 
GeneralRe: Traversing array Pin
alex.barylski16-May-02 1:04
alex.barylski16-May-02 1:04 
GeneralRe: Traversing array Pin
Christian Graus16-May-02 1:05
protectorChristian Graus16-May-02 1:05 
GeneralRe: Traversing array Pin
alex.barylski16-May-02 13:14
alex.barylski16-May-02 13:14 
Christian Graus wrote:
OK - that changes things a LOT.

I was afraid of that.

Arrays are possible in JScript so are custom struct's sorta.

//Custom struct
function MENU_ITEM(Caption, Parent, CommandID)
{
  this.Caption   = Caption;
  this.Parent    = Parent;    //NULL for toplevel
  this.CommandID = CommandID; //NULL if child exists
  this.Child     = new Array();
}

// Add items to array

var MenuItems = new Array();

var nItems = MenuItems.length;

MenuItems[nItems] = new MENU_ITEM("File", null, null);
MenuItems[nItems].Child = new MENU_ITEM("MRU1", "File", 1000);
MenuItems[nItems+1].Child = new MENU_ITEM("MRU2", "File", 2000);
MenuItems[nItems+2].Child = new MENU_ITEM("MRU3", "File", 3000);


The above is what I am trying to accomplish and have almost got it...

a Menubar is created with only a File item and it has 3 children MRU list...how do I iterate the array above, considering children can have children and so on...

thats whats confusing the heck outta me...i'm so lost on how to set up the loop... Confused | :confused:

Would I use 2 nested for loops or a while loop...?

Can you suggest any other approach/structure to managing drop down menus...?

Thanx again! Smile | :)

"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
GeneralRe: Traversing array Pin
Christian Graus16-May-02 13:29
protectorChristian Graus16-May-02 13:29 
GeneralRe: Traversing array Pin
alex.barylski16-May-02 13:52
alex.barylski16-May-02 13:52 
QuestionHow to smooth drawing on the screen? Pin
davilism15-May-02 22:00
davilism15-May-02 22:00 
AnswerRe: How to smooth drawing on the screen? Pin
Alexandru Savescu15-May-02 22:15
Alexandru Savescu15-May-02 22:15 
AnswerRe: How to smooth drawing on the screen? Pin
Tomasz Sowinski16-May-02 2:30
Tomasz Sowinski16-May-02 2:30 
QuestionIDataObject GetData OOOOLD Win 3.1 Metafiles ?????????????? Pin
Braulio Dez15-May-02 22:05
Braulio Dez15-May-02 22:05 
QuestionWhy my program runs well in normal LAN while die in Wireless LAN? Pin
Cloudway15-May-02 21:54
Cloudway15-May-02 21:54 
AnswerRe: Why my program runs well in normal LAN while die in Wireless LAN? Pin
Joaquín M López Muñoz15-May-02 22:07
Joaquín M López Muñoz15-May-02 22:07 
GeneralRe: Why my program runs well in normal LAN while die in Wireless LAN? Pin
Rickard Andersson2015-May-02 22:56
Rickard Andersson2015-May-02 22:56 
GeneralRe: Why my program runs well in normal LAN while die in Wireless LAN? Pin
15-May-02 23:02
suss15-May-02 23:02 
GeneralRe: Why my program runs well in normal LAN while die in Wireless LAN? Pin
markkuk16-May-02 1:05
markkuk16-May-02 1:05 
AnswerRe: Why my program runs well in normal LAN while die in Wireless LAN? Pin
markkuk16-May-02 1:08
markkuk16-May-02 1:08 
GeneralWhich message Windows senв to control, when I press Alt key... Pin
Alex Cramer15-May-02 21:32
Alex Cramer15-May-02 21:32 
GeneralRe: Which message Windows senв to control, when I press Alt key... Pin
Christian Graus15-May-02 22:50
protectorChristian Graus15-May-02 22:50 
GeneralCStrin passing error! Pin
tongc15-May-02 19:06
tongc15-May-02 19:06 
GeneralRe: CStrin passing error! Pin
Christian Graus15-May-02 19:27
protectorChristian Graus15-May-02 19:27 
GeneralRe: CStrin passing error! Pin
Alexandru Savescu15-May-02 22:11
Alexandru Savescu15-May-02 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.