Dynamically Created Tables on a Scrollarea - random artefacts after scrolling
Posted
#1
(In Topic #920)
Regular

So, with my continuing project, I can do this now :
<IMG src="https://i.imgur.com/CAY7Bx4.png">
</IMG>But If I scroll it, sometimes, the location of the last edited cell randomly gets stuck, i.e. does not scroll with the rest of the system.
I have marked a special case with 3 blue arrows, where a copy of the text stay in its position where the cell was before the scrolling happened. In addition, a new copy in the correctly scrolled position also appeared. But note that this copy at the correct location is not always appearing. Sometimes, only the copy in the old place before scrolling remains.
It seems that the Edit controls for tableview often does not work.
None the less, I add my code in attachment.
Any help will be appreciated. Thank you
Posted
Guru

Posted
Guru

from the very first line..
considering parentTable gets used later as..
Means using "New" in the declaration is wrong and so is using (elementTrainingForm)
should just be
Methods like this…
if dialog is canceled the function continues to run!
You should use something like this…
Code (gambas)
- pictureBox1Containes = True
- ButtonBox1.Text = c
- pictureViewerForm.imageLocation = c
As to your layout error i cannot see anything obviously wrong.
I cannot run your code as it's only 3 source files not a testable project.
So it means scrolling through every line of code hunting for a mistake in an unfamiliar code style.
All i can say is ScrollView (you seem to be using a ScrollView not a ScrollArea like the title says) had a glitch like that in an older gambas version but it got fixed.
Posted
Guru

Posted
Regular

I know the code is bad. It is my first prototype to display AI results.
But yes, i appreciate the corrections I did not know those details. Indeed, the "New TableView" was causing me problems which I circumvented with Variants. But now is better.
I am using 3.17.3 version, and I did test with refresh on scrollview_scroll, but it did not work. I will try with using refresh in table_scroll.
Posted
Guru

seany said
Hi
I know the code is bad. It is my first prototype to display AI results.
But yes, i appreciate the corrections I did not know those details. Indeed, the "New TableView" was causing me problems which I circumvented with Variants. But now is better.
I am using 3.17.5 version, and I did test with refresh on scrollview_scroll, but it did not work. I will try with using refresh in table_scroll.
All good fella, we all gotta learn somehow right ?
looking at your code it looks like you are making a mistake that i myself used to do a lot.
Because i was not too familiar with properly using Panels and HBox's and their Arrangement properties and Expand or AutoResize properties in containers/controls I was trying to control the layout and positioning myself.
this turns out to be a real pain , baring in mind that your application may look fine as it is on your desktop now but if you try QT not GTK or if you change your desktop theme style then your size calculations might not be right with the new style.
What is better is to REALLY work on making the objects resize/position themselves automatically so you don't have to.
For many objects there is the AutoResize property (works better on some than others)
For TableView you can set
Colums[Index].Width = -1 (does an auto-resize to fit)
Rows[Index].Height = -1 (does an auto-resize to fit row)
Columns[Index].Expand (expands that column)
these methods carefully placed can help with layout.
I don't know why you are doing things like this..
if you are having to do something like that to make something work then chances are something else is not right.
A glitch like you have often involves running through the code like a human debugger constantly looking for errors/better ways and eventually you crack it
Posted
Guru

the right hand panel does not fit the buttons.
adding rooms was , er , peculiar to say the least. i got a misplaced tableview at the top.
and if you zoom in on the attached picture you can see where the mouse is there is something there (a tiny little square, it's possibly the initially created parentTable)
It seems you are trying to do something a TableView is maybe not supposed to do?
I did not get the layout glitch you had but i had no text in my fields to go awry
Posted
Regular

I saw the square. I will check, if that is my problem. Thank you
Posted
Guru

<IMG src="https://www.cogier.com/gambas/Archive.png">
</IMG>
Posted
Regular

Posted
Guru

seany said
The right panel in my case, is adding showing the buttons correctly.
I saw the square. I will check, if that is my problem. Thank you
the right panel being the wrong size for me is exactly my point about trying to size things yourself and not using Panel.Arrangement properties and AutoResize and things to lay it all out automatically for you. Even when resizing the window.
I probably just have a different Font size or something on my desktop than you so the gui does not show right for me
Trust me fella, we've all done it, during our own "first project" days
Posted
Regular

So I can do this now.
<IMG src="https://i.imgur.com/ic3R8A4.png">
</IMG>The subtables move in unison, I can move the column headers of any root table or subtable to adjust size and control the heights of any row, and all subtables will adjust in unison.
If I add a new row, the parent table will adjust accordingly. ignore the green checkmark please.
Problem is now this:
<IMG src="https://i.imgur.com/BiRig5O.png">
</IMG>The green part is a subtable. It is anchored in the first Row ( = index 0, incidentally also the last row) of the parent table. The bottom boundary of the row is highlighted in blue.
The row's displayed height seems to max out at 1024. Even manually adding more height is not going to increase it. The table height (bottom border magenta) automatically respects the subtable height. But the height of the first (and incidentally last) row's height is not expanding to full table height .
Manually setting a large height to the table and the first ( = incidentally last) row is also causing exact same problem. Row height maxes out around 1024, and the table height increases. In addition, this error seem to be carried forward to the next added table, wherein the difference between row height and the table height appears to be twice of the previous one, even though printing those values out shows that in both cases, all four values ( = row 0 height of first root table, height of the first table, and these two values in the second table) are exactly the same.
Using -1 does not work, because a cell does not respect the subtable as it's content. So using row or height = subtable forces the cell size to return to original instead of spanning around the subtable.
1 guest and 0 members have just viewed this.



