[Gambas-user] ColumnView icon detection
Hello, In one of my projects I use icons in a ColumnView 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gridview icon detection
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: > 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 : > > 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 : > > > >> 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@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@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@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > BrokenCode-0.0.1.tar.gz Description: GNU Zip compressed data FalseColumnView-0.0.1.tar.gz Description: GNU Zip compressed data -- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gridview icon detection
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: > 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 : > >> 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@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@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Erratum: ColumnView icon detection
Sorry for the mistake, it’s not a GridView that I’m talking about but a ColumnView object. — Olivier Cruilles Le January 18, 2017 à 09:39:32, Yahoo (olivier.cruil...@yahoo.fr) a écrit: 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Gridview icon detection
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: > 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@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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Gridview icon detection
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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user