Inserting a table in a tabel cell
Posted
#1
(In Topic #914)
Regular

I am creating an interface to manage my AI training data. I wanted to rapidly prototype it with gambas, version 3.17.5.
I need a tabular display, where I can add / insert subtables in a table cell. That way I want to be able to display some combinatorial graphs connecting various parameters.
Looking at the wiki, I can't find anything. Any help will be appreciated
Posted
Guru

As type variant it can be anything. Then the visible data can be a string representation.
Failing that make an array like TableData As Variant[][]
that could easily be made to hold data relevant to the current cell at column/row.
Have you tried making a new table with the current cell as it's parent?
Posted
Regular

Thank you for the reply.
Consider this code snippet, please.
Code (gambas)
- Print "new table is being created"
- Print parentTable.Tag
- code = code & c
- code = code & "-"
- newTable.Columns.Count = 3
- newTable.Columns[0].Title = "Variable Class (subtable)"
- newTable.Columns[1].Text = "ID"
- newTable.Columns[2].Text = "DATA"
- 'newTable.Rows.Count = newTable.Rows.Count + 1
- newTable.Width = mainArea.Width + 10
- newTable.Height = mainArea.Height - newTable.Top - 5 - 10
- newTable.Header = newTable.Horizontal
- newTable.Tag = code
Beyond that → consider the image please.
<IMG src="https://i.imgur.com/ktWba7W.png">
</IMG>Initially, parentTable is set as the form itself. Then I create a new row in the grid view that is visible, by clicking "Create root". I select a cell where i want to insert the subtable, and then click "create leaf". The clicking action sets the available gridview as parent table.
The error is "Type conflict: Expected container, found _Gridview_Cell". So the container plan does not really work
But I will try to work the rest out using tags.
Posted
Guru

Posted
Regular

Posted
Guru

seany said
same thing happens with a table view as well
Yes a TableView inherits GridView comp/src/gb.form/.src/TableView.class · master · Gambas / gambas · GitLab
it's essentially just a GridView with added cell editing abilities so apart from the editing it behaves exactly the same as a GridView will.
You could possibly get what you want just by using a ScrollView Arranged Vertically
Then adding Panels containing your TableViews and other data
probably just easiest to use a multi-line string representation and make a popup window to edit if needed
there's always a way
Posted
Regular

So the process continues. I can overlay tables on top of each other, I am still refining the process. Please see image.
<IMG src="https://i.imgur.com/Uv986ky.png">
</IMG>The table marked with green arrow is the outermost "master". It can be seen that the subtable is marked in red arrow, is well placed in the cell. Ignore the other tables please.
Now, if i click on the cell marked with the blue triangle, sometimes it returns that the
Code
LastHow can I ensure to place a particular object at a particular Z index, and ensure that clicking on one editable object will not go through it, activating the object underneath it?
Thank you.
Posted
Guru

Attached is a simple example of using a scrollview and manually adding panels. I just added a TableView and a VBox with a delete button in it.
But you are free to add whatever you like as normal to each newly added panel. no TableView/GridView restrictions.
the code is just this…
Code (gambas)
- ' Gambas class file
- ScrollView1.Padding = 2
- ScrollView1.Arrangement = Arrange.Vertical
- h.Width = ScrollView1.Width
- h.Arrangement = Arrange.Horizontal
- .Name = "TView_" & iCount
- .Columns.Count = 2
- .Columns[0].Text = "TView_" & iCount
- .Columns[1].Text = "i 2"
- .Header = .Horizontal
- h.Height = (.Rows.Height * 2) + Style.FrameWidth + .Columns.Height ' set the tableview height
- b.Tag = h
- ' the delete button, the buttons .Tag is set to it's containing panel so we use that to remove the container
- o.Delete
- hb.Delete
the things being displayed do not make a lot of sense but the point is to show how it could be easier to not use a TableView at the top level due to the restrictions.
With the IDE you could make another form that is the template for each panel and keep adding that to the scrollview.
As for your current issue with your current method i would suggest using unique Names or parenting but i do not know how you are getting the data as you have not explained that so i cannot point out the error.
in my example above i have used the delete buttons .Tag to point to the correct container , i could also have used Last.Parent.Parent in the btnDel_Click() event
Posted
Regular

So for example, i can have in the outer table, samples 1 … N, each corresponding to a row. And then (take the example of sample 6) I can show each sample in 3 columns. First column = column 0 is serial num, like 1, 2, … N. The second one is an automatic generated Random key. In the third column (so cellrow = 5, cellcolumn = 3) I can add another table, and then hold param1, … paramK each in a row. Now in this table, each row can have 2 columns, first one ( = index 0) the param Name (such as param1) and the second one the param value. I want to do this in arbitrary depth.
This sort of visualization is needed.
I will probably also have to add an "expand / collapse" button pair to ensure that the total view does not get out of hand.
Posted
Regular

<IMG src="https://i.imgur.com/paA211R.png">
</IMG>I want to get rid of the scrollbars in the middle, and make it possible, that
<LIST type="decimal">
- <LI>
- The subtables move, based on whether an element is added or deleted above it,</LI>
<LI> - The subtables can be deleted post adding</LI>
<LI> - The subtables can be expanded and collapsed. Collapse should affect all the other tables that are subtables to it.</LI>
I add the relevant form and class. They are not Fmain.
Any help is appreciated.
1 guest and 0 members have just viewed this.


