[Gambas-user] Gridview icon detection
Linus
olivier.cruilles at ...614...
Fri Jan 20 00:19:04 CET 2017
Hi Fabien,
Thank you for the example but I made a mistake and it’s not for a GRIDVIEW but for ColumnView that I would detect the Icon.
Do you have any idea to do that please ?
Olivier Cruilles
> Le 19 janv. 2017 à 07:46, Gianluigi <bagonergi at ...626...> a écrit :
>
> Hi Fabien,
>
> very interesting especially the explanation of _Draw :-)
>
> I thank you so much
>
> Regards
>
> Gianluigi
>
> 2017-01-19 12:07 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
>
>> 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.
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list