Thread: Creating a Tree Menu with Switches and Arrays

  1. #1
    Registered User
    Join Date
    Jul 2017
    Posts
    1

    Creating a Tree Menu with Switches and Arrays

    As the title says, i'm trying to create a tree menu with switches and arrays. Here is my current problem. Essentially when I pick Case 1 on the LCD Menu, it brings me to Case 1, but if I pick Case 2, it also brings me to Case 1. Can someone maybe point the problem? I cannot share the whole code due to confidentially reasons...only this.

    Thanks

    Code:
    void Navigate()
    {
      char MenuArray[4];
      
      if (channel != lastChannel && valueEditing == false)
      { //updates the cursor position if button counter changed and 'value editing mode' is not running
        ScrollCursor();
      }
    
    
      if(enterPressed == true)
      {
        switch(MenuArray[1])
          {
          case 1: 
            Menu1();
          break;
    
    
          case 2: 
            Menu2();
          break;
    
    
          case 3:
            Menu3();
          break;
           
          case 4: //Go to error diagnostic (4.1.0.0)
            Menu4();
          break;
            
          default:
    
    
          break;
         
          }
      }
    
    
    }

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Is "MenuArray[1]" what you should be switching though? What does this array contain? It seems to me it contains nothing because you don't set its values anywhere.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating A Menu
    By Devon Smith in forum C Programming
    Replies: 3
    Last Post: 03-31-2013, 02:37 AM
  2. Creating a C menu using Up Down
    By RockLee in forum C Programming
    Replies: 7
    Last Post: 03-15-2011, 06:02 PM
  3. creating menu
    By spikestar in forum C Programming
    Replies: 3
    Last Post: 09-19-2009, 11:16 PM
  4. Arrays and Switches
    By CodeGeek20 in forum C Programming
    Replies: 4
    Last Post: 04-22-2008, 07:34 PM
  5. Do switches and arrays mix?
    By crag2804 in forum C Programming
    Replies: 1
    Last Post: 10-27-2002, 04:05 PM

Tags for this Thread