How do I hide a table?

fdx12345

Active Member
Licensed User
Longtime User
I need to be able to hide a Table(s) including headers until needed without messing with the data. Is there an easy way of doing this? I did see a hide parameter to the List of Table commands.
 

mangojack

Expert
Licensed User
Longtime User
I'm still in the learning process here myself , but presently working with tables i'll have a shot ..

Is your table on a panel .. if so just hide panel ??

cheers mj
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Hide a Panel

The Table is a Class developed, I believe, by the developers of Basic4Android. I have thought about looking at the class and playing with the panel but if the Class ever gets put into a library, then I may never know the name of the panel they used. I was hoping there was a command to hide the panel. If not, I can add one but it would never be included in any upgrade or future changes.
 
Upvote 0

mrjaw

Active Member
Licensed User
Longtime User
As says mangojack just hide the panel. The problem is that when you try to fill again the table it is not appear. I post a related problem using the technique to hide the panel.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
My bad ..

I was using the table class .. but wanted to include images so switched to the custom list view ..

but prior to that i was loading two seperate tables on panels which could be hidden/shown without losing data .

Cheers mj
 
Upvote 0

mrjaw

Active Member
Licensed User
Longtime User
I am using a Table module too but this works fine the first time the second time when I fill the table doesnt appear in the table. You can see the problem here
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Ill take one last shot at this ..cause i'm getting in over my head here .. lol

are you not loading your table to the activity instead of adding the table to one of the panels

Sub Button1_Click

If TableProd.IsInitialized = False Then
TableProd.Initialize(Me, "TableProd", 2)
TableProd.AddToActivity(paneltabla, 0, 2%y, 100%x, 70%y)

possibly should be .....
panel1.AddView(TableProd.AsView, 0,2%y , panel1.Width, 70%y)

cheers mj
 
Upvote 0

mrjaw

Active Member
Licensed User
Longtime User
This works becuase I add the table to panel. So remember the first time works fine.
U try this project?
Try second time to fill the table
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
mrjaw my last post possible correction to your code was not correct ...
I am unable to explain why your code does not work but was able to load the table numerous times by changing layout slightly.
ie .. Back button clears table .. Load button reloads
this might not be desired for what you plan ..

cheers mj
 
Last edited:
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Hiding the table - my solution

I fixed the problem by adding a hiding sub in the Table Class. This works fine, least until the time comes for the class to be updated.
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Panel names

When I initialized Table I used the code:

Table1.Initialize(Callbackmodule, eventname, numberof columns).

This will run the initialize routine in the Table Class. If I was not able to see the code for the class, I would not know what was happening in that routine and what the panel was named. I did not see any commands to the Table1.xxxx which would allow me to make either panel visible much less the main panel. Turns out the Table class uses two panels. One for the Header and one for the actual table data. The main panel is called Panel not Panel1 and the one used for the header row is called Header not Panel2.

I do not know of a way of hiding both panels in a table from the users main module without knowing the name of those panel. However, I am not the brightest cookie in this area. Is there a way of hiding both panels from the users main module? What if more than one table is used?

Thanks for the help.
 
Upvote 0

stu14t

Active Member
Licensed User
Longtime User
You have to place the table on your own panel (Created in code or the designer) and then hide that, not the panels within the table class.

I created a panel in the designer and then placed it on the tabhost (or activity). I then add the table to the panel (Paneltab)

B4X:
Table1.Initialize (Me, "Table1", 3)
   Table1.AddToActivity(PanelTab, 0dip, 0dip, 150dip, 380dip) 
   Table1.HeaderColor = Colors.LightGray

I can then hide that panel

B4X:
PanelTab.Visible = False
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find Erels' example modified with two buttons allowing to hide and show two tables.
Instead of adding the tables onto the activity I added two panels and added one table on each panel.
Using
Table1.AddToActivity(pnlTable1, 0, 0, pnlTable1.Width, pnlTable1.Height)
instead of
Table1.AddToActivity(Activity, 0, 0, 100%x, 50%y)

Best regards.
 

Attachments

  • TablesOnPanels.zip
    15.2 KB · Views: 275
Upvote 0
Top