Re: [Gambas-user] Gridview icon detection
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, Gianluigia é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 : > >> 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@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 -- 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, very interesting especially the explanation of _Draw :-) I thank you so much Regards Gianluigi 2017-01-19 12:07 GMT+01:00 Fabien Bodard: > 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@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
Re: [Gambas-user] Gridview icon detection
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. BrokenCode-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
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
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