Android Question MLMenu does not scroll

welu1805

Active Member
Licensed User
Longtime User
Hi all,

I use the MLMenu library. When my tablet is in landscape mode I can't see all menu items (in portrait it is good). The MLMenu does not scroll.

Is there any parameter I don't know to scroll the menu?

Thanks
Lutz
 

welu1805

Active Member
Licensed User
Longtime User
I wanted to create a small example, but the MLMenu causes problems at the code:

mnu.Initialize(1, 40dip, Activity, Me, Colors.DarkGray, Colors.White, 18, "mnu")
mnu.AddMenuItem("1", Null)

Logger connected to: LENOVO LIFETAB_P970X
--------- beginning of main
Copying updated assets files (1)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.NoSuchMethodError: No virtual method AddSingleLine(Ljava/lang/StringV in class Lanywheresoftware/b4a/objects/ListViewWrapper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ListViewWrapper' appears in /data/app/testLWMenu.wedersoft.de-1/base.apk)
at org.mlsoftMLmenu.mlmenu._refillmenu(mlmenu.java:382)
at org.mlsoftMLmenu.mlmenu._addmenuitem(mlmenu.java:74)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:163)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:5204)
at android.view.View$PerformClick.run(View.java:21170)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:772)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:662)
An error occurred:
(Line: 47) mnu.AddMenuItem("2", Null)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean

My version: B4A V 6.80

My original app was created under V 4 (or older ???)
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User

----------------------
its really hard to guess , how do you make the menu scroll? can you upload your project as zip ?
 
Last edited:
Upvote 0

welu1805

Active Member
Licensed User
Longtime User
I found the source of MLMenu.bas. I removed the library from my project and instead I used the modul MLMenu.bas. Now it works also under B4A V 6.80.

I added 30 items to the menu.
If I show the menu with

mnu.OpenMenuAt(80%x, 0) I can scroll all 30 items.

But if I show the menu not from the top of the screen with

mnu.OpenMenuAt(80%x, 300) I can scroll only to item 26.

There must be an error in the MLMenu.bas.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
mnu.OpenMenuAt(80%x, 300) I can scroll only to item 26.

There must be an error in the MLMenu.bas.
B4X:
mnu.OpenMenuAt(80%x,300) ' <-- your missing px, dip, or %x %y
mnu.OpenMenuAt(80%x,0) '<-- will appear on top most part of the screen

try this code

B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim ctr As Int = 1
    Activity.Color = Colors.LightGray

    mnu.Initialize(4,40dip,Activity,Me,Colors.White,Colors.Black,16,"mnu")

    For i = 0 To 29

        mnu.AddMenuItem("Test"&ctr,NULL)
        ctr = ctr + 1
    Next



    mnu.OpenMenuAt(80%x,0)
End Sub
tested on my device.. works fine
 
Last edited:
Upvote 0

welu1805

Active Member
Licensed User
Longtime User
mnu.OpenMenuAt(80%x,0)

Yes, with top = 0 it works, but with e.g. top = 300 it doesn't work at my tablet.
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
mnu.OpenMenuAt(80%x,0)

Yes, with top = 0 it works, but with e.g. top = 300 it doesn't work at my tablet.
see the codes above, i think your missing dip, px, or %

But if I show the menu not from the top of the screen with

mnu.OpenMenuAt(80%x, 300) I can scroll only to item 26.
can you post a screenshot ?
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…