Hello All,
I have a menu thar acts as an SQL Filter, to act in table sitting below.
The Menu is invoked from a label that Reads "Type of Object" and when clicked opens the menu with a pre filled list of options.
However, the button is on the top of the form and the Menu opens Upwards, not showing some of the items.
Is it possible to force the menu to open downwards ?
Hi, that is so. the menu is tied to the label that opens the menu itself, i said button, but is a label
the click code that triggers the open
B4X:
Sub labelTypeObjectFilter_Click
If ObjectTypePopMenu.MenuIsOpen Then
ObjectTypePopMenu.CloseMenu
Else
ObjectTypePopMenu.OpenMenu
End If
End Sub
and the Initialization of the menu in the Activity_create sub
B4X:
ObjectTypePopMenu.Initialize(Activity, Me, labelTypeObjectFilter, Consts.ColorMain, Colors.White, Consts.ColorSub, True, False)
For i=0 To TypeObjectsList.Size-1
Dim bt As ObjectTypes = TypeObjectsList.Get(i)
ObjectTypePopMenu.AddMenuItem(bt.title, "ObjectTypePopMenu")
Next
My thought that is there is a bug in the menu lib because it should be able to see that there is not enough room to pop-up "above" the label, so it should pop-up under the label. But for some reason it is not.
A work-around for this bug would be to create an invisible label and position it under/lower than the real label and initialize the menu based on the invisible label's position (which is lower on the screen so hopefully the menu will fit)
Hi, In continuation to my previous "ToggleButtons" Library, (https://www.b4x.com/android/forum/threads/my-toggle-button-library-rotation-issue-solved.91324/) I am preparing multiple mini libraries for one of my bigger projects. I though it would be good to share them with you all. If you use...
OK, apparently this is a known bug and another user came up with the same solution I did - create an invisible view and initialize the menu based on that view.
The same other user also posted some code to help him calculate the location of the "dummy" view.
So, it looks like you too will have to position the invisible view to a location (before showing the menu) that will make sure the entire menu can be seen when it is displayed.
OK, apparently this is a known bug and another user came up with the same solution I did - create an invisible view and initialize the menu on that view.
The other user posted some code to help calculate the location of the "dummy" view.
So, it looks like you too will have to position the invisible view to a location (before showing the menu) that will make sure the entire menu can be seen when it is displayed.
You also have to keep in mind that if you ever have a menu that is too big to fit because of either too many menu selections, or simply because the user set their device's default font size to "large" or "huge" (which will make each menu selection line take up more room on the display), you can run into problems because it appears that this menu lib also does not support "scrolling", so it will be impossible for the user to select certain menu items if they are off-screen.
My suggestion is instead of using that menu lib, you should try to use one of the below material dialog libs because I think one or both of them support displaying a list of options just like a pop-up menu and control is immediately returned to your app when the user clicks on an item (no need for them to click OK) - meaning that even though this is a dialog library, one of the modes can act like a pop-up menu - and as a bonus they support "scrolling" in case the number of selections is too big to fit on the screen:
This is a wrap for the android.support.v7.app.AlertDialog.Builder Requirements: - B4A 6+ - Your app needs to be AppCompat ready. MaterialDialogsV7 Author: DonManfred (wrapper) Version: 1 AlertDialogBuilder Events: onCancel ( As ) onClick (button As Int, index As Int) onDismiss ( As )...
I think this library is the third attempt in this forum to wrap the excellent afollestad Material Dialogs library. The difference to the other library wrappers is that this one is (except of some minor features) a complete wrap including file- and folder choosers, color chooser and a complete...
www.b4x.com
The only potential side-effect is that these dialogs will pop-up in the middle of the screen and not as an offset to some other view. Which in my experience is not a problem with users.