UPDATE: I got it to work by using an ImageView in the Designer, then calling that. I'm going to leave it at that, so please don't waste your time on this. I have wasted enough for all of us.
I added this to "Sub Class_Globals": Dim imv1 As ImageView (after adding an ImageView control in Designer.
Then in my button, I added this:
The button toggles the image file and the visibility of the EditText1 control. I don't know why it took me so long to get to the proper place. I ended up taking my previous working code, and adding it piece by piece to the sample program that one gets when they start a new B4XPages project. Then I renamed things as needed in order to get my program rather than the sample program. I have no idea why the buttons would not work, as described below. They were present, but they did not access the code written for them the first time around. So I did an "end around" to get to where I needed to get to.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
I have a working program in b4A. I want to convert it into a B4XPages project. So I have things working (it compiles) except the buttons do not respond to a click. The buttons are all in the right place, with the right captions. I copied my old "layout.bal" file to the new working B4XPages "\files" folder and renamed it to "MainPage.bal", which apparently is case-sensitive. I even added a new button and it is visible. Yet when I tap the button, nothing happens. The sample new project I started works, and I added a second button to that with no problems. What am I doing wrong?
I put the code for the new button into B4XMainPage, just as the note says: "'Program code should go into B4XMainPage and other pages."
UPDATE: For a while, I was seeing this error message:
Error occurred on line: 35 (B4XMainPage)
java.io.FileNotFoundException: /data/data/com.astrowin/files/virtual_assets/./files/mainpage.bal: open failed: ENOENT (No such file or directory)
But I did some things and it went away. I don't know why it shoed this, unless the file name case did not agree.
ANOTHER POTENTIAL PROBLEM:
In my non-B4XPages project, I have certain designations in "Sub Process_Globals", "Sub Globals", and "Sub Activity_Create(FirstTime As Boolean)". Where does this same data go in the B4XPages project?
I found this: https://www.b4x.com/android/forum/threads/conversion-of-b4a-to-b4xpages.136366/
Will study it to find answers.
I added this to "Sub Class_Globals": Dim imv1 As ImageView (after adding an ImageView control in Designer.
Then in my button, I added this:
Code::
Sub btnSymbols_Click
If sym_flag = 0 Then 'sym_flag is a defined global variable
imv1.Bitmap = bmpSymbols
imv1.Gravity = Gravity.CENTER
EditText1.Visible = False
imv1.Visible = True
sym_flag = 1
Else
imv1.Visible = False
EditText1.Visible = True
sym_flag = 0
End If
End Sub
The button toggles the image file and the visibility of the EditText1 control. I don't know why it took me so long to get to the proper place. I ended up taking my previous working code, and adding it piece by piece to the sample program that one gets when they start a new B4XPages project. Then I renamed things as needed in order to get my program rather than the sample program. I have no idea why the buttons would not work, as described below. They were present, but they did not access the code written for them the first time around. So I did an "end around" to get to where I needed to get to.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
I have a working program in b4A. I want to convert it into a B4XPages project. So I have things working (it compiles) except the buttons do not respond to a click. The buttons are all in the right place, with the right captions. I copied my old "layout.bal" file to the new working B4XPages "\files" folder and renamed it to "MainPage.bal", which apparently is case-sensitive. I even added a new button and it is visible. Yet when I tap the button, nothing happens. The sample new project I started works, and I added a second button to that with no problems. What am I doing wrong?
I put the code for the new button into B4XMainPage, just as the note says: "'Program code should go into B4XMainPage and other pages."
Code:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Private Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
UPDATE: For a while, I was seeing this error message:
Error occurred on line: 35 (B4XMainPage)
java.io.FileNotFoundException: /data/data/com.astrowin/files/virtual_assets/./files/mainpage.bal: open failed: ENOENT (No such file or directory)
But I did some things and it went away. I don't know why it shoed this, unless the file name case did not agree.
ANOTHER POTENTIAL PROBLEM:
In my non-B4XPages project, I have certain designations in "Sub Process_Globals", "Sub Globals", and "Sub Activity_Create(FirstTime As Boolean)". Where does this same data go in the B4XPages project?
I found this: https://www.b4x.com/android/forum/threads/conversion-of-b4a-to-b4xpages.136366/
Will study it to find answers.
Last edited: