B4A Library Grid/Table and ListView Library

stefanobusetto

Active Member
Licensed User
Longtime User
Check columns ( how-to )
B4X:
cc(2).Initialize2 ...
cc(2).RowIconTop  = 6dip 
cc(2).RowIconLeft = 6dip 
cc(2).setTypeCheck

the column will display a green tick if the value of the column is "1"
nothing otherwise

RowIconTop and RowIconLeft can be used to adjust
the position of the tick in the cell
 
Last edited:

stefanobusetto

Active Member
Licensed User
Longtime User
@aviario

to setup a custom image for check columns
you can use an image column with a single value
cc(0).Initialize ...
cc(0).RowIconPut("1",bmp)
cc(0).SetTypeImage
anyway i'm adding the property for the image
and also the value

what do you mean for printing?

 

aviario

Active Member
Licensed User
Longtime User

If you know of any library to print on printer

In the grid when the text of the column is larger than the width puts in two columns, there is the possibility to resize the height of that column automatically?
 

stefanobusetto

Active Member
Licensed User
Longtime User
No. I've developed an application that needs to print and i've decided to create pdfs. I've a good lib for that.

There is no autosize planned sorry.

 

aviario

Active Member
Licensed User
Longtime User
Hi,
If i use Cgrid.ScrollTop, grid goes to first line, but can i select by code the first line?

Thanks
 

stefanobusetto

Active Member
Licensed User
Longtime User
Hi,
you can use SelectRow. I've exposed the method and posted version 2.05.
I've also added
- CheckIcon to set the icon
- CheckValue to set the "check" value
for the check columns
 

stefanobusetto

Active Member
Licensed User
Longtime User
The RowHeight property allows to the the height of the rows.
I think you want to set instead the height of a given row.
Isn't it?
 

jrat

Member
Licensed User
Longtime User
Whether it is possible to make FastScroll for big grids?
Like ListView1.FastScrollEnabled
 

stefanobusetto

Active Member
Licensed User
Longtime User
@magi6162
B4X:
Grid.Initialize("Grid")

Dim c(4) As xnGridCol
c(0).Initialize ( "Cod." , "cod" , 15%x )
c(1).Initialize ( "Des." , "des" , 60%x )
...

For i = 0 To c.Length - 1
    Grid.AppendCol ( c(i) )
Next

...

Dim ss As String
ss = "select cod , des , ... from ... " 

Grid.DeleteRows

Dim cc As Cursor
cc = Main.db.execquery ( ss & " limit 100 ")
Grid.CursorAppend ( cc )
 

stefanobusetto

Active Member
Licensed User
Longtime User
i use the grid with several devices
smartphones an tablets and
i've no problems with the grid lines
it could be the emulator (android version, display size, resolution, ...)
if you can supply some details on the vm
may be i can arrange some testing

as for the sorting i'm sorry
i thought i've already answered
i'm doing some test
to decide if add it or not

 

stefanobusetto

Active Member
Licensed User
Longtime User
@magi6162
your code looks ok.
here attached the test program i use to debug the grid.
can you try if it works and if you can see the grid please?
the app creates a local database and loads the grid with
the CursorAppend method.
ciao
 

Attachments

  • xnGridSample.zip
    13.2 KB · Views: 224

aviario

Active Member
Licensed User
Longtime User
hello, the version 2.07 has an error when I put
Cgrid.GridCreate2 (True) does not show the grid
Cgrid.GridCreate2 (False) works Ok.

When I put Cgrid.PropSetHeight (3.60) gives me the following error

LastException java.lang.indexOutOfBoundsException

Cgrid.PropSetHeight(3,60)
java.lang.IndexOutOfBoundsException
at java.util.LinkedList.get(LinkedList.java:519)
at it.csinet.xnObjects.xnGrid.PropSetHeight(xnGrid.java:830)
at it.csinet.xnObjects.b4aGrid.PropSetHeight(b4aGrid.java:433)
at flm.b4a.floatwindemo.stockcamion._configura_pantalla(stockcamion.java:1129)
at flm.b4a.floatwindemo.stockcamion._activity_create(stockcamion.java:347)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at flm.b4a.floatwindemo.stockcamion.afterFirstLayout(stockcamion.java:89)
at flm.b4a.floatwindemo.stockcamion.access$100(stockcamion.java:16)
at flm.b4a.floatwindemo.stockcamion$WaitForLayout.run(stockcamion.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4437)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:835)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)


thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…