A asawyer13 Member Licensed User Longtime User Feb 5, 2011 #1 Does B4A support the Menu Key, so that when a user pushes it, I can put up a menu of options that the user has. This will help me save on screen real estate because the menu buttons will only be on the screen when the user wants to use them. Alan
Does B4A support the Menu Key, so that when a user pushes it, I can put up a menu of options that the user has. This will help me save on screen real estate because the menu buttons will only be on the screen when the user wants to use them. Alan
agraham Expert Licensed User Longtime User Feb 5, 2011 #2 Look at Activity.AddMenuItem in the help viewer. Upvote 0
A asawyer13 Member Licensed User Longtime User Feb 5, 2011 #3 Thanks, I sure will take a look. Alan Upvote 0
K kickaha Well-Known Member Licensed User Longtime User Feb 5, 2011 #4 When using MenuItem, how do you get the value of Sender? I have two menu items that point to the same sub, and wanted to identify in the sub which menu item had called it. Upvote 0
When using MenuItem, how do you get the value of Sender? I have two menu items that point to the same sub, and wanted to identify in the sub which menu item had called it.
agraham Expert Licensed User Longtime User Feb 5, 2011 #5 You can use the Tag property of a View to identify the Sender, You can set the value in code or in the Designer B4X: Sub SomeEvent Dim v As View ' or as the type you know it will be v = Sender Msgbox(v.Tag, "Sender") End Sub Upvote 0
You can use the Tag property of a View to identify the Sender, You can set the value in code or in the Designer B4X: Sub SomeEvent Dim v As View ' or as the type you know it will be v = Sender Msgbox(v.Tag, "Sender") End Sub
K kickaha Well-Known Member Licensed User Longtime User Feb 5, 2011 #6 agraham said: You can use the Tag property of a View to identify the Sender, You can set the value in code or in the Designer B4X: Sub SomeEvent Dim v As View ' or as the type you know it will be v = Sender Msgbox(v.Tag, "Sender") End Sub Click to expand... There does not seem to be a Tag property for MenuItem. It does not seem to be a type at all as far as I can see. Upvote 0
agraham said: You can use the Tag property of a View to identify the Sender, You can set the value in code or in the Designer B4X: Sub SomeEvent Dim v As View ' or as the type you know it will be v = Sender Msgbox(v.Tag, "Sender") End Sub Click to expand... There does not seem to be a Tag property for MenuItem. It does not seem to be a type at all as far as I can see.
agraham Expert Licensed User Longtime User Feb 5, 2011 #7 Sorry, for a MenuItem Sender returns the text of the MenuItem that was pressed. Upvote 0
K kickaha Well-Known Member Licensed User Longtime User Feb 5, 2011 #8 It is how to use it that I am struggling with. See the code below: B4X: Activity.AddMenuItem ("Three Arrows", "SetArrows") Activity.AddMenuItem ("Six Arrows", "SetArrows") Sub SetArrows_Click If Sender = "Three Arrows" Then When SetArrows_Click is called I get "java.lang.ClassCastException:java.lang.String" Any idea what I am doing wrong. Upvote 0
It is how to use it that I am struggling with. See the code below: B4X: Activity.AddMenuItem ("Three Arrows", "SetArrows") Activity.AddMenuItem ("Six Arrows", "SetArrows") Sub SetArrows_Click If Sender = "Three Arrows" Then When SetArrows_Click is called I get "java.lang.ClassCastException:java.lang.String" Any idea what I am doing wrong.
K kickaha Well-Known Member Licensed User Longtime User Feb 5, 2011 #9 Found the issue, it only works on the full version (I know as I purchased it when 1.2 was released earlier). Thanks to anyone who helped. Upvote 0
Found the issue, it only works on the full version (I know as I purchased it when 1.2 was released earlier). Thanks to anyone who helped.