B4J Question Tableview Anomaly when column resizing.

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hello

I have a table view with 7 cols. The first 2 cols are text, and the remainder 5 cols have a checkbox in them.

upload_2018-10-5_12-52-39.png


When I resize any of the cols that have a checkbox using the double click on the col header when the mouse icon turns to resize the following occurs:

upload_2018-10-5_12-54-21.png



Is this a bug, or if there a redraw required, or can I just disable col resizing.

Regards

John.
 

Jmu5667

Well-Known Member
Licensed User
Longtime User
How are you creating the checkbox cells? Try to put the checkbox in a pane with a fixed size.

B4X:
Sub CreateItemCB (ci As CellIndex) As CheckBox
   
   Dim cb As CheckBox
   Dim ch As ChannelPTT
   
   ch.Initialize
   ch = Channels.Get(ci.Column-2)
   
   cb.Initialize("cb")
   cb.Tag = ci
   cb.TooltipText = ch.name

   Return cb
   
   
End Sub

I will try the pane method
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
I have just tried the following:


B4X:
' // create all the channels for this row
               For x = 2 To tvAccounts.ColumnsCount-1
                   tvAccounts.SetColumnWidth(x,50)
                   ' // for each cell we create a cell index and checkbox for each channel and store the key
                   Dim ci As CellIndex
                   Dim p As Pane
                  
                   p.Initialize("")
                  
                   ci.key = rs1.GetString("device_id")
                   ci.Column = x
                   ci.Row = rowIndex
                   p.AddNode(CreateItemCB(ci),0,0,-1,-1)
                   row(x) = p
               Next

I still get the same result. Where I am adding the pane node using -1,-1 I also tried using 60,60 to see if there was a difference and there was not.

Regards

John.
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
Don't use -1.
Set the pane size with Pane.SetLayout.

Did This, same result. There is only pane.SetLayoutAnimated.

B4X:
' // create all the channels for this row
               For x = 2 To tv.ColumnsCount-1
                   tv.SetColumnWidth(x,50)
                   ' // for each cell we create a cell index and checkbox for each channel and store the key
                   Dim ci As CellIndex
                   Dim p As Pane

                   
                   p.Initialize("")
                   ci.key = rs1.GetString("device_id")
                   ci.Column = x
                   ci.Row = rowIndex
                   
                   p.AddNode(CreateItemCB(ci),0,0,60,60)
                   p.SetLayoutAnimated(0,0,0,60,60)
                   row(x) = p
               Next
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
It is the same.

Might be a bug in TableView. If you can reproduce it in a small project that I might be able to find a workaround.

Here you go.

When you run this double click the col header to resize the col and you will see the effect. However when you scroll down past the cb's that have disappeared and then scroll back up they will reappear.

Regards

John.
 

Attachments

  • tableview.zip
    2.2 KB · Views: 295
Upvote 0
Top