Android Question Sub Process Global Variable use in B4X Pages?

Hi Guys, I am new to B4X Pages, I want to know how the sub-process global variable works in B4X Pages. I have created a page(Page 1) with a B4X Table with some data. When I click any of the rows, I have to go to another page(Page 2) and I want to display that clicked cell in a label. It worked only the first time and then I came back(Page 1) and clicked another different cell, the Second selected cell value was not displaying(Only displaying the first selected cell in Page 2) I have attached my project below.
 

Attachments

  • 1.zip
    14.6 KB · Views: 104
Last edited:
Solution
You have exporting the project in wrong way.
You need to press+hold Ctrl key on keyboard and mouse click the link ide://run?File=%B4X%\Zipper.jar&Args=Project.zip at top of B4XMainPage

See the comment, which explain why.
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
After the page is created, the code will not run again.

1. You can use Sub B4XPage_Appear in test
B4X:
Sub B4XPage_Appear
    Label1.Text = b4xtablescreen.is_patientstatus
End Sub

or

2. Set Label1 as Public in test
B4X:
Public Label1 As Label

Then in B4XTable_Screen, write
B4X:
B4XPages.ShowPageAndRemovePreviousPages("test")
test_screen.Label1.Text = B4XTable1.GetRow(RowId).Get("Patient Status")

aeric

Expert
Licensed User
Longtime User
You have exporting the project in wrong way.
You need to press+hold Ctrl key on keyboard and mouse click the link ide://run?File=%B4X%\Zipper.jar&Args=Project.zip at top of B4XMainPage

See the comment, which explain why.
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
After the page is created, the code will not run again.

1. You can use Sub B4XPage_Appear in test
B4X:
Sub B4XPage_Appear
    Label1.Text = b4xtablescreen.is_patientstatus
End Sub

or

2. Set Label1 as Public in test
B4X:
Public Label1 As Label

Then in B4XTable_Screen, write
B4X:
B4XPages.ShowPageAndRemovePreviousPages("test")
test_screen.Label1.Text = B4XTable1.GetRow(RowId).Get("Patient Status")
 
Upvote 0
Solution
You have exporting the project in wrong way.
You need to press+hold Ctrl key on keyboard and mouse click the link ide://run?File=%B4X%\Zipper.jar&Args=Project.zip at top of B4XMainPage

See the comment, which explain why.
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
After the page is created, the code will not run again.

1. You can use Sub B4XPage_Appear in test
B4X:
Sub B4XPage_Appear
    Label1.Text = b4xtablescreen.is_patientstatus
End Sub

or

2. Set Label1 as Public in test
B4X:
Public Label1 As Label

Then in B4XTable_Screen, write
B4X:
B4XPages.ShowPageAndRemovePreviousPages("test")
test_screen.Label1.Text = B4XTable1.GetRow(RowId).Get("Patient Status")
Thanks @aeric It worked.
 
Upvote 0
You have exporting the project in wrong way.
You need to press+hold Ctrl key on keyboard and mouse click the link ide://run?File=%B4X%\Zipper.jar&Args=Project.zip at top of B4XMainPage

See the comment, which explain why.
B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
After the page is created, the code will not run again.

1. You can use Sub B4XPage_Appear in test
B4X:
Sub B4XPage_Appear
    Label1.Text = b4xtablescreen.is_patientstatus
End Sub

or

2. Set Label1 as Public in test
B4X:
Public Label1 As Label

Then in B4XTable_Screen, write
B4X:
B4XPages.ShowPageAndRemovePreviousPages("test")
test_screen.Label1.Text = B4XTable1.GetRow(RowId).Get("Patient Status")
Now I have got another problem. In the below project, When I click the B4XTable cell , It goes to another page with some view(Below the retrieve button) are not visible, Then I click the retrieve button, All views are visible. I go back to page 1 and then click the B4XTable cell and come to page 2, I need to invisible the views that are placed below the retrieve button. It works only first time. How to overcome this?
 

Attachments

  • Project.zip
    23.4 KB · Views: 106
Upvote 0

josejad

Expert
Licensed User
Longtime User
Now I have got another problem
Then you should open a new thread.
new problem = new thread

 
Upvote 0
Top