Bug? [SOLVED!] B4J won't recognize custom control name-change.

LWGShane

Well-Known Member
Licensed User
Longtime User
I'm trying to copy a control named "CustomControl1" to whatever the user names the project in my app, the B4X Launcher.

When I load the project, B4J displays a "Error Loading Module: CustomControl1".
 

LWGShane

Well-Known Member
Licensed User
Longtime User
I have a custom control project called "CustomControl" with a custom control module called "CustomControl1" in the files tab in my "B4X-Launcher" project. I'm trying to use File.Copy to copy those files to the name the user gives them. However, when I use fx.ShowExternalDocument to launch the project, B4J is unable to recognize the now renamed module.

Image is attached.
 

Attachments

  • B4JBug.PNG
    B4JBug.PNG
    304.5 KB · Views: 287

LWGShane

Well-Known Member
Licensed User
Longtime User
@Erel - Solved it! I added the following code to my project:

B4X:
Dim POriginal As String = File.ReadString(Path, Name & ".b4j")
Dim NewFile As String = POriginal.Replace("Module1=CustomControl1", "Module1=" & Name)
File.WriteString(Path, Name & ".b4j", NewFile)
 
Top