(SlimLine Menu used to get a program)
As already written in the last upgrade of my SlimLine Menu the experiment to scroll the menues was done to create an application to show the possible utilization of a dynamic complex object.
The one used in this program is quite different from the SlimLine Menu.
No more single or double menu but triple menu only with sliding capacity.
The menu uses 5 kinds of dynamic labels, 1 dynamic Panel and a dynamic WebView not included in the menu but needed to complete the application.
The program has been dedicatet to B4A as its name show ; Rem(ember) B4A core.
The pages contain all B4A views and the list of their events and their menbers.
These pages are consultable in local (without connection) but by wifi you can connect to see details of each member if you use the links therein.
About this i have question for Erel.
For the local pages i copied a part of code of your 4BA views (Core) and i used them as local pages. If this violate some right or copyright let me know and i shall change the program to operate on connection only.Take note anyway that this program will not be never published in any Market (except my site perhaps) and will be available here only if may be useful
In the meantime, going over, you can find here the code of the application.
Take note that the code in question does not require the use of the designer (and the resulting file main.bal) to operate as it uses dynamic views only.
The fact that, contrary to what is said, you will find in the program is only due to the need to provide units of measurement used by "AutoScaleAll".
In the file "main" in fact you will find only 2 label and 1 ImageView.
Two are used for the image and the inscription at the bottom of Actuvity and a. the lbl1, 8 x 100 dimension that provides the basic steps to create all the required elements of the dynamic program.
We start with
Sub Globals
Dim Mlist(10)
Dim Li(10)
Dim Labelio As Label
Dim ChoLab As Label
Dim Labase As Label
Dim Labmen As Label
Dim Labshow As Label
Dim PanMen As Panel
Dim WVx As WebViewExtras
Private Lbl1 As Label
Private Label2 As Label
Private ImageView1 As ImageView
Dim H As Int
Dim VM As Boolean
Dim No(10) As Int
Dim x, y, MeNo, t, KY, k, D As Int
Dim LG, Lista, Nlist As String
Dim ListM, listP As String
Dim Tx, LL, KX, KO As Int
Dim qq, BV, LN As Int
Dim Mn, n, m As Int
Dim mm As Int
Dim s, ListN As String
Dim Ch As Object
End Sub
The Sub "Create (FirstTime)" contains a reference to main.bal files and all strings in the form of Array created to store the data that the program will use.
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
Mlist(0) = "A-B-C-D,E-F-G-H,I-J-K-L,M-N-O-P,Q-R-S-T,U-V-W-X,Y-Z-Note,Library,All B4a,"
Mlist(0) = "A-B-C-D,E-F-G-H,I-J-K-L,M-N-O-P,Q-R-S-T,U-V-W-X,Y-Z-Tutorial,Libraries,All B4a,"
Mlist(1) = "Activity,AutoC.EditText,Button,CheckBox, Cancel,"
Mlist(2) = "EditText,Horiz.ScrollView, Cancel,"
Mlist(3) = "ImageView,Label,ListView, Cancel,"
Mlist(4) = "Panel,ProgressBar, Cancel,"
Mlist(5) = "RadioButton,ScrollView,SeekBar,Spinner,TabHost,ToggleButton, Cancel,"
Mlist(6) = "View,WebView, Cancel,"
Mlist(7) = "Note, Cancel,"
Mlist(7) = "Tutorial List,Dynamic View(1),Dynamic View(2), Cancel,"
Mlist(8) = "All Libraries, Cancel,"
Mlist(9) = "All about B4A, Cancel,"
For h = 1 To Mlist(0).Length '(to calculate number Menu activable)
If Mlist(0).CharAt(h-1) = "," Then Mn = Mn + 1
Next
MeNo = Mn
For n = 1 To 9
For h = 1 To Mlist(n).Length '(to calculate number of items of each menu)
If Mlist(n).CharAt(h-1) = "," Then No(n) = No(n) + 1
Next
Next
D = 2*Lbl1.Height
VM = False
CreaBase
End Sub
In Sub indicated above also find some lines of code are not strictly necessary in a default version of programma.dove may be replaced by two appropriate values ??( and known )
These are the strings used by the routine to determine the number of required and the number of menu items for each menu that will be created .
These are useful for an automatic adjustment ogmi time you intend to variazioni.al program .
Andanfo found over the variable definische the height of a menu item indicated based on lbl1 reference VM and the boolean variable that tells the program if a menu is open or not.
The next Sub creates the frame to the line of the menu and has the task of controlling the scrolling of the menues
Sub CreaBase
For z = 1 To 2
Dim Base As Label
Base.Initialize("Labase")
Base.Visible = True
Base.SendToBack
Base.Tag = z
Base.Color = Colors.Blue
Activity.AddView(Base,(0dip + (z-1) * (2*Lbl1.Width-5*Lbl1.Height)), 0Dip, (2*Lbl1.Width- 5*Lbl1.Height), 4*Lbl1.Height)
'---------------------Activity.AddView(Base, (0+(z-1)*(160)), 0, 160, 32)--------------------
Next
Lista = Mlist(0)
mm = 0
CreaLio
End Sub
At the end of the Sub is called the Sub CreaLio that will create the menues by the parameters needed (mm and Lista)
Sub CreaLio
qq = Activity.NumberOfViews : BV = qq
For x = 1 To 3
Dim Lio As Label
Lio.Initialize("Labelio")
Lio.Visible = True
Lio.Color = Colors.White
Lio.TextColor = Colors.Black
Lio.TextSize = Lbl1.TextSize+2
Lio.Typeface = Typeface.DEFAULT_BOLD
Lio.Gravity = Gravity.CENTER_VERTICAL
Lio.Gravity = Gravity.CENTER_HORIZONTAL
Lio.Tag = x + mm
Activity.AddView(Lio,(Lbl1.Height-3dip) + (x-1) * (Lbl1.Width + 5dip), Lbl1.Height+6dip, Lbl1.Width,Lbl1.Height*2)
'---------------------Activity.AddView(Lio, (5+(x-1)*(105)), 14, 100, 16)--------------------
Tx = (Lista).IndexOf(",")
Lio.text = Lista.SubString2(0, Tx)
Nlist = Lista.SubString2(Tx+1, Lista.Length) '(remaining Lista string)
Lista = Nlist
Next
ListN = Nlist
qq = Activity.NumberOfViews : LN = qq-1
End Sub
The Sub CreaLio is the code I normally use to create lists of labels.
The difference in this case is that the list is horizontal and not vertical and that are compiled only the first 3 menu titles and 9 instead of all those requested.
Note that at the beginning and at the end of Sub are lines of code that count the view active and are necessary to carry out the cancellation when required
Since the program menu shows only 3 and only the first 3 are compiled at startup to be able to view the rest of you need to tap the left corner of the menu frame that triggers the following Sub
Sub Labase_Click
If VM = True Then Return
Dim Base As Label
Base.Initialize("Labase")
Base = Sender
Ch = Base.Tag
If Ch = 1 Then
If mm < 6 Then
mm = mm + 3
Lista = ListN
Else
If mm = 6 Then
Return
End If
Else
mm = 0
Lista = Mlist(0)
End If
End If
ClearList
CreaLio
End Sub
The code of this Sub reads via the object tag if the frame has been touched to the left or right , in the first case the code creates in sequence the subsequent 3 menus , at the end of the sequence by touching the right corner of the frame the same sub restores the menu from the beginning.
Now we can scroll through and see all the available menus but we also have to use them by enabling their lists retractable to select the required item.
To do this we need the following 2 Sub:
Sub Labelio_Click
If VM = True Then Return
Dim Lio As Label
Lio.Initialize("Labelio")
Lio = Sender
k = Lio.Tag
LL = Lio.Left
Creamenu
End Sub
This first sub enables the Click event on dynamic labels that show the menu titles, at the same time determines the Click event, reading the label tag. what is the menu in question and defines the coordinates that will be used from the list of menu used
It is then called the Sub Creamenu
Sub Creamenu
ListM = Mlist(k)
qq = Activity.NumberOfViews : BV = qq
For y = 1 To No(k)
Dim L1 As Label
L1.Initialize("Labmen")
L1.Visible = True
L1.Color = Colors.Cyan
L1.TextColor = Colors.Black
L1.Typeface = Typeface.DEFAULT_BOLD
L1.Gravity = Gravity.CENTER_HORIZONTAL
L1.Gravity = Gravity.CENTER_VERTICAL
L1.TextSize = Lbl1.TextSize
Activity.AddView(L1, LL, (Lbl1.Height*2) + y*(Lbl1.Height*2), Lbl1.Width, (Lbl1.Height*2))
'----------------------------Activity.AddView(L1, LL, 16+y*16, 100, 16)------------------------
Tx = (ListM).IndexOf(",")
LG = ListM.SubString2(0, Tx)
listP = ListM.SubString2(Tx+1, ListM.Length) '(remaining Lista string)
ListM = listP
L1.Text = LG : Li(y) = LG
Next
Dim Pan1 As Panel
Pan1.Initialize("PanMen")
Pan1.Enabled = True
Pan1.Visible = True
Pan1.Color = Colors.Transparent
Pan1.BringToFront
Activity.AddView(Pan1,LL, 4*Lbl1.Height, Lbl1.Width, (2*Lbl1.Height) * No(k))
'------------------------------Activity.AddView(Pan1, LL, 32, 100, 16)--------------------------
VM = True
End Sub
The Sub, in addition to creating list menu as seen from my early experiments ComboBox, overlaps it with a transparent panel that allows you to detect which item in the list is selected and also enabled (True), the Boolean variable VM preventing them from being activated more than menu at the same time.
After the above the PanMen_Touch Sub will allo you to select what you like and to show the result.
Sub PanMen_Touch (Action As Int, O As Float, V As Float)
If Action = Activity.ACTION_DOWN Then
KY = Round(V)
End If
Select Case True
Case KY < (D*1) : t = 1
Case KY < (D*2) : t = 2
Case KY < (D*3) : t = 3
Case KY < (D*4) : t = 4
Case KY < (D*5) : t = 5
Case KY < (D*6) : t = 6
Case KY < (D*7) : t = 7
End Select
ClearList
Dim SelLab As Label
SelLab.Initialize("ChoLab")
SelLab.Color = Colors.White
SelLab.Textcolor = Colors.Red
SelLab.TextSize = Lbl1.TextSize
SelLab.Typeface = Typeface.DEFAULT_BOLD
SelLab.Gravity = Gravity.CENTER_HORIZONTAL
SelLab.Gravity = Gravity.CENTER_VERTICAL
SelLab.BringToFront
SelLab.Visible = True
Activity.AddView(SelLab,LL, Lbl1.Height+6Dip, Lbl1.Width, (Lbl1.Height*2))
'-------------- -------------Activity.AddView(SelLab, LL, 14, 100, 16)---------------------------
SelLab.Text = Li(t) : Lbl1.Text = k & t
If SelLab.Text = " Cancel" Then
ChoLab_Click
Lbl1.Text = ""
End If
If SelLab.Text <> " Cancel" Then CreaWeb
End Sub
It should be noted that choosing the desired item on the list is closed and the selected item appears in the menu label of the title clicked.
This happens overlaying the existing label with a new label (SelLab)that shows the selected item.
This label also becomes the key to tap to close the results of the choice made. To do this the following Sub is used
Sub ChoLab_Click
qq = Activity.NumberOfViews : LN = qq-1
Dim W2 As WebView
W2.Initialize("WebView")
WVx.clearCache(W2,True) ' instruction for WebViewExtra to clear connection cache
W2.StopLoading
ClearList
VM = False
Lbl1.Text = ""
End Sub
Examining the Sub can be noted that in addition to signaling the closing of the menu list, via the variable VM, is also required the cancellation of the WebView dynamic that is used to show the result of the choice made by the menu.
The visualization takes place via the following Sub. (please note that, in the current code, Sub CreaWeb precedes the Sub ChoLab_Click obviously)
Sub CreaWeb
Dim W2 As WebView
W2.Initialize("WebView")
W2.Visible = True
W2.Color = Colors.LightGray
If Activity.Height > Activity.Width Then
Activity.AddView(W2, Lbl1.Height+4dip, Lbl1.Height*4,Lbl1.Width*3,Lbl1.Height*40)
'---------------------------Activity.AddView(W2, 12, 32, 300, 320)----------------------------
Else
Activity.AddView(W2, Lbl1.Height, Lbl1.Height*4,(Lbl1.Width*4+8*Lbl1.Height),Activity.Height-5*Lbl1.Height)
'---------------------------Activity.AddView(W2, 8, 32, 464, 280)----------------------------
End If
WVx.addJavascriptInterface(W2,"B4A")
WVx.addWebChromeClient(W2, "")
WVx.pageDown(W2,True)
WVx.pageUp(W2,True)
s = File.GetText(File.DirAssets,("Dat" & Lbl1.Text & ".html"))
W2.LoadHtml(s)
End Sub
As already written the Web View displays a local html page for each B4A view.
This page provides a brief description of the item and the list of its events and its members.
The page contains links that allow you to connect to the internet page of which the local one represents a partial summary.
The last 3 menues of the sequence allow only connection under WiFi to show the Libraries pages and many other information about B4A RAD Language.
Now there is only 1 sub that is still missing
Sub ClearList
qq = Activity.NumberOfViews : LN = qq-1
For m = LN To BV Step -1
Activity.RemoveViewAt(m)
Next
End Sub
This is a sub that i used several times and that allows using the number of the active views, checked by several Subs, to delete time by time dynamic views no longer needed.
Well, that's all, and while I apologize for my English, I hope that this little program can be useful for finding information on B4A even when you are away from your computer, or without connection.
You can find here attached the file .zip to use with B4A and the file .apk to install and see how the program works immediatly.(Attn the apk file has an Autoscale only for my Asus display at 1280 x 800) while has been developed on a GB 2.3.3 emulator. (320x480 160 base 1)
Have fun.
As already written in the last upgrade of my SlimLine Menu the experiment to scroll the menues was done to create an application to show the possible utilization of a dynamic complex object.
The one used in this program is quite different from the SlimLine Menu.
No more single or double menu but triple menu only with sliding capacity.
The menu uses 5 kinds of dynamic labels, 1 dynamic Panel and a dynamic WebView not included in the menu but needed to complete the application.
The program has been dedicatet to B4A as its name show ; Rem(ember) B4A core.
The pages contain all B4A views and the list of their events and their menbers.
These pages are consultable in local (without connection) but by wifi you can connect to see details of each member if you use the links therein.
About this i have question for Erel.
For the local pages i copied a part of code of your 4BA views (Core) and i used them as local pages. If this violate some right or copyright let me know and i shall change the program to operate on connection only.Take note anyway that this program will not be never published in any Market (except my site perhaps) and will be available here only if may be useful
In the meantime, going over, you can find here the code of the application.
Take note that the code in question does not require the use of the designer (and the resulting file main.bal) to operate as it uses dynamic views only.
The fact that, contrary to what is said, you will find in the program is only due to the need to provide units of measurement used by "AutoScaleAll".
In the file "main" in fact you will find only 2 label and 1 ImageView.
Two are used for the image and the inscription at the bottom of Actuvity and a. the lbl1, 8 x 100 dimension that provides the basic steps to create all the required elements of the dynamic program.
We start with
Sub Globals
Dim Mlist(10)
Dim Li(10)
Dim Labelio As Label
Dim ChoLab As Label
Dim Labase As Label
Dim Labmen As Label
Dim Labshow As Label
Dim PanMen As Panel
Dim WVx As WebViewExtras
Private Lbl1 As Label
Private Label2 As Label
Private ImageView1 As ImageView
Dim H As Int
Dim VM As Boolean
Dim No(10) As Int
Dim x, y, MeNo, t, KY, k, D As Int
Dim LG, Lista, Nlist As String
Dim ListM, listP As String
Dim Tx, LL, KX, KO As Int
Dim qq, BV, LN As Int
Dim Mn, n, m As Int
Dim mm As Int
Dim s, ListN As String
End Sub
The Sub "Create (FirstTime)" contains a reference to main.bal files and all strings in the form of Array created to store the data that the program will use.
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
Mlist(0) = "A-B-C-D,E-F-G-H,I-J-K-L,M-N-O-P,Q-R-S-T,U-V-W-X,Y-Z-Tutorial,Libraries,All B4a,"
Mlist(1) = "Activity,AutoC.EditText,Button,CheckBox, Cancel,"
Mlist(2) = "EditText,Horiz.ScrollView, Cancel,"
Mlist(3) = "ImageView,Label,ListView, Cancel,"
Mlist(4) = "Panel,ProgressBar, Cancel,"
Mlist(5) = "RadioButton,ScrollView,SeekBar,Spinner,TabHost,ToggleButton, Cancel,"
Mlist(6) = "View,WebView, Cancel,"
Mlist(7) = "Tutorial List,Dynamic View(1),Dynamic View(2), Cancel,"
Mlist(8) = "All Libraries, Cancel,"
Mlist(9) = "All about B4A, Cancel,"
For h = 1 To Mlist(0).Length '(to calculate number Menu activable)
If Mlist(0).CharAt(h-1) = "," Then Mn = Mn + 1
Next
MeNo = Mn
For n = 1 To 9
For h = 1 To Mlist(n).Length '(to calculate number of items of each menu)
If Mlist(n).CharAt(h-1) = "," Then No(n) = No(n) + 1
Next
Next
D = 2*Lbl1.Height
VM = False
CreaBase
End Sub
In Sub indicated above also find some lines of code are not strictly necessary in a default version of programma.dove may be replaced by two appropriate values ??( and known )
These are the strings used by the routine to determine the number of required and the number of menu items for each menu that will be created .
These are useful for an automatic adjustment ogmi time you intend to variazioni.al program .
Andanfo found over the variable definische the height of a menu item indicated based on lbl1 reference VM and the boolean variable that tells the program if a menu is open or not.
The next Sub creates the frame to the line of the menu and has the task of controlling the scrolling of the menues
Sub CreaBase
Dim Base As Label
Base.Initialize("Labase")
Base.Visible = True
Base.SendToBack
Base.Color = Colors.Blue
Activity.AddView(Base,(0dip + (z-1) * (2*Lbl1.Width-5*Lbl1.Height)), 0Dip, (2*Lbl1.Width- 5*Lbl1.Height), 4*Lbl1.Height)
'---------------------Activity.AddView(Base, (0+(z-1)*(160)), 0, 160, 32)--------------------
Lista = Mlist(0)
mm = 0
CreaLio
End Sub
At the end of the Sub is called the Sub CreaLio that will create the menues by the parameters needed (mm and Lista)
Sub CreaLio
qq = Activity.NumberOfViews : BV = qq
For x = 1 To 3
Dim Lio As Label
Lio.Initialize("Labelio")
Lio.Visible = True
Lio.Color = Colors.White
Lio.TextColor = Colors.Black
Lio.TextSize = Lbl1.TextSize+2
Lio.Typeface = Typeface.DEFAULT_BOLD
Lio.Gravity = Gravity.CENTER_VERTICAL
Lio.Gravity = Gravity.CENTER_HORIZONTAL
Lio.Tag = x + mm
Activity.AddView(Lio,(Lbl1.Height-3dip) + (x-1) * (Lbl1.Width + 5dip), Lbl1.Height+6dip, Lbl1.Width,Lbl1.Height*2)
'---------------------Activity.AddView(Lio, (5+(x-1)*(105)), 14, 100, 16)--------------------
Tx = (Lista).IndexOf(",")
Lio.text = Lista.SubString2(0, Tx)
Nlist = Lista.SubString2(Tx+1, Lista.Length) '(remaining Lista string)
Lista = Nlist
Next
ListN = Nlist
qq = Activity.NumberOfViews : LN = qq-1
End Sub
The Sub CreaLio is the code I normally use to create lists of labels.
The difference in this case is that the list is horizontal and not vertical and that are compiled only the first 3 menu titles and 9 instead of all those requested.
Note that at the beginning and at the end of Sub are lines of code that count the view active and are necessary to carry out the cancellation when required
Since the program menu shows only 3 and only the first 3 are compiled at startup to be able to view the rest of you need to tap the left corner of the menu frame that triggers the following Sub
Sub Labase_Click
If VM = True Then Return
Dim Base As Label
Base.Initialize("Labase")
If mm < 6 Then
mm = mm + 3
Lista = ListN
Else
If mm = 6 Then
mm = 0
Lista = Mlist(0)
End If
End If
ClearList
CreaLio
End Sub
The code of this Sub reads via the object tag if the frame has been touched to the left or right , in the first case the code creates in sequence the subsequent 3 menus , at the end of the sequence by touching the right corner of the frame the same sub restores the menu from the beginning.
Now we can scroll through and see all the available menus but we also have to use them by enabling their lists retractable to select the required item.
To do this we need the following 2 Sub:
Sub Labelio_Click
If VM = True Then Return
Dim Lio As Label
Lio.Initialize("Labelio")
Lio = Sender
k = Lio.Tag
LL = Lio.Left
Creamenu
End Sub
This first sub enables the Click event on dynamic labels that show the menu titles, at the same time determines the Click event, reading the label tag. what is the menu in question and defines the coordinates that will be used from the list of menu used
It is then called the Sub Creamenu
Sub Creamenu
ListM = Mlist(k)
qq = Activity.NumberOfViews : BV = qq
For y = 1 To No(k)
Dim L1 As Label
L1.Initialize("Labmen")
L1.Visible = True
L1.Color = Colors.Cyan
L1.TextColor = Colors.Black
L1.Typeface = Typeface.DEFAULT_BOLD
L1.Gravity = Gravity.CENTER_HORIZONTAL
L1.Gravity = Gravity.CENTER_VERTICAL
L1.TextSize = Lbl1.TextSize
Activity.AddView(L1, LL, (Lbl1.Height*2) + y*(Lbl1.Height*2), Lbl1.Width, (Lbl1.Height*2))
'----------------------------Activity.AddView(L1, LL, 16+y*16, 100, 16)------------------------
Tx = (ListM).IndexOf(",")
LG = ListM.SubString2(0, Tx)
listP = ListM.SubString2(Tx+1, ListM.Length) '(remaining Lista string)
ListM = listP
L1.Text = LG : Li(y) = LG
Next
Dim Pan1 As Panel
Pan1.Initialize("PanMen")
Pan1.Enabled = True
Pan1.Visible = True
Pan1.Color = Colors.Transparent
Pan1.BringToFront
Activity.AddView(Pan1,LL, 4*Lbl1.Height, Lbl1.Width, (2*Lbl1.Height) * No(k))
'------------------------------Activity.AddView(Pan1, LL, 32, 100, 16)--------------------------
VM = True
End Sub
The Sub, in addition to creating list menu as seen from my early experiments ComboBox, overlaps it with a transparent panel that allows you to detect which item in the list is selected and also enabled (True), the Boolean variable VM preventing them from being activated more than menu at the same time.
After the above the PanMen_Touch Sub will allo you to select what you like and to show the result.
Sub PanMen_Touch (Action As Int, O As Float, V As Float)
If Action = Activity.ACTION_DOWN Then
KY = Round(V)
End If
Select Case True
Case KY < (D*1) : t = 1
Case KY < (D*2) : t = 2
Case KY < (D*3) : t = 3
Case KY < (D*4) : t = 4
Case KY < (D*5) : t = 5
Case KY < (D*6) : t = 6
Case KY < (D*7) : t = 7
End Select
ClearList
Dim SelLab As Label
SelLab.Initialize("ChoLab")
SelLab.Color = Colors.White
SelLab.Textcolor = Colors.Red
SelLab.TextSize = Lbl1.TextSize
SelLab.Typeface = Typeface.DEFAULT_BOLD
SelLab.Gravity = Gravity.CENTER_HORIZONTAL
SelLab.Gravity = Gravity.CENTER_VERTICAL
SelLab.BringToFront
SelLab.Visible = True
Activity.AddView(SelLab,LL, Lbl1.Height+6Dip, Lbl1.Width, (Lbl1.Height*2))
'-------------- -------------Activity.AddView(SelLab, LL, 14, 100, 16)---------------------------
SelLab.Text = Li(t) : Lbl1.Text = k & t
If SelLab.Text = " Cancel" Then
ChoLab_Click
Lbl1.Text = ""
End If
If SelLab.Text <> " Cancel" Then CreaWeb
End Sub
It should be noted that choosing the desired item on the list is closed and the selected item appears in the menu label of the title clicked.
This happens overlaying the existing label with a new label (SelLab)that shows the selected item.
This label also becomes the key to tap to close the results of the choice made. To do this the following Sub is used
Sub ChoLab_Click
qq = Activity.NumberOfViews : LN = qq-1
Dim W2 As WebView
W2.Initialize("WebView")
WVx.clearCache(W2,True) ' instruction for WebViewExtra to clear connection cache
W2.StopLoading
ClearList
VM = False
Lbl1.Text = ""
End Sub
Examining the Sub can be noted that in addition to signaling the closing of the menu list, via the variable VM, is also required the cancellation of the WebView dynamic that is used to show the result of the choice made by the menu.
The visualization takes place via the following Sub. (please note that, in the current code, Sub CreaWeb precedes the Sub ChoLab_Click obviously)
Sub CreaWeb
Dim W2 As WebView
W2.Initialize("WebView")
W2.Visible = True
W2.Color = Colors.LightGray
If Activity.Height > Activity.Width Then
Activity.AddView(W2, Lbl1.Height+4dip, Lbl1.Height*4,Lbl1.Width*3,Lbl1.Height*40)
'---------------------------Activity.AddView(W2, 12, 32, 300, 320)----------------------------
Else
Activity.AddView(W2, Lbl1.Height, Lbl1.Height*4,(Lbl1.Width*4+8*Lbl1.Height),Activity.Height-5*Lbl1.Height)
'---------------------------Activity.AddView(W2, 8, 32, 464, 280)----------------------------
End If
WVx.addJavascriptInterface(W2,"B4A")
WVx.addWebChromeClient(W2, "")
WVx.pageUp(W2,True)
s = File.GetText(File.DirAssets,("Dat" & Lbl1.Text & ".html"))
W2.LoadHtml(s)
End Sub
As already written the Web View displays a local html page for each B4A view.
This page provides a brief description of the item and the list of its events and its members.
The page contains links that allow you to connect to the internet page of which the local one represents a partial summary.
The last 3 menues of the sequence allow only connection under WiFi to show the Libraries pages and many other information about B4A RAD Language.
Now there is only 1 sub that is still missing
Sub ClearList
qq = Activity.NumberOfViews : LN = qq-1
For m = LN To BV Step -1
Activity.RemoveViewAt(m)
Next
End Sub
This is a sub that i used several times and that allows using the number of the active views, checked by several Subs, to delete time by time dynamic views no longer needed.
Well, that's all, and while I apologize for my English, I hope that this little program can be useful for finding information on B4A even when you are away from your computer, or without connection.
You can find here attached the file .zip to use with B4A and the file .apk to install and see how the program works immediatly.(Attn the apk file has an Autoscale only for my Asus display at 1280 x 800) while has been developed on a GB 2.3.3 emulator. (320x480 160 base 1)
Have fun.
Attachments
-
RB4Ac.jpg30.4 KB · Views: 3,702
-
RB4Ac1.jpg31.2 KB · Views: 332
-
RB4Ac2.jpg31.1 KB · Views: 303
-
RB4Ac3.jpg31.4 KB · Views: 317
-
RB4c5.jpg52.5 KB · Views: 336
-
RB4c6.jpg61.5 KB · Views: 315
-
RemB4Aslim-2bis.zip467.5 KB · Views: 329
-
remB4Aslim.apk146.1 KB · Views: 290
-
RB4Ac4.jpg54.9 KB · Views: 318
Last edited: