If you are only targeting Android but using B4XPages like Erel suggested, after creating your new B4XPages do the following
Files, I would personally click o the file manager and then click on Add Files (image below) to add your previous layouts and files
Code modules, hmm because you will be adding B4XPages modules, I would just add the new B4XPages modules and copy and paste the code over (but that's me)
Because I'm a Beginner, discovering the B4A, progressing slowly, step by step, I prefere starting with a brand new project, following the booklet. And as you suggest, Pasting and Runing the Old B4A Code, line by line, in the new B4X structure...
I've a small experience in "Pascal" with Delphi IDE, so I'm familiarized with the Objects & multi Form building, and try to find my old marks
I come back after studying the B4X based on the "B4XPagesTwo/Three/pages" Booklet tutorial, and it works, but ...
The Initial AIM was to read a View Value from "One page to Another", without using activity (Or double Layout or Double Panel on a same page)
The most easy example is a B4XMainPage with a Label and a Button
And a second B4XPage1 with only a Label
What i want look like this :
B4XMAINPAGE
B4X:
Private label_MAIN As B4XView
Sub Button_MAIN_Click
label_MAIN.txt = label_PAGE1.txt ' BUG !!!
End
I don't know where to declare the Label_Page1 to be seen by the MainPage
Or wat is the gateway to access the Label_PAGE1.txt from the MainPage routine in B4X
I swear that i've ride through the WWW forums before S.O.S.ing
I now find some difficulties to understand the subtility to declare a Page ID (string) to point a Layout (BAL) that allready has almost the "same" name.
I understand the necessity of linking 2 differents objects (BAS and BAL) because they are concretes with 2 features clearly separated. ID seam's to me a unusefull redondance?
I was hoping for something like this (without quotes) :
B4X:
Dim pg As B4XPage1 = B4XPages.GetPage(BAL_Page1.ID) 'change id
So I will do as you show me
Scope :
- Can you explain me this other subtility of the difference (or necessity) of sometimes declaring with "Dim" vs (Private or Public) ?
The views you want to access from another module must be declared with Public or Dim.
In your case Label1 in the B4XPage2 module.
Then you will see it:
Another question of a Newbie is How to pass (By REF) a Collection a VIEWS to un indepedant function
Imagine a MainPage and a separate Module of Code
The Mainpage has 2 EDIT : Edit_x and Edit_y
Le Module named MATHS has a Sub named Add and return X + Y
Passing Values (By Value) is very easy
MODULE CALC
B4X:
Sub Add ( x as float, y as float) as float
return X+Y
End Sub
MAIN PAGE
B4X:
Private Z as Float = MATHS.Add ( x,y )
Passing VIEWS (By Ref) is easy too and allows the back-control over the Views to validate the correct Input
MODULE CALC
B4X:
Sub ADD ( Edit_X as B4XView, Edit_Y as B4XView , Label_Result As B4XView) as Boolean
' (return success or failed)
If Edit_X = "" then
Warning("Failing Data")
Edit_X.RequestFocus
Return False
End If
...
Label_Result.Text = Edit_X.text + Edit_Y.Text
Return True
End If
Now imagine that my MainPage contains plenty of Views with plenty of differents input values ...
I can pass the Plenty VIEWS as comma separated arguments, but I Would like better to pass the Whole MainPage
I tried the :
B4X:
MATHS.Calc ( Me )
Because I successly Use the same procedure in Pascal
B4X:
Uses MATHS;
Calc (Self);
But I don't know how to recover the View values and properties in the independant Sub ... ?