B4X Store
jdashboardUI / Menus & Navigation / jFloatingMenu
Menus & Navigation

jFloatingMenu

Floating contextual menu with actions, headings, separators and submenus.

Search all jdashboardUI docs
Source
jdashboardUI.b4xlib · Public API only
Store language: en

JDashboardUI · Complete API guide · B4J/JavaFX · October 30, 2026 source bundle

Contextual menu with headings, separators, icons, images, associated values, submenus, custom panels, anchoring and events.

Illustrative component mockup for jFloatingMenu

Illustrative documentation mockup, not an exact control screenshot.

What it does and when to use it

Contextual menu with headings, separators, icons, images, associated values, submenus, custom panels, anchoring and events.

Initialization and practical examples

The example demonstrates the available operations. Root, where used, refers to an existing B4XView. Example image files must actually be included in the project's Files folder.

' A menu with a heading, icons, separator and an associated value
Private Menu As jFloatingMenu
Menu.Initialize(Me, Root, 20dip, 20dip, 230dip, 220dip)
Menu.AddTitleMenu("Actions", xui.Color_White)
Menu.AddMenuItem("Edit", Chr(0xF044), xui.CreateFontAwesome(18), _
    xui.Color_White, "Edit", xui.Color_White, "Edit record")
Menu.AddSeparator(xui.Color_Gray)
Menu.AddMenuItemWithValue("Remove", Chr(0xF1F8), _
    xui.CreateFontAwesome(18), xui.Color_Red, "Delete", _
    xui.Color_White, "Delete record", 42)
Menu.ShowMenu(xui.Color_RGB(30,35,50), xui.Color_Black)

' Anchor menu to an existing control
Menu.ShowMenuRelativeTo(BtnMore, "BOTTOM_LEFT", _
    xui.Color_RGB(30,35,50), xui.Color_Black)

Private Sub Edit_OptionMenuClicked
    Log("Edit clicked")
End Sub

Private Sub Remove_OptionMenuClicked2(Value As Object)
    Log("Record: " & Value)
End Sub

' Close when appropriate
Menu.CloseMenu

Complete public API reference

This module exposes 36 public methods/accessors in the inspected version. All declarations, including variants, getters/setters and Designer lifecycle hooks, appear below.

Exact source declaration Purpose
Initialize(callback As Object, parent As B4XView, Left As Float, Top As Float, Width As Float, Height As Float) Initializes the instance and, when required, binds Callback and EventName.
Base As CustomListView Public method; use the parameters in its declaration.
CloseIcon(icon As String, font As Font, color As Int) Configures or executes close behavior.
AddMenuPrimaryTitle1(DirIcon As String, FileIcon As String, title As String, TextColor As Int) Adds a menu heading with an image.
AddMenuPrimaryTitle2(Icon As String, Font As B4XFont, ColorIcon As Int, Title As String, TextColor As Int) Adds a menu heading with a font icon.
AddMenuItem(EventName As String, IconText As String, FontIcon As B4XFont, ColorIcon As Int, MainText As String, ColorText As Int, tooltip As String) Adds a font-icon item with an event name.
AddMenuItem2(EventName As String, DirIcon As String, FileIcon As String, MainText As String, ColorText As Int, tooltip As String) Adds an image item with an event name.
AddMenuItemWithValue(EventName As String, IconText As String, FontIcon As B4XFont, ColorIcon As Int, MainText As String, ColorText As Int, tooltip As String, Value As Object) Adds a font-icon option passing its attached value to a callback.
AddMenuItem2WithValue(EventName As String, DirIcon As String, FileIcon As String, MainText As String, ColorText As Int, tooltip As String, Value As Object) Adds image-based item with an attached value.
addpanel(pane As B4XView, showCloseIcon As Boolean) Inserts a custom B4XView panel into the menu.
ReloadPanel(NewPane As B4XView, showCloseIcon As Boolean) Replaces an existing custom panel.
panel As B4XView Public method; use the parameters in its declaration.
AddSeparator(color As Int) Adds a visual divider.
AddTitleMenu(MainText As String, color As Int) Adds a section heading.
ShowMenu(PanelColor As Int, ShadowColor As Int) Shows the menu with chosen colors.
ShowMenuRelativeTo(AnchorView As B4XView, Position As String, PanelColor As Int, ShadowColor As Int) Shows the menu relative to an anchor.
ShowMenuImmediateRelativeTo(AnchorView As B4XView, Position As String, PanelColor As Int, ShadowColor As Int) Immediately shows the menu by an anchor.
AddSubMenu(EventName As String, IconText As String, FontIcon As B4XFont, ColorIcon As Int, MainText As String, ColorText As Int, SubMenu As jFloatingMenu) Links a child jFloatingMenu via a font-icon option.
AddSubMenu2(EventName As String, DirIcon As String, FileIcon As String, MainText As String, ColorText As Int, SubMenu As jFloatingMenu) Links a child menu via an image option.
ShowMenuImmediate(PanelColor As Int, ShadowColor As Int) Shows the menu without animation.
SetPosition(Left As Float, Top As Float) Changes menu coordinates.
getWidth As Float Reads the Width property.
getHeight As Float Reads the Height property.
CloseMenu Closes the menu.
setOpenOrientation_None Activates the opening orientation indicated by the method.
setOpen_LeftBottom Activates the opening orientation indicated by the method.
setOpen_RightBottom Activates the opening orientation indicated by the method.
setOpen_LeftTop Activates the opening orientation indicated by the method.
setOpen_RightTop Activates the opening orientation indicated by the method.
setOpen_LeftRight Activates the opening orientation indicated by the method.
setOpen_RightLeft Activates the opening orientation indicated by the method.
setOpen_TopBottom Activates the opening orientation indicated by the method.
setOpen_BottomTop Activates the opening orientation indicated by the method.
setFont(font As B4XFont) Configures Font; single-argument setters commonly use B4X property syntax.
getFont As B4XFont Reads the Font property.
SetMenuEventName(Name As String) Changes the event prefix.

B4X properties: read/write access

Public getX/setX members correspond to standard B4X Control.X property syntax when their signatures are property-compatible. Use multi-argument members as methods.

Property Access
Width read
Height read
Font read / write

Public fields

  • MenuItemscolorSelected As Paint

Designer properties

This module declares no custom Designer properties.

Events

  • <EventName>_OptionMenuClicked
  • <EventName>_OptionMenuClicked2(Value As Object)

Lifecycle, compatibility and limitations

Create and initialize a separate jFloatingMenu instance for child menus. Each item's EventName determines its callback; WithValue variants pass the attached Value.

DesignerCreateView and Base_Resize, where listed, are Custom View lifecycle hooks managed by B4J. Normally you should not call them manually. When adding the view through the Designer, do not initialize the same instance again.

Icon Choose: the sample bundled with JDashboardUI allows searching and previewing glyphs, selecting colors, and copying Chr(0x...) and B4X color values. TTF assets are bundled in the library.

API conventions

  • All signatures and argument types come from the inspected source bundle.
  • B4XView denotes an XUI view, B4XFont an XUI font, and Object an arbitrary value.
  • Variable names in samples are illustrative: use those from your actual project.
  • Source review was performed; no real B4J compilation was performed in this environment.