Share My Creation Code Snippet App

Based upon the new thread Code Snippets in the B4A forum, have developed (using B4J) a Code Snippet App.
It was something on my ToDo list for a while, so this thread triggered to get it done.
While developing, I explored further B4J features, which are described in the source.

1652883157072.png


The Code Snippets are stored in a SQLite database. The main window shows a list with the Code Snippet SubName.
For the selected Code Snippet, the description is shown at the bottom of the list.
A toolbar on right side of the listview with functions like create new, update, delete, view code snippets, a popupmenu with export and sort options, settings form, customized listview to select library dependencies, usage of javaobject to insert date time etc in code textarea etc.

Notes
  • Read the readme.txt and the helpfile for more information.
  • The source is well commented.
  • The designer files format (fxml) is outdated - needs to be replaced with the B4J designer format (bjl).
  • The exe and jar files are not included.
  • This application has been developed back in 2014 and is not developed further (status 20220518).
Changelog
20141130

NEW: Option to view item as Webview or in Itemform
NEW: Set your favorite Item and select using dedicated symbol
NEW: App Stay on Top option
UPD: Toolbar Right Buttons logical order changed
UPD: ConfigForm redesigned layout using Tabs
UPD: Various minor improvements
 

Attachments

  • rocodesnip.zip
    192.5 KB · Views: 223
Last edited:

Reviewnow

Active Member
Licensed User
Longtime User
Rob,
First I would like to say that the interface works as designed and nice work

Few Suggestions:
Add a tree view so that snippets can be categorized
Add: when clicking on a snippet that you see the code in another area right now you have to click two different things to see the code

Could be very useful with additional features

Thanks again
Bill
 

LucaMs

Expert
Licensed User
Longtime User
When I run the program, both from the IDE that the exe, I do not see the interface (scrolling active programs with Alt + Tab I see that it is present, it is as if it were transparent!).

Also, what is that acleanup.bat?
 

stevel05

Expert
Licensed User
Longtime User
I do not see the interface

I had the same problem and had to edit the .ini file.
 

Reviewnow

Active Member
Licensed User
Longtime User
Copy the jar files in the zip file to your libs folder should work then that's what I had to do.
 

stevel05

Expert
Licensed User
Longtime User
The window was off to the right side of my monitor (I have two monitors, but the right hand monitor is my main monitor), I had to change the windowleft= attribute to 0.
 

LucaMs

Expert
Licensed User
Longtime User
Rob,
First I would like to say that the interface works as designed and nice work

Few Suggestions:
Add a tree view so that snippets can be categorized
Add: when clicking on a snippet that you see the code in another area right now you have to click two different things to see the code

Could be very useful with additional features

Thanks again
Bill


Why not add in the main window (unique) a panel on the right and view the data by clicking on the sub name?
Also, I would show not the ID.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Thanks all for feedback.

Background on why this app: The idea behind was to keep it in the top right corner of the screen to quick access frequently used code snippets. The functionality was deliberately kept simple – no categories, no tree view, no preview.

… BUT … it is great to see requests for additional functionality.

Thanks to Luca for his contribution --- which shows how simple and fast functionality can be added by using few additional controls and lines of code = B4J makes it happen.
 

IanMc

Well-Known Member
Licensed User
Longtime User
Wow!

I shall certainly study this, thank you very much!

Works brilliantly and all that in a 6,795kb download!
 

ivanomonti

Expert
Licensed User
Longtime User
B4X:
Program started.
roCodeSnip v20141126
b4j.example.main:_setdividerposition, [(SplitPane) SplitPane[id=spMain, styleClass=split-pane], 0, 1.0]
Error occurred on line: 122 (main).
java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:35)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
    at java.lang.Thread.run(Thread.java:744)
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

thanks for the info = appreciated. I can not reproduce this.

To explore further:
  • What Java Version are you using?
  • Have you tried running this project from the B4J IDE?
  • What version of B4J do you use?
  • Have you tried: delete the ini file and start again
This app has been developed with B4J 2.2, Java8 and JavaFX scene builder 2.

Regards,
Rob
 
Top