[Gambas-user] TableView Tag Property

Martin mbelmonte at belmotek.net
Wed Jan 13 15:16:45 CET 2021


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.

' Gambas class file

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
     Else
       pic = Picture["icon:/16/close"]
       GridView1[i, 0].WordWrap = False
     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"]
     Else
       GridView1[GridView1.Row, 0].WordWrap = True
       GridView1[GridView1.Row, 0].Picture = Picture["icon:/16/ok"]
     Endif
   Endif

End

Regards

El 13/1/21 a las 14:00, Gianluigi escribió:
>
>
> Il giorno mer 13 gen 2021 alle ore 10:03 Martin 
> <mbelmonte at belmotek.net <mailto:mbelmonte at belmotek.net>> ha scritto:
>
>     Hi,
>
>     Tableview has not Tag property for each cell, but is there some
>     way to add this property to it?
>
>     The point is that when I click on a cell I want it to change its
>     image to show another state, which is easy using the mousedown
>     event, for example, but when is necessary to save the state data
>     on a support, such as a database where is the info?
>
>     It seems that there is no place to extract the true or false
>     information.I currently use the .WordWrap property but it's not
>     the right thing to do I guess, .Tag would be the optimal solution.
>
>     What could be the solution? Change the components [Grid|Table]View
>     ? or ... Made a modified component?
>
>     Regards.
>
> Sorry but I'm afraid I don't understand the question.
> Do you know the Data event of the GridView?
>
> Regards
> Gianluigi
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210113/7b7de26a/attachment.htm>


More information about the User mailing list