Dropmenu not working.

SCIS

Active Member
Licensed User
Longtime User
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Screenresol")
   
   DropMenu.Initialize("AC")
   
   For i = 1 To 7
      Dim ai As AHActionItem
      Dim bd As BitmapDrawable
      Dim Filename, Text As String

      Select i
         Case 1         
            Text = "Prev"
         Case 2
            'Filename = "menu_down_arrow.png"
            Text = "Next"
         Case 3
         '   Filename = "menu_info.png"
            Text = "Info"
         Case 4
         '   Filename = "menu_eraser.png"
            Text = "Delete"
         Case 5
         '   Filename = "menu_search.png"
            Text = "Search"
         Case 6
         '   Filename = "menu_cancel.png"
            Text = "Cancel"
         Case 7
         '   Filename = "menu_ok.png"
            Text = "Ok"
      End Select
      
      'Initialize a bitmap drawable and the action item
      'bd.Initialize(LoadBitmap(File.DirAssets, Filename))
      ai.Initialize(i, Text, bd)
      ai.Selected = True
      
      'Add the item to both Quickactions popups
      DropMenu.AddActionItem(ai)
   Next
End Sub

Sub Button2_click
   DropMenu.Show(Sender)
End Sub

I'm trying to make a button upon pressed showing a menu which drops, like you can see in most apps when pressing the three points underneath eachother. But I can't seem to get it working with AHQuickActions
 

SCIS

Active Member
Licensed User
Longtime User
Yes, I did.

B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Dim Button1 As Button
   Dim Button2 As Button
   Dim Button3 As Button
   
   Dim DropMenu As AHPopupMenu
End Sub
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Tried setting bd to null just before ai.initialize?
Also, is the button2_click really raised? You can check by logging
B4X:
log("yes btn1 is clicked")
inside the button2_click event.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
You need an AC event like AC_Click and AC_Dismiss. If you don't have these you can click the button and the menu will show but you will get no action after that. The action is created in the AC_Click event:

B4X:
Sub AC_Click (Position As Int, ActionItemID As Int)
   Dim ans As String
   Select ActionItemID
      Case 1         
         ans = "Prev"
      Case 2
         ans = "Next"
      Case 3
         ans = "Info"
      Case 4
         ans = "Delete"
      Case 5
         ans = "Search"
      Case 6
         ans = "Cancel"
      Case 7
         ans = "Ok"
   End Select
   ToastMessageShow(ans & " pressed", False)
End Sub
 
Upvote 0
Top