Share My Creation b4j myMenuEditor

b4j myMenuEditor

inspired by derez menu-designer
https://www.b4x.com/android/forum/threads/menu-designer.56853/

This is my Version of a Menu Editor

myMenuEditor_1.05.073.png


+ Load Menus in Json-Format
+ Save Menus in Json-Format
+ Recent Files
+ full movable Menu-Items
+ (up, down) (left, right)
+ seperator ("-")
+ Select and view of Images
+ 'Copy Icons to DirAssets' Function
+ Checked with State
+ Enabled with State
+ Menu-Items Insert and Delete
+ 'Copy Menu to Clipboard' Function
+ Shortcuts:
CONTROL+ENTER = Item Append
CONTROL+NUMPAD2 = Item Down
CONTROL+NUMPAD4 = Item Left
CONTROL+NUMPAD6 = Item Right
CONTROL+NUMPAD8 = Item Up

Knowing Bugs:
  • Only Json Files with Long '{Text:"File")' Map-Variant
    The short one (simple string) "File" crashed the App.
  • please insert "-" (Separator) at last
in the Future:
+ Code Generator for Menu-Events
+ Test Menu

New Version 5.087
  • I Change the Design of GUI a little bit (fixed problems with the internal Events)
  • Delete the Autofill Option (for the moment)
 

Attachments

  • myMenuEditor_1.05.081.jar
    500.5 KB · Views: 308
  • myMenuEditor._1.05.082.jar
    500.6 KB · Views: 374
  • myMenuEditor_5.087.jar
    507.1 KB · Views: 328
Last edited:

Knoppi

Active Member
Licensed User
Longtime User
New Version 1.05.081 (in Post #1)

Remove a bug with the 'Copy Icons to DirAssets' Function
Add 'Show Json-Menu'

Please test the app, and post if there is any error

i will share the code when the app is error free
 

Knoppi

Active Member
Licensed User
Longtime User
New Version 1.05.082 (in Post #1)

Now you can import menus with the 'File Insert' Function.

It's possible to save separate menus for 'File', 'Edit', 'View', 'Help', etc and put it together in your choice.
 

DMW

Member
Licensed User
Longtime User
Thank You very much for this tool! It will save time for me.
 

Knoppi

Active Member
Licensed User
Longtime User
You can add a seperator, just only type - in the Text Field and press 'Append' after that you can move it to the position of your choice.
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Is v105 082 compatible with Java 901? A simple menu generated this error. Dunno about everybody else. Please comment.

B4X:
[
    {"Text":"Test","Tag":"MyTest1","EventName":"TestSub","Image":"Icon_Notebook.png"}
]

Error log
Waiting for debugger to connect...
Program started.
Fel uppstod vid linje; 45 (Main)
java.lang.ClassCastException: [email protected]/javafx.scene.control.MenuItem cannot be cast to [email protected]/javafx.scene.control.Menu
at javafx.controls/javafx.scene.control.skin.MenuBarSkin.rebuildUI(MenuBarSkin.java:820)
at javafx.controls/javafx.scene.control.skin.MenuBarSkin.<init>(MenuBarSkin.java:350)
at javafx.controls/javafx.scene.control.MenuBar.createDefaultSkin(MenuBar.java:203)
at javafx.controls/javafx.scene.control.Control.doProcessCSS(Control.java:897)
at javafx.controls/javafx.scene.control.Control.access$000(Control.java:83)
at javafx.controls/javafx.scene.control.Control$1.doProcessCSS(Control.java:89)
at javafx.controls/com.sun.javafx.scene.control.ControlHelper.processCSSImpl(ControlHelper.java:67)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:147)
at javafx.graphics/javafx.scene.Parent.doProcessCSS(Parent.java:1419)
at javafx.graphics/javafx.scene.Parent.access$400(Parent.java:81)
at javafx.graphics/javafx.scene.Parent$1.doProcessCSS(Parent.java:127)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.processCSSImpl(ParentHelper.java:100)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.processCSS(NodeHelper.java:147)
at javafx.graphics/javafx.scene.Node.processCSS(Node.java:9513)
at javafx.graphics/javafx.scene.Scene.doCSSPass(Scene.java:583)
at javafx.graphics/javafx.scene.Scene.preferredSize(Scene.java:1770)
at javafx.graphics/javafx.scene.Scene$2.preferredSize(Scene.java:394)
at javafx.graphics/com.sun.javafx.scene.SceneHelper.preferredSize(SceneHelper.java:66)
at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1098)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1186)
at javafx.graphics/javafx.stage.Window.show(Window.java:1201)
at javafx.graphics/javafx.stage.Stage.show(Stage.java:276)
at anywheresoftware.b4j.objects.Form.Show(Form.java:205)
at Notebook.Duologic.Se.main._appstart(main.java:93)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:613)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:231)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
at Notebook.Duologic.Se.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:919)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(PlatformImpl.java:449)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(PlatformImpl.java:418)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:417)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
at java.base/java.lang.Thread.run(Thread.java:844)
 

Knoppi

Active Member
Licensed User
Longtime User
is this a main level menu?
if so, then it is not possible to specify a picture,
the app does not recognize this at the moment.

please try
[
{"Text":"Test","Tag":"MyTest1","EventName":"TestSub"}
]
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Thanks I will try your editor again since it seems very good. I just added a simple menu just to try it and that's when the error occured, sorry I am new to the JSON script so I problably made a simple misstake, but you should display a Fx.MsgBox(MainForm, "Notification message", Title") after checking if "Image" exists as the main menu level to avoid such confusion. I tried out Derez menu designer and it seems really good too and I got it to work after reading the Menubar tutorial by Erel.
 

Knoppi

Active Member
Licensed User
Longtime User
i will fixed it in the next version (end of january) with some other bugs
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Awesome, looking forward to try the new version, and a Happy New Year 2018
 

PatrikCavina

Active Member
Licensed User
I added other icons in icons folder and i added them to menu items, now when i click "Copy Icons To Dir Asserts..." program crashes.
So i remove all icons i've added, but problem persist.
I think the possibility to add other icons would be interesting.
Anyways very useful tool.
 

Knoppi

Active Member
Licensed User
Longtime User
Copy Icons To Dir Asserts...

I am writing the program partly new.

You Add the icons to C:\Users\YOURNAME\AppData\Roaming\MyMenuEditor\Icons ?
I will check this next week.
 
Last edited:

PatrikCavina

Active Member
Licensed User
You Add the icons to C:\Users\YOURNAME\AppData\Roaming\MyMenuEditor\Icons ?
Exactly.
To be more specific: the crash happens when I add a new icon to a child element and try to use the "Copy Icons to Dir Asserts" function.
After first crash, if i add item with icon and i try to use "Copy Icons ...", i receive this error:
B4X:
java.lang.IllegalArgumentException: Folder parameter must be a valid folder
        at com.sun.glass.ui.CommonDialogs.convertFolder(CommonDialogs.java:238)
        at com.sun.glass.ui.CommonDialogs.showFolderChooser(CommonDialogs.java:226)
        at com.sun.javafx.tk.quantum.QuantumToolkit.showDirectoryChooser(QuantumToolkit.java:1534)
        at javafx.stage.DirectoryChooser.showDialog(DirectoryChooser.java:103)
        at anywheresoftware.b4j.objects.DirectoryChooserWrapper.Show(DirectoryChooserWrapper.java:43)
        at ths.mymenueditor.main._getfolderfromdirchooser(main.java:1090)
        at ths.mymenueditor.main._mnumain_action(main.java:1563)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
        at anywheresoftware.b4a.BA$1.run(BA.java:215)
        at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
        at java.lang.Thread.run(Thread.java:748)
 

PatrikCavina

Active Member
Licensed User
I think i understand the problem.
Isn't an icon problems but the problem is in Settings.map in parameter LastImageDir.
if folder of LastImageDir not exist when i click "Copy Icons To Dir Asserts..." program try to open the folder and it crashed.
And this explains the error:
java.lang.IllegalArgumentException: Folder parameter must be a valid folder
 

Knoppi

Active Member
Licensed User
Longtime User
It looks like that it is a problem with DirectoryChooser and InitialDirectory
The Funktion "Copy Icons To Dir Asserts..." Create a not existing Folder.
 
Top