Android Question Table+panels

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Dear alls,
Using the table class example, I've used the designer to create the panel, named as in the example, "pnlTable". The layout name is screen6_pasivominero. I don´t get to charge the table in the panel. if I use tha table class example, with my BD and SQL, I don´t have problem. The problem appears if I want to use the designer to create the panel. Could you help me?? Regards

Sub Globals
Dim Table1 As Table
Dim pnlTable As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("screen6_pasivominero")
pnlTable.Initialize("pnlTable")
Table1.Initialize(Me, "Table1", 5, Gravity.CENTER_HORIZONTAL, True)

Table1.CellAlignment = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)
Table1.RowHeight = 40dip
Table1.AddToActivity(pnlTable, 0, 50%y, pnlTable.Width, pnlTable.Height)
Table1.MultiSelect = False
Table1.SortColumn = False
Table1.SingleLine = False
FillTableSQLite
End Sub

Sub FillTableSQLite
Dim Query As String

Table1.ClearAll

Table1.LineWidth = 3dip

Table1.TextSize = 18

Dim tf() As Typeface
tf = Array As Typeface(Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT, Typeface.DEFAULT)
Table1.SetTypeFaces(tf)

Table1.UseColumnColors = True
Query = "SELECT Codigo As [ID], Nombre As [Denominación] , Naturaleza, Distancia As [Distancia (m)], Uso As [Usos del Agua] FROM AguaSuperficial" Table1.LoadSQLiteDB(Main.s, Query, True)End Sub
 

klaus

Expert
Licensed User
Longtime User
You must remove this line !
pnlTable.Initialize("pnlTable")
Because pnlTable is defined in the Designer !

What version of the Table Class do you use ?
Do you really need the Panel ?
The Table Class includes already a Panel to hold all its internal views.
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi Klaus,

I removed the line and I have the same problem.
Only I use the panel to fix the design in the view. it's easier for me that to use % or dip.
I am using Version 1.43.

Thanks
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi again,

How can I get to limit the width of the table (table-class)? I've observed that the size is increased in function of the content of the second column, and a piece of my table disappears.. thanks
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
How can I get to limit the width of the table (table-class)?
When you add the Table class to the Activity.
Table1.AddToActivity(Activiy, 0, 50%y, YourWidth, YourHeight)
Or you can still have the pnlTable Panel to use the dimensions
Table1.AddToActivity(Activiy, 0, 50%y, pnlTable.Width, pnlTable.Height)
and remove pnlTable with pnlTable.RemoveView.
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
A good idea!!! I've used;

Table1.AddToActivity(Activity,pnlTable.Left,pnlTable.top, pnlTable.Width, pnlTable.Height)
pnlTable.RemoveView

How could I control the column size? I use Table1.SetColumnsWidths(Array As Int(60dip, 40dip, 30dip, 30dip, 100%x - 160dip)) (5 columns), but I have an error; java.lang.RuntimeException: Object should first be initialized (View).

My brother died the last monday
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
My brother died the last monday
My sincere condolences.

From your last post I suppose that it works.

The sum of the column widths must not be equal to the Table width.
If the sum of the column widths is bigger than the Table width the Table scrolls horizontally.
As you are using Table1.LoadSQLiteDB(Main.s, Query, True) the widths are calculated automatically according to the widest entry.
If you don't want the automatic widths you should use Table1.LoadSQLiteDB(Main.s, Query, False) avoiding the width calculations.
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Thanks Klaus for your condelences.
When I wrote you I had not seen the property true and false (Table1.LoadSQLiteDB).. and when you replied me, I had solved. In any case, thanks.. these days are being very difficult to me

Now I have other problem;

I have a DB, "PasivosMineros.sqlite" without data. I want to copy its structure in a new DB. When I begin the application, I give name to the new DB, in function of one paremeter, in this case, DBFileName is "PasivosMineros_02.sqlite"

If newCampaña=True Then
DBFileName="PasivosMineros_" & txtTABLET.Text & ".sqlite"
Log(DBFileName) ''"PasivosMineros_02.sqlite"
If File.Exists(File.DirDefaultExternal,"PasivosMineros.sqlite") =False Then
DBFileDir=DBUtils.CopyDBFromAssets("PasivosMineros.sqlite")
File.Copy(File.DirAssets, "PasivosMineros.sqlite", File.DirInternal, DBFileName)
End If

end if

The error indicates that not found "PasivosMineros.sqlite" and this DB is in the folder. Of course, "PasivosMineros_02.sqlite" is not create.

Best regards :(
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
Hi Klaus

I solved the error.. I had not copied the pasivosmineros.sqlite in the folder!!!!! (in B4A).. but I don´t get to copy the file and create "PasivosMineros_02.sqlite"

If newCampaña=True Then 'Nueva campaña
DBFileName="PasivosMineros_" & txtTABLET.Text & ".sqlite" 'Nombro el fichero en función del número de tablet
Log(DBFileName)
If File.Exists(File.DirDefaultExternal,"PasivosMineros.sqlite") =False Then
DBFileDir=DBUtils.CopyDBFromAssets("PasivosMineros.sqlite")
File.Copy(File.DirDefaultExternal, "PasivosMineros.sqlite", File.DirInternal, DBFileName)
End If
end if
 
Upvote 0

Pilar-JLSineriz

Active Member
Licensed User
Longtime User
I get it!!!!!!!!! ;)

DBFileName="PasivosMineros_" & txtTABLET.Text & ".sqlite" 'Nombro el fichero en función del número de tablet

If File.Exists(File.DirDefaultExternal,"PasivosMineros.sqlite") =False Then
File.Copy(File.DirAssets, "PasivosMineros.sqlite",File.DirDefaultExternal, "PasivosMineros.sqlite")
File.Copy(File.DirDefaultExternal, "PasivosMineros.sqlite", File.DirDefaultExternal, DBFileName)
s.Initialize(File.DirDefaultExternal, DBFileName, True)

End If
 
Upvote 0
Top