[Gambas-user] Gridview icon detection

Gianluigi bagonergi at ...626...
Wed Jan 18 23:58:59 CET 2017


Hi Fabien,

I did not understand if you answer the question by Olivier or to that of
the Spanish forum.

Your code am not able to make it work, sorry, you can have a look?

Regarding the new question by Olivier am attaching a possible solution,
always it comes from Shordi code.

Regards

Gianluigi

2017-01-18 21:55 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:

> Maybe the best will beto use 2 column... one for the icon and one for
> the text. The problem of many users is they want to use the gridview
> as  a data container.
>
> Better way will be to have 2 array or an array of class with two value.
>
>
> Private aMyValues as New String[]
> private aMyStates as new integer[]
> Private aMyPicStates 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
>
> gridview1.columns.count = 2
> gridview1.Columns[0].Width = 22
>
> Gridview1.Rows.height = 22
>
> GriwView1.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]]
> Case 1
>   Last.data.text = aMyValues[Row]
>
> end
>
>
> End
>
> Public sub GridView1_Click()
>
>   if Last.Column = 0 then
>     inc aMySTate
>     if aMyState >2 then aMySTate = 0
>   endif
>   GridView1.Refresh
> End
>
>
>
> If you want to delete a value you need to delete it in aMyValues and
> in aMyStates and then set the GridView1.ows.count with the count of
> one of these array to refresh.
>
> By using this technic, you are really free to do what you want with
> gridview.
>
>
>
> 2017-01-18 17:55 GMT+01:00 Gianluigi <bagonergi at ...626...>:
> > You mean something like that:
> >
> > Public Sub GridView1_Click()
> >
> >     ' From the Shordi's code, look here
> > https://www.gambas-es.org/show_post.php?p=34694
> >
> >     With GridView1
> >     If .Column = 0 Then                                             '
> > Columns with CheckBox
> >         If .Current.Picture = Picture["on.png"] Then
> >             .Current.Picture = Picture["off.png"]
> >             Print "CheckBox"; (GridView1.Row + 1); " unchecked"
> >         Else
> >             .current.Picture = Picture["on.png"]
> >             Print "CheckBox"; (GridView1.Row + 1); " checked"
> >         Endif
> >     Endif
> >     End With
> >
> > End
> >
> > Regards
> > Gianluigi
> >
> > 2017-01-18 15:39 GMT+01:00 Yahoo <olivier.cruilles at ...614...>:
> >
> >> Hello,
> >>
> >> In one of my project I use icons in a GridView object to indicate if a
> >> line is ‘checked’ or not and for the moment a double click on these
> lines
> >> can change this state as ‘Checked’ or 'Not Checked’.
> >>
> >> Would anyone know if it's possible to detect if the user click
> >> specifically on the icon on a line of a GridView to do this change of
> state.
> >> Is there a way to access to the Icon Object of a line of a GridView in
> >> fact.
> >>
> >>
> >>
> >>
> >> Thank you
> >>
> >>
> >> —
> >> Olivier Cruilles
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> 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
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------
> ------------------
> 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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BrokenCode-0.0.1.tar.gz
Type: application/x-gzip
Size: 12427 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20170118/33ed976b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FalseColumnView-0.0.1.tar.gz
Type: application/x-gzip
Size: 12169 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20170118/33ed976b/attachment-0001.bin>


More information about the User mailing list