Pages: [1]   Go Down
Author Topic: menu question  (Read 502 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Everyone,

Iam trying to changing the menu from the site

Moderator edit: bogus link removed.

I have only a little problem.
On rule 82 I am not understanding wath is happing in the menu.

My menu with the items you can see it on rule 31 till 39.

I am using the liquid crystel 16x2 i2c display from DFrobot.

Is there anybody that can telling me what I must change on rule 82? smiley-roll



* desplay_test_ver_1.ino (10.03 KB - downloaded 8 times.)
« Last Edit: June 29, 2012, 04:12:20 pm by AWOL » Logged

UK
Offline Offline
Faraday Member
**
Karma: 100
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Handmade crochet bag with coordinate necklace anyone?

If you don't follow this up with actual code, rather than a link to some random site, I'll flag it for the mods to delete as spam.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26627
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the hint.

OP, don't post off topic junk, or your posts will be deleted.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

UK
Offline Offline
Faraday Member
**
Karma: 100
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is this the function you are asking about?

Code:
void menuChanged(MenuChangeEvent changed){

  MenuItem newMenuItem=changed.to; //get the destination menu

  lcd.setCursor(0,1); //set the start position for lcd printing to the second row

  if(newMenuItem.getName()==menu.getRoot()){
      lcd.print("test 1      ");
  }else if(newMenuItem.getName()=="Item1"){
      lcd.print("Item1           ");
  }else if(newMenuItem.getName()=="Item2"){
      lcd.print("Item2           ");
  }else if(newMenuItem.getName()=="Item3"){
      lcd.print("Item3           ");
  }
}

If so, what don't you understand about it?
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Majenko,

Yes that is the piece of sketch that I not understand.

Can you give me a solution about the sketch.

many thanks.

Logged

UK
Offline Offline
Faraday Member
**
Karma: 100
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I shall convert the function into PlainSpeak™ for you.

Code:
Define a new function "menuChanged" which takes one parameter of type "MenuChangeEvent" called "changed".

Create a new "Menuitem" object called "newMenuItem" and set it to the destination menu entry of the "changed" event.

Move the LCD cursor to the first character of the second row.

If the name of the menu item in "newMenuItem" is the same as the name of the root menu, then print "test1" to the LCD.
Otherwise if the name of the menu item in "newMenuItem" is "Item1" then print "Item1" to the LCD.
Otherwise if the name of the menu item in "newMenuItem" is "Item2" then print "Item2" to the LCD.
Otherwise if the name of the menu item in "newMenuItem" is "Item3" then print "Item3" to the LCD.

End the function.

Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Pages: [1]   Go Up
Jump to: