B4A Library Grid/Table and ListView Library

Discorez

Member
Licensed User
Longtime User
@discorez
i've compiled with no problems the sample project
with xnObject 1.67
i use jdk1.6.0_30

Mmmm... It isn't compiled...
The compiler shows a similar error :
My version jdk 1.7.0_03 - may be this trouble is here?

if you want i can send the sample project again
please let me know
Please, if it isn't difficult to you
 

stefanobusetto

Active Member
Licensed User
Longtime User
@discorez

hi
i've compiled the xnGridSample with jdk1.7.0_17
without any problem.
i've also tryed to recompile the xnObjects library
with jdk1.7.0_17.
everything ok.

please try to download and compile the xnGridSample project
 

stefanobusetto

Active Member
Licensed User
Longtime User
Posted new version and updated sample code

Added ScrollBy ( x As int , y As int )
to scroll the grid of the specified number of horz and vert points

Added ScrollTo ( x As int , y As int )
to scroll the grid to the specified position in points

 

miquelr

Member
Licensed User
Longtime User
click on header

I want to implement a sort algorithm but I can not find the xnGrid events documentation nowhere. Exist an even for detect a click on the header or the horizontal displacement when scroll?
 

stefanobusetto

Active Member
Licensed User
Longtime User
@miquelr
i've added support for header click
please download version 1.69

B4X:
Sub gg_header_click
    Msgbox ( "column = " & gg.HeaderClicked , "clicked on header" )
End Sub

@aviario
working on gravity

 
Last edited:

bparent

Member
Licensed User
Longtime User
Convert this without xnTable as from Ver 1.6


How do I convert this code since xnTable is integrated in xnGrid? Several llines and methods are affected. Thanks.
 

stefanobusetto

Active Member
Licensed User
Longtime User
B4X:
If gg.InsertRow ( 3 , Array As String ( "new" , "new" , "new" , "new" ) ) Then
   Msgbox ( "ok" , "InsertRow" )
End If

B4X:
If gg.AppendRow ( Array As String ( "new" , "new" , "new" , "new" ) )Then
   Msgbox ( "ok" , "AppendRow" )
End If
 
Last edited:

Brad

Active Member
Licensed User
Longtime User
Nice grid stef! One problem I see is when the .gridclear is called .rowcount does not reset to 0.
 

stefanobusetto

Active Member
Licensed User
Longtime User
Added vertical gravity support for cells
B4X:
   Dim cc(4) As xnGridCol

   cc(0).Initialize2 ( "Cod." , "cod" , 40dip , Gravity.TOP + Gravity.LEFT )
   gg.AppendCol ( cc(0) )

   cc(1).Initialize2 ( "Des." , "des" , 160dip , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL)
   gg.AppendCol ( cc(1) )

      cc(2).Initialize2 ( "Grp." , "grp" , 160dip , Gravity.BOTTOM + Gravity.RIGHT )
   gg.AppendCol ( cc(2) )

   cc(3).Initialize2 ( "Other" , "other" , 360dip , Gravity.LEFT )
   gg.AppendCol ( cc(3) )
 

aviario

Active Member
Licensed User
Longtime User
Hello, I downloaded the new version 1.71 of the date and xnObjects xnObjects.jar, xml is 27/03/2013
I set one of the headers in this way because I want the header and data center it put me to the left and puts it all on the left
cc (1). Initialize2 ("Off.", "des" 120dip, Gravity.CENTER_HORIZONTAL + Gravity.LEFT)
gg.AppendCol (cc (1))


I am attaching a picture of how it is and as it should be

un saludo
Paco
 

Attachments

  • xngrid.jpg
    55.3 KB · Views: 300

stefanobusetto

Active Member
Licensed User
Longtime User
hi
i'm not sure i've fully understood you question.

header and cells use the same gravity.
you can set vertical and horizontal alignment
for example
Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
or
Gravity.CENTER_VERTICAL + Gravity.TOP
 

aviario

Active Member
Licensed User
Longtime User

Hi,
We'd like have an independient Gravity for Header and another Gravity for cells of that column. For example, we want center text header, but for this column we want left align for cells(data).

Many thanks
 

Brad

Active Member
Licensed User
Longtime User
Found something else. When I attempt to save values that I changed, the values do not go into the correct columns. So for example, the variable newvalue1 would be inserted into the column for newvalue3.

Sample code I'm using
B4X:
grid1.SetValue(grid1.RowSelected,0,newvalue1)
grid1.SetValue(grid1.RowSelected,1,newvalue2)
grid1.SetValue(grid1.RowSelected,2,newvalue3)
 

stefanobusetto

Active Member
Licensed User
Longtime User
@brad
there are 2 methods in the grid
GridClear : deletes all the visual components of the gird
but does not delete the grid data

DeleteRows : deletes all the gird data
and repaints the grid ( actually calls GridClear )
 

qsrtech

Active Member
Licensed User
Longtime User
Padding

HI, Great grid and I was wondering if it's possible to add some padding to the cells?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…