B4A Library [Class] Flexible Table

Cebuvi

Active Member
Licensed User
Longtime User
Hello,

Is it possible to add two lines of text in the headers of the table?

Thanks.

César
 

Cebuvi

Active Member
Licensed User
Longtime User
And is it possible to change the size of the text in the second line?

Thanks
 

Cebuvi

Active Member
Licensed User
Longtime User
I have tried with CSBuilder and it does not change the color or the size.

B4X:
    Dim cs As CSBuilder
    cs.Initialize.Color(Colors.Red).RelativeSize(0.5).Append("[gg:mm]").PopAll
   
    ToastMessageShow(cs,True)
    tblCities.HeaderHeight = 60dip
    tblCities.SetHeader(Array As String("City" & CRLF & "[Nombre]", "Country" & CRLF & "[Nombre]", "Longitude" & CRLF & cs, "Latitude" & CRLF & "[gg:mm:ss]"))
 

harinder

Active Member
Licensed User
Longtime User
Hello,
This may have been addressed earlier and the requirement is pretty basic.
I am using Table v 2.13 and need the last row to be displayed on first display of the table.
I have tried jumptorow and jumptorowandselect. But table is totally greyed out on first display. Only on scrolling a little does table and end of table get displayed.
Thanx for your help...
 

klaus

Expert
Licensed User
Longtime User
I have tried with CSBuilder and it does not change the color or the size.
I tryed also with RichString, doesn't work either. And even if it worked, the text is only reduced horizontally not vertically.
The problem is probably that the values are converted to standard strings in the SetHeader routine.
So, if you really want it you need to modify the Table class, adding a second Label in each haeder.
 

Cebuvi

Active Member
Licensed User
Longtime User


By creating a customized version of the Table class, I have succeeded.
I attach the file in case it can help other users. The color and size of the text in the second row of text must be modified in the class

Thanks
 

Attachments

  • Table_Header2lines.zip
    33.7 KB · Views: 231

klaus

Expert
Licensed User
Longtime User
Have you tested it?
For me it doesn't work correctly, when you scroll, you have only two columns.
Several routine use code like this
For i = 0 To mNumberOfColumns - 1
cHeaderAlignments0 = Alignments
cHeaderAlignments = cHeaderAlignments0
Dim lbl As Label
lbl = Header.GetView(i)

It supposes that you get the upper Lables of the header, but in your case you get:
1st upper Label, 1st lower Label, 2nd upper Label, 2nd lower Label etc. which will give trouble!

I would suggest you to leave the SetHeader routine as it is and add another one SetHeader2ndLine.
THat way, everything works as before, you just add the second line.
You could have trouble with the automatic width detection, or you must take those into accout.
 

Cebuvi

Active Member
Licensed User
Longtime User
I'm sorry Klaus, I had not passed Albuquerque.

I will continue working according to your instructions.

Thanks
 

Cebuvi

Active Member
Licensed User
Longtime User
I have created another sub and I have eliminated the wide automatic detection but the problem always happens in the third line that is not seen.
And it occurs when I add the second label.
If in the designer you make the table smaller, it still happens in the new third line that is not seen.
Any ideas?
Thanks
 

Cebuvi

Active Member
Licensed User
Longtime User
Hello

I have cleaned the code a bit and removed the automatic width detection. The new sub is at the end of the class.
I have also made the table smaller to verify that the error is in the third row.

Thanks.
 

Attachments

  • Table_Header2lines.zip
    32.9 KB · Views: 224

harinder

Active Member
Licensed User
Longtime User
I tested Table V2.13 and get the same problem.
With Table V2.19 it works as expected.
Dear Klaus..verical scrolling works perfectly in v 2.19
But jumptorowandselect does not enable horizontal scrolling to selected column..plse advise..thnx
 

Cebuvi

Active Member
Licensed User
Longtime User
This works.
Adapt it to your needs.
I have not tested everything, at least the scrolling is OK.

Hello Klaus

It works perfectly.

Thank you very much for your work and your patience.

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