[Gambas-user] Gridview icon detection

Fabien Bodard gambas.fr at ...626...
Thu Jan 19 12:07:20 CET 2017


Ok this is my fault as i've not tested my code ... so i've forgot to
little things

This is so the working code :


Private aMyValues As New String[]
Private aMyStates As New Integer[]
Private aMyPicState As New Picture[3]

Public Sub _New()

  aMyPicState[0] = Picture["img/checked.png"]
  aMyPicState[1] = Picture["img/unchecked.png"]
  aMyPicState[2] = Picture["img/tristate.png"]

  'Load here values and states in arrays
  aMyValues.Push("First")
  aMyStates.Push(CheckBox.True)
  aMyValues.Push("Second")
  aMyStates.Push(CheckBox.None)
  aMyValues.Push("Third")
  aMyStates.Push(CheckBox.False)
  gridview1.columns.count = 2
  gridview1.Columns[0].Width = 22

  GridView1.Rows.height = 22

  GridView1.Rows.Count = aMyValues.Count

End

Public Sub GridView1_Data(Row As Integer, Column As Integer)

  Select Case Column

    Case 0
      Last.Data.Picture = aMyPicState[aMyStates[Row] + 1]
    Case 1
      Last.data.text = aMyValues[Row]

  End Select

End

Public Sub GridView1_Click()

  If Last.Column = 0 Then
    Inc aMyStates[GridView1.Row]
    If aMyStates[GridView1.Row] > 1 Then aMySTates[GridView1.Row] = -1
  Endif
  GridView1.Refresh

End


And I've corrected your project and added a form that show how to use
the _draw event. Here it allow to get checkboxes drawed with the
current desktop theme.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BrokenCode-0.0.1.tar.gz
Type: application/x-gzip
Size: 12554 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20170119/60663b35/attachment.bin>


More information about the User mailing list