B4J Question How To Edit/Modify/Add Sub to B4XLib

B4XDev

Member
Licensed User
I added a new Sub to the DesignerUtils.B4XLib module, but the Sub I added does not seem to be seen by the IDE. What's the proper way to go about modifying a B4XLib?

I tried refreshing the Libraries Manager and closing the IDE and re-opening the project. Neither one caused my new Sub to be seen by the IDE.

I tried searching the forum for "modify b4xlib" and "edit b4xlib" and got no useful hits.
 

LucaMs

Expert
Licensed User
Longtime User
[Assuming that you should not modify official libraries - they are created by Anywhere Software and are in the Libraries folder - but if you really want to do it, it is better to make a copy, modify it, change its name and put it in the additional libraries folder (/AdditionalLibs/B4X)]...

What's the proper way to go about modifying a B4XLib?
Just as simply as I suppose you did. Unzip the B4XLib file, add your new Public Sub to a code or class module, zip again the library and, if the IDE is open, refresh the Libraries Manager tab.

If you don't see the change you made, you probably haven't placed the B4XLib in the right folder. In the case of this DesignerUtils.b4xlib there are 3 copies of it, one for each platform, in the Libraries folder of each installation (but, again, it is much better that you create your own version as I wrote at the beginning of this post ).

It is also possible that you have put your modified DesignerUtils.b4xlib in the /AdditionalLibs/B4X folder; in this case in the Libraries Manager tab you would see only the original, internal one, which is prevalent.
 
Last edited:
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Maybe you should use the tool "b4xlib2XML" to recreate the XML file of the b4xlib (and of course place it where the original is) but it does not seem to be this the case as it is written in the following link:


Also make sure you have set the accessibility/scope of the sub to public as @aeric already said.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Maybe you should use the tool "b4xlib2XML" to recreate the XML file of the b4xlib (and of course place it where the original is) but it does not seem to be this the case as it is written in the following link:
No, xml are not needed with b4xlibs !
xml files for b4xlibs are only useful if you use help tools like B4X Help Viewer.
You should never copy b4xlibs xml files into any Libaries folder but in a specific folder.

By the way, this is the recommended structure for the Additional libraries:

The Additional Libraries folder must have following structure:

1660027754685.png

  • B4A, B4i, B4J and B4J, one folder for each platform.
  • B4X, one folder for the b4xlib libraries.
  • B4XlibXMLFiles, folder for b4xlib XML help files, if used.
And in the path configuration only this:

1660027859735.png

D:\B4X\ may be different, it is the parent folder where you defined the AdditionalLibraries folder.
The IDEs recognize automatically their platform folder and the B4X folder.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I added a new Sub to the DesignerUtils.B4XLib module, but the Sub I added does not seem to be seen by the IDE. What's the proper way to go about modifying a B4XLib?
It maybe have 2 reasons:
1.you have 2 DesignerUtils.B4XLib, one is in internal file folder, another is in additional libraries folder, you edited another.
2.as aeric said, you defined the sub is private, you will not see it by ide.
 
Upvote 0

B4XDev

Member
Licensed User
If you don't see the change you made, you probably haven't placed the B4XLib in the right folder.

Ah, OK. I had downloaded the library, but there's already an interal library. Unfortunately, I cannot easily edit the internal one because of Windows file system permissions. That's easy enough to work-around, though...

In the case of this DesignerUtils.b4xlib there are 3 copies of it, one for each platform, in the Libraries folder of each installation (but, again, it is much better that you create your own version as I wrote at the beginning of this post ).

I'm adding a simple Sub that should be in the library. Maybe it already exists. I'll start another thread about it.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I think an easier quick check is to write your modified library with another version number. Untick the library and tick again. What version number does it show and does it show as Internal or Additional for the Path?
 
Upvote 0

B4XDev

Member
Licensed User
My DesignerUtils.b4xlib version shows 1.03, and online shows 1.04. Not sure how to update an internal library... Is it just a matter of downloading and placing the updated b4xlib in the right place?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
My DesignerUtils.b4xlib version shows 1.03, and online shows 1.04. Not sure how to update an internal library... Is it just a matter of downloading and placing the updated b4xlib in the right place?
Test change the version in manifest.txt as 1.05 and see if the IDE loads it as your version. If not then meaning the IDE is not reading your library or you place the file in the wrong place. Take note the path which give you the hint where the IDE actually load the library from.
On the other hand, the online version shows a bigger version mean there is a new version of this library.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
My DesignerUtils.b4xlib version shows 1.03, and online shows 1.04. Not sure how to update an internal library... Is it just a matter of downloading and placing the updated b4xlib in the right place?
Yes. Download it from the thread that will be opened by clicking on 1.04. You will find the b4xlib there and as it is an internal library, you will have to copy it to the
....../B4A/Libraries and to ..../ B4J/Libraries and to .../B4I/Libraries. This is because it is a B4XLib that can be used on all three platforms but this is not always the case; it might only be written for one or two platforms or not be a B4XLib and therefore created specifically for one platform (a .jar + .xml file).

But don't change that library! If you change it, then when Erel upgrades his to a later version, you will lose your changes!

Get it, change its name, add your changes and then put it in the additional libraries folders (....../AdditionalLibs/B4X).
 
Upvote 0
Top