Menu Key

asawyer13

Member
Licensed User
Longtime User
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
 

kickaha

Well-Known Member
Licensed User
Longtime User
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

kickaha

Well-Known Member
Licensed User
Longtime User
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

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

kickaha

Well-Known Member
Licensed User
Longtime User
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

kickaha

Well-Known Member
Licensed User
Longtime User
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
Top