[Gambas-user] TableView Tag Property

Gianluigi bagonergi at gmail.com
Wed Jan 13 16:25:33 CET 2021


Il giorno mer 13 gen 2021 alle ore 15:17 Martin <mbelmonte at belmotek.net> ha
scritto:

> Hi,
>
> The question is not related to the data event, however it is related to
> the ability of a cell to store a parameter, in this case true or false, in
> a different place than the text value of the cell. I leave here an
> example for clarity.
>

Could something like this be inspiring?

Public Sub Form_Open()

  Dim stx As String[]
  Dim lan As String
  Dim i As Integer
  Dim pic As Picture

  stx = ["C", "Python", "C++", "Visual Basic", "C#", "JavaScript", "PHP",
"SQL", "R", "Objective C", "Gambas", "Go"]

  GridView1.Rows.Count = stx.Count

  GridView1.Columns.Count = 2

  GridView1.Columns[1].Title = ("Languages")
  GridView1.Columns[1].Expand = True

  GridView1.Columns[0].Title = ("Like")

  For i = 0 To stx.Max
    GridView1[i, 1].Text = stx[i]
    If i Mod 2 <> 0 Then
      pic = Picture["icon:/16/ok"]
      GridView1[i, 0].WordWrap = True
      GridView1[i, 1].Background = Color.TextBackground
    Else
      pic = Picture["icon:/16/close"]
      GridView1[i, 0].WordWrap = False
      GridView1[i, 1].Background = Color.TextBackground - 1
    Endif

    GridView1[i, 0].Picture = pic

  Next

End

Public Sub GridView1_DblClick()

  If GridView1.Column = 0 Then
    If GridView1[GridView1.Row, 0].WordWrap = True Then
      GridView1[GridView1.Row, 0].WordWrap = False
      GridView1[GridView1.Row, 0].Picture = Picture["icon:/16/close"]
      GridView1[GridView1.Row, 1].Background = Color.TextBackground - 1
    Else
      GridView1[GridView1.Row, 0].WordWrap = True
      GridView1[GridView1.Row, 0].Picture = Picture["icon:/16/ok"]
      GridView1[GridView1.Row, 1].Background = Color.TextBackground
    Endif
  Else
    If GridView1[GridView1.Row, 1].Background = Color.TextBackground Then
      Print "TRUE"
    Else
      Print "FALSE"
    Endif
  Endif

End

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210113/6ae9c7a4/attachment.htm>


More information about the User mailing list