Android Question MenuItem not calling its Sub.

Gavin

Member
Licensed User
Longtime User
I have added Six MenuItems to my Main Activity. When clicked, five of the MenuItems behave as expected, Calling their respective Subs when clicked.
B4X:
    Activity.AddMenuItem("Close", "mnuClose")
Activity.AddMenuItem("Clear", "mnuClear")
    Activity.AddMenuItem("Change Panel ID", "mnuChange_Id")
    Activity.AddMenuItem("Clear All", "mnuClearAll")
    Activity.AddMenuItem("Togle Protect", "mnuProtect")
    Activity.AddMenuItem("Delete", "mnuDelete_File")
One however, Activity.AddMenuItem("Change Panel ID", "mnuChange_Id") refuses to behave. When clicked, nothing happens. I place a break point in Sub mnuChange_Id while Debugging and the Sub appears not to be called.
B4X:
Sub mnuClearAll_Click

    Dim Answ    As Int
    Dim Qty     As Int
   
    Answ = Msgbox2("Clear all unsecured and protected squares?", "Clear All Entries.", "Yes", "", "No", Null)   
   
    If Answ = DialogResponse.POSITIVE Then
        For Qty = 0 To 404
            Select Case TagInfo(Qty).Security
                Case "U", "P", "K", "L", "M", "N"
                    l(Qty).Text = ""
                    l(Qty).Color = Colors.RGB(255, 140, 0)
                    TagInfo(Qty).LastEntry = ""
                    TagInfo(Qty).Security = "U"
            End Select
        Next
        Check_Results
        'Reset_GridPanel
    End If
End Sub   
Sub mnuChange_Id

    btnNumbers(0).Enabled = False
    btnNumbers(0).Visible = False
    btnNumbers(0).SendToBack
    btnNumbers(12).Enabled = True
    btnNumbers(12).Visible = True
    btnNumbers(12).BringToFront
   
    GridPanel(4).Visible = False
    GridPanel(4).SendToBack
    Block_ID(0).Visible = True
    Block_ID(0).Color = Colors.Yellow
    Block_ID(0).BringToFront
    Block_ID(1).Visible = True
    Block_ID(1).Color = Colors.Red
    Block_ID(1).BringToFront
    Block_ID(2).Visible = True
    Block_ID(2).Color = Colors.Red
    Block_ID(2).BringToFront
    Block_ID(3).Visible = True
    Block_ID(3).Color = Colors.Red
    Block_ID(3).BringToFront
    Block_ID(4).Visible = True
    Block_ID(4).Color = Colors.Red
    Block_ID(4).BringToFront

End Sub

Sub mnuProtect_Click

    If Protected Then
        Protected = False
        YesOrNo = " Off"   
    Else
        Protected = True
        YesOrNo = " On"
    End If
   
    Activity.Title= EtName.Text & ","  & SaveOrNot    & ", Protection" & YesOrNo & ", " & TotalStrokes & "/" & KeyStrokes
   
End Sub

Any Ideas/Thoughts appreciated.

Gavin
 

DonManfred

Expert
Licensed User
Longtime User
try to rename the event from
mnuChange_Id
to
mnuChangeId
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi Gavin,

looking at your code, you have subs
mnuClearAll_Click
mnuProtect_Click
but then a simple
mnuChange_Id with no click method appended!

udg
 
Upvote 0

Gavin

Member
Licensed User
Longtime User
Thank You udg,
That's all it was, no "_Click"appended. Incredible how such a simple thing can be overlooked. Maybe I need a rest. Should take my doggy for a walk.
 
Upvote 0
Top