Android Question Droppy library

RB Smissaert

Well-Known Member
Licensed User
Came across this library and it looks very nice indeed:
https://www.b4x.com/android/forum/threads/droppy-dropdown-menu.81918/

I am thinking I could use this to replace the regular 3-dot overflow menu.
Main reason to do this is to do with the fact that there is no simple way (via an event
triggered by clicking the 3 dots) to hide the keyboard before showing the menu.
Other benefits are the menu item separators and the menu item icons you can add.

Now I have 3 questions to do with this library:
1. How does the AppCompat library come into play? As far as I can see this library is not used in the supplied example app and I can remove the AppCompat library and the demo app, still works fine.
2. Could I initialize(anchor) the DroppyMenuPopup to an ACMenuItem of my AppCompat ACMenu?
This would avoid the trouble of placing the 3-dot button in the right place on the AC Toolbar.
3. Is there any example somewhere showing Droppy used with an AppCompat Toolbar?

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Thanks for that, all working well.
I have one problem and that is sofar I am unable to pick up the Droppy button (the view the droppy is anchored to) Click event, so
I can hide the keyboard. Is there some droppy event that happens before the menu is shown?

Code of Main:

B4X:
#Region  Project Attributes 
 #ApplicationLabel: B4A Example
 #VersionCode: 1
 #VersionName: 
 'SupportedOrientations possible values: unspecified, landscape or portrait.
 #SupportedOrientations: unspecified
 #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
 #FullScreen: False
 #IncludeTitle: True
#End Region
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalRes: ..\Resource
 
Sub Process_Globals

End Sub

Sub Globals
 
 Private ACToolBarLight1 As ACToolBarLight
 Private ToolbarHelper As ACActionBar
 Dim pop As DroppyMenuPopup
 
 Dim libIME As IME
 Private bKeyboardVisible As Boolean
 Private btnDroppy As Button
 Private EditText1 As EditText
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd

 btnDroppy.Initialize("btnDroppy")
 
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
 pop.Initialize("Droppy",btnDroppy)
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color=Colors.Red
 cb.TextSize=20
 cb.TextColor=Colors.White

 pop.addMenuItem("Test1").addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem("Options").addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
End Sub

Sub btnDroppy_Click
 
 Log("btnDroppy_Click")
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)

 bKeyboardVisible = NewHeight < OldHeight
 Log("IME_HeightChanged, bKeyboardVisible: " & bKeyboardVisible)
 
End Sub

Sub HideKeyboard()

 libIME.HideKeyboard
 bKeyboardVisible = False
 
End Sub

Sub Droppy_onClicked(view As Object, index As Int)
 
 Log($"Droppy_onClicked(${view}, ${index})"$)
 
 If view Is Button Then
  Log("btn")
 else if view Is Label Then
  Log("lbl")
 else if view Is CheckBox Then
  Log("chk")
 else if view Is DroppyMenuItemView Then
  Dim item As DroppyMenuItemView = view
  Log(item.ChildCount)
  If item.ChildCount = 1 Then
   If item.getChildAt(0) Is Label Then
    Dim lbl As Label = item.getChildAt(0)
    Log(lbl.Text)
   End If
  End If
 End If
 
End Sub

Sub Droppy_onDismissed()
 Log($"Droppy_onDismissed()"$)
End Sub

Sub ACToolBarLight1_NavigationItemClick
 Log("click1")
End Sub

Sub Activity_CreateMenu(Menu As ACMenu)
 
 Menu.Clear

 Dim item As ACMenuItem
 'Menu.Add2(10, 1, "Plus one", xml.GetDrawable("ic_plus_one_black_24dp")).ShowAsAction = item.SHOW_AS_ACTION_IF_ROOM
 'Menu.Add2(20, 2, "Refresh", xml.GetDrawable("ic_refresh_black_24dp")).ShowAsAction = item.SHOW_AS_ACTION_ALWAYS

 item = Menu.Add(1, 3, "Overflow1", Null)
 Menu.Add(2, 4, "Overflow2", Null)
 Menu.Add(3, 5, "Overflow3", Null)


End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

#If Java

public boolean _onCreateOptionsMenu(android.view.Menu menu) {
    if (processBA.subExists("activity_createmenu")) {
        processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
        return true;
    }
    else
        return false;
}
#End If

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Thanks for that, all working well.
I have one problem and that is sofar I am unable to pick up the Droppy button (the view the droppy is anchored to) Click event, so
I can hide the keyboard. Is there some droppy event that happens before the menu is shown?

Code of Main:

B4X:
#Region  Project Attributes
 #ApplicationLabel: B4A Example
 #VersionCode: 1
 #VersionName:
 'SupportedOrientations possible values: unspecified, landscape or portrait.
 #SupportedOrientations: unspecified
 #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
 #FullScreen: False
 #IncludeTitle: True
#End Region
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalRes: ..\Resource
 
Sub Process_Globals

End Sub

Sub Globals
 
 Private ACToolBarLight1 As ACToolBarLight
 Private ToolbarHelper As ACActionBar
 Dim pop As DroppyMenuPopup
 
 Dim libIME As IME
 Private bKeyboardVisible As Boolean
 Private btnDroppy As Button
 Private EditText1 As EditText
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd

 btnDroppy.Initialize("btnDroppy")
 
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
 pop.Initialize("Droppy",btnDroppy)
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color=Colors.Red
 cb.TextSize=20
 cb.TextColor=Colors.White

 pop.addMenuItem("Test1").addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem("Options").addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
End Sub

Sub btnDroppy_Click
 
 Log("btnDroppy_Click")
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)

 bKeyboardVisible = NewHeight < OldHeight
 Log("IME_HeightChanged, bKeyboardVisible: " & bKeyboardVisible)
 
End Sub

Sub HideKeyboard()

 libIME.HideKeyboard
 bKeyboardVisible = False
 
End Sub

Sub Droppy_onClicked(view As Object, index As Int)
 
 Log($"Droppy_onClicked(${view}, ${index})"$)
 
 If view Is Button Then
  Log("btn")
 else if view Is Label Then
  Log("lbl")
 else if view Is CheckBox Then
  Log("chk")
 else if view Is DroppyMenuItemView Then
  Dim item As DroppyMenuItemView = view
  Log(item.ChildCount)
  If item.ChildCount = 1 Then
   If item.getChildAt(0) Is Label Then
    Dim lbl As Label = item.getChildAt(0)
    Log(lbl.Text)
   End If
  End If
 End If
 
End Sub

Sub Droppy_onDismissed()
 Log($"Droppy_onDismissed()"$)
End Sub

Sub ACToolBarLight1_NavigationItemClick
 Log("click1")
End Sub

Sub Activity_CreateMenu(Menu As ACMenu)
 
 Menu.Clear

 Dim item As ACMenuItem
 'Menu.Add2(10, 1, "Plus one", xml.GetDrawable("ic_plus_one_black_24dp")).ShowAsAction = item.SHOW_AS_ACTION_IF_ROOM
 'Menu.Add2(20, 2, "Refresh", xml.GetDrawable("ic_refresh_black_24dp")).ShowAsAction = item.SHOW_AS_ACTION_ALWAYS

 item = Menu.Add(1, 3, "Overflow1", Null)
 Menu.Add(2, 4, "Overflow2", Null)
 Menu.Add(3, 5, "Overflow3", Null)


End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

#If Java

public boolean _onCreateOptionsMenu(android.view.Menu menu) {
    if (processBA.subExists("activity_createmenu")) {
        processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
        return true;
    }
    else
        return false;
}
#End If

RBS
If I don't anchor the Droppy to the button then the button click event fires fine, so it looks the Droppy consumes the event and one can't use
it anymore for other purposes.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
So, is there any way I can detect that the button is clicked or the Droppy menu is going to be displayed, so I can hide the keyboard?

RBS
This is one solution.

B4X:
Sub Activity_Create(FirstTime As Boolean)
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd

 btnDroppy.Initialize("btnDroppy")
 
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
End Sub

Sub AddDroppy
 
 pop.Initialize("Droppy", btnDroppy)
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color=Colors.Red
 cb.TextSize=20
 cb.TextColor=Colors.White
 
 pop.addMenuItem("Test1").addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem("Options").addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 pop.show
 
End Sub

Sub ResetBtnDroppy
 
 btnDroppy.RemoveView
 btnDroppy.Initialize("btnDroppy")
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
End Sub

Sub btnDroppy_Click()
 
 Log("btnDroppy_Click")
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
 AddDroppy
 ResetBtnDroppy

End Sub
Not nice but it works fine.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
This is one solution.

B4X:
Sub Activity_Create(FirstTime As Boolean)
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd

 btnDroppy.Initialize("btnDroppy")
 
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
End Sub

Sub AddDroppy
 
 pop.Initialize("Droppy", btnDroppy)
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color=Colors.Red
 cb.TextSize=20
 cb.TextColor=Colors.White
 
 pop.addMenuItem("Test1").addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem("Options").addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 pop.show
 
End Sub

Sub ResetBtnDroppy
 
 btnDroppy.RemoveView
 btnDroppy.Initialize("btnDroppy")
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
End Sub

Sub btnDroppy_Click()
 
 Log("btnDroppy_Click")
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
 AddDroppy
 ResetBtnDroppy

End Sub
Not nice but it works fine.

RBS
Spoke to soon, there are funny things happening when doing it this way.
For starters the icon doesn't show and stranger things happen when I use labels.

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Spoke to soon, there are funny things happening when doing it this way.
For starters the icon doesn't show and stranger things happen when I use labels.

RBS
Got most of it working, but having a problem when adding labels as in the attached code.

B4X:
#Region  Project Attributes 
 #ApplicationLabel: B4A Example
 #VersionCode: 1
 #VersionName: 
 'SupportedOrientations possible values: unspecified, landscape or portrait.
 #SupportedOrientations: unspecified
 #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
 #FullScreen: False
 #IncludeTitle: True
#End Region
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalRes: ..\Resource
 
Sub Process_Globals

End Sub

Sub Globals
 
 Private ACToolBarLight1 As ACToolBarLight
 Private ToolbarHelper As ACActionBar
 Private pop As DroppyMenuPopup
 Private libIME As IME
 Private bKeyboardVisible As Boolean
 Private btnDroppy As Button
 Private EditText1 As EditText

End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd
 
 btnDroppy.Initialize("btnDroppy")
 btnDroppy.Text = "3 Dots :-)"
 btnDroppy.TextSize = 10
 
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
End Sub

Sub btnDroppy_Click()
 
 Log("btnDroppy_Click")
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
 AddDroppy 'only now add the Droppy
 ResetBtnDroppy 'remove the Droppy
 
End Sub

Sub AddDroppy
 
 pop.Initialize("Droppy", btnDroppy)
 
 Dim lbl1 As Label
 lbl1.Initialize("lbl1")
 lbl1.Height = 32dip
 lbl1.Width = 120dip
 lbl1.Gravity = Gravity.CENTER_VERTICAL
 lbl1.Color = Colors.RGB(224,224,224)
 lbl1.TextSize = 14
 lbl1.TextColor = Colors.Black
 lbl1.Text = "Test1"
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color= Colors.RGB(224,224,224)
 cb.TextSize=14
 cb.TextColor=Colors.Black
  
 Dim lbl2 As Label
 lbl2.Initialize("lbl2")
 lbl2.Height = 32dip
 lbl2.Width = 120dip
 lbl2.Gravity = Gravity.CENTER_VERTICAL
 lbl2.Color = Colors.RGB(224,224,224)
 lbl2.TextSize = 14
 lbl2.TextColor = Colors.Black
 lbl2.Text = "Options"
 
 Dim lbl3 As Label
 lbl3.Initialize("lbl3")
 lbl3.Height = 32dip
 lbl3.Width = 120dip
 lbl3.Gravity = Gravity.CENTER_VERTICAL
 lbl3.Color = Colors.RGB(224,224,224)
 lbl3.TextSize = 14
 lbl3.TextColor = Colors.Black
 lbl3.Text = "Options1a"
 
 Dim lbl4 As Label
 lbl4.Initialize("lbl4")
 lbl4.Height = 32dip
 lbl4.Width = 120dip
 lbl4.Gravity = Gravity.CENTER_VERTICAL
 lbl4.Color = Colors.RGB(224,224,224)
 lbl4.TextSize = 14
 lbl4.TextColor = Colors.Black
 lbl4.Text = "Options1b"
 
 'Options doesn't respond here
 pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 
 'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
  'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addSeparator.addMenuItem3(lbl3).addMenuItem3(lbl4).triggerOnAnchorClick(True).build
 
 pop.show
 
End Sub

Sub ResetBtnDroppy
 
 btnDroppy.RemoveView
 btnDroppy.Initialize("btnDroppy")
 ACToolBarLight1.AddView(btnDroppy,75dip,50dip,Gravity.RIGHT)
 
End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)

 bKeyboardVisible = NewHeight < OldHeight
 Log("IME_HeightChanged, bKeyboardVisible: " & bKeyboardVisible)
 
End Sub

Sub HideKeyboard()

 libIME.HideKeyboard
 bKeyboardVisible = False
 
End Sub

Sub Droppy_onClicked(view As Object, index As Int)
 
 Log($"Droppy_onClicked(${view}, ${index})"$)
 
 If view Is Button Then
  Log("btn")
 else if view Is Label Then
  Log("lbl")
 else if view Is CheckBox Then
  Log("chk")
 else if view Is DroppyMenuItemView Then
  Dim item As DroppyMenuItemView = view
  Log(item.ChildCount)
  If item.ChildCount = 1 Then
   If item.getChildAt(0) Is Label Then
    Dim lbl As Label = item.getChildAt(0)
    Log(lbl.Text)
   End If
  End If
 End If
 
End Sub

Sub Droppy_onDismissed()
 Log($"Droppy_onDismissed()"$)
End Sub

Sub ACToolBarLight1_NavigationItemClick
 Log("click1")
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub
Any idea what the problem could be here?


RBS
 

RB Smissaert

Well-Known Member
Licensed User
This is better code (no need to need to add the droppy with every button click), but still having the same problems with labels.
Had a look at the Github site, but couldn't see good documentation of all the DroppyMenuItemView methods and must be doing
something wrong.

B4X:
#Region  Project Attributes 
 #ApplicationLabel: B4A Example
 #VersionCode: 1
 #VersionName: 
 'SupportedOrientations possible values: unspecified, landscape or portrait.
 #SupportedOrientations: unspecified
 #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
 #FullScreen: False
 #IncludeTitle: True
#End Region
#Extends: android.support.v7.app.AppCompatActivity
#AdditionalRes: ..\Resource
 
Sub Process_Globals

End Sub

Sub Globals
 
 Private ACToolBarLight1 As ACToolBarLight
 Private ToolbarHelper As ACActionBar
 Private pop As DroppyMenuPopup
 Private libIME As IME
 Private bKeyboardVisible As Boolean
 Private pnlMain As Panel
 Private btnOverflow As Button
 Private btnDroppyAnchor As Button
 Private EditText1 As EditText

End Sub

Sub Activity_Create(FirstTime As Boolean)
 
 libIME.Initialize("IME")
 libIME.AddHeightChangedEvent
 
 Activity.LoadLayout("1")
 Dim bd As BitmapDrawable
 bd.Initialize(LoadBitmap(File.DirAssets, "smiley.png"))
 ACToolBarLight1.NavigationIconDrawable = bd
 
 btnOverflow.Initialize("btnOverflow")
 btnOverflow.Text = "3 Dots :-)"
 btnOverflow.TextSize = 12
 
 ACToolBarLight1.AddView(btnOverflow,75dip,50dip,Gravity.RIGHT)
 ToolbarHelper.Initialize
 ToolbarHelper.ShowUpIndicator = False 'set to true to show the up arrow
 ACToolBarLight1.InitMenuListener
 
 AddDroppy
 
End Sub

Sub btnOverflow_Click()
 
 If bKeyboardVisible Then
  HideKeyboard
 End If
 
 ShowDroppy

End Sub

Sub ShowDroppy
 pop.show
End Sub

Sub AddDroppy
 
 btnDroppyAnchor.Initialize("btnDroppyAnchor")
 btnDroppyAnchor.Visible = True 'needs to be visible to anchor to the button
 pnlMain.AddView(btnDroppyAnchor, 284dip, 0, 0dip, 0dip)
  
 Dim lbl1 As Label
 lbl1.Initialize("lbl1")
 lbl1.Height = 32dip
 lbl1.Width = 120dip
 lbl1.Gravity = Gravity.CENTER_VERTICAL
 lbl1.Color = Colors.RGB(224,224,224)
 lbl1.TextSize = 14
 lbl1.TextColor = Colors.Black
 lbl1.Text = "Test1"
 
 Dim cb As CheckBox
 cb.Initialize("cb")
 cb.Text="Check Me!"
 cb.Color= Colors.RGB(224,224,224)
 cb.TextSize=14
 cb.TextColor=Colors.Black
  
 Dim lbl2 As Label
 lbl2.Initialize("lbl2")
 lbl2.Height = 32dip
 lbl2.Width = 120dip
 lbl2.Gravity = Gravity.CENTER_VERTICAL
 lbl2.Color = Colors.RGB(224,224,224)
 lbl2.TextSize = 14
 lbl2.TextColor = Colors.Black
 lbl2.Text = "Options"
 
 Dim lbl3 As Label
 lbl3.Initialize("lbl3")
 lbl3.Height = 32dip
 lbl3.Width = 120dip
 lbl3.Gravity = Gravity.CENTER_VERTICAL
 lbl3.Color = Colors.RGB(224,224,224)
 lbl3.TextSize = 14
 lbl3.TextColor = Colors.Black
 lbl3.Text = "Options1a"
 
 Dim lbl4 As Label
 lbl4.Initialize("lbl4")
 lbl4.Height = 32dip
 lbl4.Width = 120dip
 lbl4.Gravity = Gravity.CENTER_VERTICAL
 lbl4.Color = Colors.RGB(224,224,224)
 lbl4.TextSize = 14
 lbl4.TextColor = Colors.Black
 lbl4.Text = "Options1b"
 
 pop.Initialize("Droppy", btnDroppyAnchor)
 
 'Options doesn't respond here
 'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addclickcallback.addonDismissCallback.addSeparator.addMenuItem3(lbl3).addMenuItem("Options1b").triggerOnAnchorClick(True).build
 'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem3(lbl2).addMenuItem3(lbl3).addclickcallback.addonDismissCallback.addSeparator.addMenuItem3(lbl4).triggerOnAnchorClick(True).build
 'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem3(lbl2).addMenuItem3(lbl3).addseparator.addMenuItem3(lbl4).triggerOnAnchorClick(True).addclickcallback.addonDismissCallback.build
 'pop.addMenuItem3(lbl1).addMenuItem3(lbl4).triggerOnAnchorClick(True).addonDismissCallback.build
 'pop.addMenuItem("item1").addMenuItem2("item2", "icons8-copy-24").triggerOnAnchorClick(True).addclickcallback.addonDismissCallback.build
 'pop.addMenuItem("item1").addMenuItem("item0").triggerOnAnchorClick(True).addclickcallback.addonDismissCallback.build
 
 'Test1 and Options won't react, not sure Check me should react
 '-------------------------------------------------------------      
 pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addclickcallback.addonDismissCallback.addSeparator.addMenuItem("Options1a").addMenuItem("Options1b").triggerOnAnchorClick(True).build
 
  'pop.addMenuItem3(lbl1).addMenuItem3(cb).addMenuItem2("Test2","ic_add_alert_black_18dp").addMenuItem3(lbl2).addSeparator.addMenuItem3(lbl3).addMenuItem3(lbl4).triggerOnAnchorClick(True).build
 
End Sub

Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)

 bKeyboardVisible = NewHeight < OldHeight
 Log("IME_HeightChanged, bKeyboardVisible: " & bKeyboardVisible)
 
End Sub

Sub HideKeyboard()

 libIME.HideKeyboard
 bKeyboardVisible = False
 
End Sub

Sub Droppy_onClicked(view As Object, index As Int)
 
 Log($"Droppy_onClicked(${view}, ${index})"$)
 
 If view Is Button Then
  Log("btn")
 else if view Is Label Then
  Log("lbl")
 else if view Is CheckBox Then
  Log("chk")
 else if view Is DroppyMenuItemView Then
  Dim item As DroppyMenuItemView = view
  Log(item.ChildCount)
  If item.ChildCount = 1 Then
   If item.getChildAt(0) Is Label Then
    Dim lbl As Label = item.getChildAt(0)
    Log(lbl.Text)
   End If
  End If
 End If
 
End Sub

Sub Droppy_onDismissed()
 Log($"Droppy_onDismissed()"$)
End Sub

Sub ACToolBarLight1_NavigationItemClick
 Log("click1")
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

RBS
 

RB Smissaert

Well-Known Member
Licensed User
Not that is makes any difference but it should be:

B4X:
triggerOnAnchorClick(False) 'as Droppy not triggered by the anchor view
RBS
 
Top