Go Down

Topic: menu question (Read 522 times) previous topic - next topic

bjoang

Jun 29, 2012, 10:26 pm Last Edit: Jun 29, 2012, 11:12 pm by AWOL Reason: 1
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:



majenko

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.
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

AWOL

Thanks for the hint.

OP, don't post off topic junk, or your posts will be deleted.
"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.

majenko

Is this the function you are asking about?

Code: [Select]

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?
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

bjoang

Dear Majenko,

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

Can you give me a solution about the sketch.

many thanks.


majenko

I shall convert the function into PlainSpeakā„¢ for you.

Code: [Select]

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.


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

Go Up