[Gambas-user] Tableview problem

Peter Peyotle peterpeyotle at gmx.de
Mon Mar 11 15:27:18 CET 2019


Hello and good day.

I have the following problem:

I put a combo box (or another control) in a cell of a tableview. The ComboBox is set by clicking on the cell.
I use the following code:
' -----------------------------------------------------------------------------------------------
'Gambas class file

Private myCombo As ComboBox

Public Sub form_Open ()
myCombo = New ComboBox (TableView1.Children [0])
Object.Attach (TableView1, Me, "tabEvents")
  
  TableView1.Columns.Count = 2
  TableView1.rows.Count = 15
  TableView1.Columns [0] .Width = TableView1.W / 2 - 15
  TableView1.Columns [1] .Width = TableView1.W / 2 - 15
End

Public Sub showCombo (tabIndex As Integer)
  Dim Xstart, CorrY As Integer

  myCombo.w = TableView1 [0, 1] .Width
  myCombo.h = TableView1 [0, 1] .Height

  myCombo.Y = TableView1 [tabIndex, 1] .Y
  myCombo.X = TableView1 [tabIndex, 1] .x
End

Public Sub tabEvents_Click ()
  
  show combo (Last.row)
  
End

' --------------------------------------------------------------------------------------------------------------------

It works very well too.
But, if I scroll the view into the area whose cells are first visible by scrolling, then the position fails (thus here: myCombo.Y = TableView1 [tabIndex, 1] .Y)

Perhaps this can be compensated by a correction factor.
But I think the tableview should also place in the not (always) visible area correctly.

Thanks for the help - I need her :-(.



Von meinem Sony Xperia™-Smartphone gesendet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190311/a3ef6a6b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: viewtest.tar
Type: application/x-tar
Size: 30720 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190311/a3ef6a6b/attachment-0001.tar>


More information about the User mailing list