Re: [Gambas-user] How to sort a TableView?

2016-04-05 Thread T Lee Davidson
Oops. Good catch. Thank you for pointing that out. Fixed. On 04/05/2016 04:46 PM, Gianluigi wrote: > Lee look what you made a mistake: > (no TableView1 but GridView1) > ValueSorted.Sort(IIf(GridView1.Columns.Ascending, gb.Ascent, gb.Descent)) > > Ciao > Gianluigi -- Lee __

Re: [Gambas-user] How to sort a TableView?

2016-04-05 Thread Gianluigi
Lee look what you made a mistake: (no TableView1 but GridView1) ValueSorted.Sort(IIf(GridView1.Columns.Ascending, gb.Ascent, gb.Descent)) Ciao Gianluigi 2016-04-05 20:11 GMT+02:00 T Lee Davidson : > Yes, I agree since the Mode for String[].Sort is integer and >

Re: [Gambas-user] How to sort a TableView?

2016-04-05 Thread Gianluigi
OK is the same 2016-04-05 20:11 GMT+02:00 T Lee Davidson : > Yes, I agree since the Mode for String[].Sort is integer and > GridView.Columns.Ascending is boolean. > > But, how about this? > ValueSorted.Sort(IIf(TableView1.Columns.Ascending, gb.Ascent, gb.Descent)) > > >

Re: [Gambas-user] How to sort a TableView?

2016-04-05 Thread T Lee Davidson
Yes, I agree since the Mode for String[].Sort is integer and GridView.Columns.Ascending is boolean. But, how about this? ValueSorted.Sort(IIf(TableView1.Columns.Ascending, gb.Ascent, gb.Descent)) On 04/05/2016 10:17 AM, Gianluigi wrote: > Hello Lee, > Milio propose this change to avoid the

Re: [Gambas-user] How to sort a TableView?

2016-04-05 Thread Gianluigi
Hello Lee, Milio propose this change to avoid the arrows appear upside than sorting. Instead of: ValueSorted.Sort(GridView1.Columns.Ascending) this code: If GridView1.Columns.Ascending Then ValueSorted.Sort(gb.Ascent) Else ValueSorted.Sort(gb.Descent) Endif Regards Gianluigi 2016-04-01 10:32

Re: [Gambas-user] How to sort a TableView?

2016-04-01 Thread Gianluigi
Hello Lee, thank you (also from my teacher Milio :-) ), all is a perfect explanation. Regards Gianluigi 2016-04-01 2:21 GMT+02:00 T Lee Davidson : > That's exactly what I needed, Gianluigi. Thank you. > > It works well even preserving distinct rows with duplicate key

Re: [Gambas-user] How to sort a TableView?

2016-03-31 Thread T Lee Davidson
That's exactly what I needed, Gianluigi. Thank you. It works well even preserving distinct rows with duplicate key values. I added a few comments to your code and added it as an example to http://gambaswiki.org/wiki/comp/gb.qt4/gridview/sorted. (I hope that's okay with you. If not, please let

Re: [Gambas-user] How to sort a TableView?

2016-03-31 Thread T Lee Davidson
Thank you, Frank. That is an interesting example. It uses an array of variant arrays as the underlying data-store similar to what I had done in the past with objects. And, they extend Object[] with a custom sort routine. Neat. On 03/31/2016 02:55 AM, Frank wrote: > Hi TLD, I found something

Re: [Gambas-user] How to sort a TableView?

2016-03-30 Thread T Lee Davidson
Thank you for your effort, Gianluigi. But, I am not using a database; just a TableView of data. When a TableView's Sorted property is set to True, clicking on a column header toggles the sort indicator and raises the TableView's Sort event. I need to sort the TableView rows based on the

Re: [Gambas-user] How to sort a TableView?

2016-03-30 Thread Gianluigi
Not sure if I understand the question, but something like that, could help? If TableView1.Columns.Ascending Then sMySql = "SELECT *" sMySql &= " FROM customers" sMySql &= " ORDER BY surname ASC," sMySql &= " name ASC" sMySql &= ";" Else sMySql = "SELECT *" sMySql &= " FROM

[Gambas-user] How to sort a TableView?

2016-03-30 Thread T Lee Davidson
The documentation for TableView shows a Sorted property which says, "Sorting the data is not done automatically. It must be done by user code." But, the page does not give any clues regarding how to accomplish that. Though, obviously, sorting should be done in the Sort event handler. In the