Share My Creation Menu Designer

Discussion in 'B4J Share Your Creations' started by derez, Aug 2, 2015.

  1. derez

    derez Expert Licensed User

    The task of creating menu for b4j is not simple because you have to create a jason string.
    I made a tool for creating the string based on this thread http://www.b4x.com/android/forum/threads/designer-menu-items.56602/
    While doing that I exercised the new designer :)

    For first level menu items only name, tag and event are relevant (I tried to disable but it does not work)
    Make sure that an item is selected before doing update or remove.
    After "create" you have the string in the clipboard, just paste it to the menu field in the application designer, or copy from the textarea or the log.
    Please check and report any problems, it has not been tested too much.

    Edit: Ver. 1.1 , logic of update and remove is changed completely.
    Edit: Ver 2.0 includes save and load functions. A bug is corrected in submenu operation, now when you click it you can add a sub menu for the selected treeitem.
    Edit: ver 2.1 correct a bug.
    Edit: ver 2.2 corrected a bug in update.
    Edit: ver 2.3 added menu with shortcuts (created by itself ! ) for load(open) and save files.
    Edit: ver 2.4 corrects bugs in move and remove.
    MenuDesigner_kvs uses KeyValueStore to keep the current "menu in work" ready even while exiting.
    Edit: ver 2.5 and kvs_2.5 replace the previous after correction of bug.
    Edit: ver 2.6 corrected the same problem in moving nodes.

    Note: From version 2.0 the item's details are kept in a map by the item's name as the key. This means that an update cannot include change of the name. To do such update remove the item and add a new item instead.
     

    Attached Files:

    Last edited: Nov 16, 2015
    GMan, JiggyMan, ThRuST and 18 others like this.
  2. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Derez.

    This is a wonderful contribution.

    Early stages of testing....

    Remove command - makes app exit
     
  3. tdocs2

    tdocs2 Well-Known Member Licensed User

    Hello, Derez.

    I was able to create a menu using your app (see zip).

    A number of suggestions/issues:
    1. Add Save and Get menus (no one gets the menu right the first time) to provide for Edit/Modify capability.
    2. Update button - works on Event Names but not on Menu Text. I wanted to modify Edit to something else and it did not allow it.
    3. Remove button kills the app.

    Thank you.

    Sandy

    PS: Ideally, when your app is perfected, Erel could integrate it into the Open Designer to generate the subs for the Events....
    his goes back to my wish to have a Menu Designer....
     

    Attached Files:

  4. derez

    derez Expert Licensed User

    Thanks for the comments, I'll check .
     
  5. derez

    derez Expert Licensed User

    Ver 1.1 attached at first post.
     
    tdocs2 likes this.
  6. rwblinn

    rwblinn Well-Known Member Licensed User

    Well Done.
    Just minor one: It is possible to add menu items without text.
    Suggestions: Add Seperator, Button to Copy Code to Clipboard.
     
  7. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Derez for v1.1 - great job!

    V 1.1 seems more robust also.

    I was able to create the menu in the example attached in about 3 minutes (after testing the various features of your app). True RAD....

    But, let's say now, I want to change the menu... I cannot bring the existing menu back to your app for modification.
    WISH: The app needs a Save and Get - then it will be fantastic. Any possibility of getting this feature?

    Best regards.

    Sandy
     

    Attached Files:

  8. derez

    derez Expert Licensed User

    Never crossed my mind, why ?
    Separator should be done by "-"
    It is automatically copied to the clipboard ! just paste it !
    This is written in the first post:
    I can't save the tree or the mainmap as objects because they include TreeItems. If someone has an idea how to save and load - let me know. I've tried my best today but to no avail, but still thinking on it !
     
    Last edited: Aug 3, 2015
  9. ShaneG30

    ShaneG30 Well-Known Member Licensed User

    Thanks for this!

    Was planning on doing something similar, but ran into a road block. (I couldn't figure out how to store and generate the menus.)
     
  10. tdocs2

    tdocs2 Well-Known Member Licensed User

    Thank you, Derez.

    Please remember this is a newbie asking...

    Could the TreeItems be recreated from the JSON string?
    Is
    this relevant?

    Thank you again.

    Sandy
     
    Last edited: Aug 4, 2015
    Mashiane likes this.
  11. derez

    derez Expert Licensed User

    I have tried that on the whole map and the reconstruction is not good enough but I think I know what to do to make it work, thanks for directing me :)
     
    Last edited: Aug 4, 2015
  12. derez

    derez Expert Licensed User

    A new version 2.0 is attached at first post, with save and load functions and some bugs correction.
     
    inakigarm, tdocs2, ellpopeb4a and 2 others like this.
  13. tdocs2

    tdocs2 Well-Known Member Licensed User

    Derez,

    You deserve a triple "Like":):):) This is great.

    In my brief testing: On Save if Cancel - app exits....

    Thank you,

    Sandy
     
  14. derez

    derez Expert Licensed User

    Of course o_O
    version 2.1 corrects it (it was also on load)
     
    tdocs2 likes this.
  15. ShaneG30

    ShaneG30 Well-Known Member Licensed User

    Bug: After clicking update, clicking "Create Code" crashes the app.

    This is the debugger output ;)

    Code:
    Program started.
    Error occurred on line: 
    412 (main).
    java.lang.RuntimeException: Object should first be initialized (
    Map).
        at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:
    32)
        at anywheresoftware.b4a.objects.collections.Map.Get(
    Map.java:67)
        at b4j.example.main._write_string(main.java:
    463)
        at b4j.example.main._write_string(main.java:
    481)
        at b4j.example.main._create_action(main.java:
    399)
        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:
    497)
        at anywheresoftware.b4a.shell.Shell.runMethod(
    Shell.java:563)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:221)
        at anywheresoftware.b4a.shell.Shell.raiseEvent(
    Shell.java:156)
        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:
    497)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    93)
        at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:
    82)
        at anywheresoftware.b4a.BA$
    2.run(BA.java:165)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$170(PlatformImpl.java:295)
        at com.sun.javafx.application.PlatformImpl$$Lambda$
    48/701593.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    171(PlatformImpl.java:294)
        at com.sun.javafx.application.PlatformImpl$$Lambda$
    47/2180324.run(Unknown Source)
        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$145(WinApplication.java:101)
        at com.sun.glass.ui.win.WinApplication$$Lambda$
    36/3326003.run(Unknown Source)
        at java.lang.Thread.run(
    Thread.java:745)
     
  16. derez

    derez Expert Licensed User

    Have you selected an item before pressing update ?
    can you give more details ? (what item were you updating and what is the update)
    Can you please attach the saved file ?
     
    Last edited: Aug 4, 2015
  17. ShaneG30

    ShaneG30 Well-Known Member Licensed User

  18. derez

    derez Expert Licensed User

    Ok found it, ver 2.2 corrects the bug.
    Here is the created string (after doing update):
     
  19. derez

    derez Expert Licensed User

    Ver 2.3 , added menu with shortcuts for load(open) and save.
    The fix in 2.2 was wrong, see in the post above "about" appears twice in the end because it was the updated item.
    The correct string by 2.3 is:
     
    ShaneG30 likes this.
  20. derez

    derez Expert Licensed User

    Version 2.4 corrects bugs in handling of treeitems which are changed(removed or moved)
    App MenuDesigner_kvs takes the issue of save and retrieve one step forward - it uses KVS so the menu you are working on is kept even if you exit and there is no need to save, only SaveAs if you want to keep the file when starting a new menu.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice