[SOLVED] LAMW: jMenu submenu - direct command lazarus / 43-Android ---------------------------------------------------------------------- tk · 2016-11-17 13:46 Hi jmpessoa, sorry to pest, having another trouble, this time with jMenu. Want to achieve following behavior: 1. there appears a menu (at the bottom of the phone display) when user presses the device menu button. 2. from this menu when user clicks on the item directly a custom dialog appears (jCustomDialog). Now I have (basically a copy paste from jMenu demo): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.AndroidModule1CreateOptionMenu(Sender: TObject;  jObjMenu: jObject);var   I: Integer;   SubMenu: jObject;begin   for I := 0 to MainMenu.Options.Count - 1 do   begin     SubMenu := MainMenu.AddSubMenu(jObjMenu, MainMenu.Options[I], MainMenu.IconIdentifiers[I]);     MainMenu.AddItem(SubMenu, I + 1, MainMenu.Options[I], mitDefault);   end;end; procedure TAndroidModule1.AndroidModule1ClickOptionMenuItem(Sender: TObject;  jObjMenuItem: jObject; itemID: integer; itemCaption: string; checked: boolean  );begin  case itemID of    1:    begin      EDDlg.Text := FIP;      Dlg.Show('Select IP address:');    end;    2:    begin      EDDlg.Text := FPort;      Dlg.Show('Select UPD port:');    end;  end;end;     // Dlg: jCustomDialog;  EDDlg: jEditText;  But this produces intermediate 'submenu' in the middle of the phone display and I must click the item there once again. Is there a way how to remove this intermediate 'submenu'? Thank you ---------------------------------------------------------------------- jmpessoa · 2016-11-20 02:37 Hi tk! Please, Try: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.DataModuleCreateOptionMenu(Sender: TObject; jObjMenu: jObject);var   i: integer;begin   for i:=0 to jMenu1.Options.Count-1 do   //options and IconIdentifiers added in design time   begin      jMenu1.AddItem(jObjMenu, 10+i {itemID}, jMenu1.Options.Strings[i], jMenu1.IconIdentifiers.Strings[i] {..res/drawable-xxx}, mitDefault, misIfRoomWithText {or misNever});   end;end;  NOTE: 1. if  "misIfRoomWithText" then firsts 3 options will be exhibit in action bar and others will be handle by hard button menu 2. if  "misNever" then all options will be handle by hard button menu ... ---------------------------------------------------------------------- tk · 2016-11-20 10:29 Quote from: jmpessoa on November 20, 2016, 03:37:16 am2. if  "misNever" then all options will be handle by hard button menu ... Exactly what I needed, thank you!