Re: EuGTK:Sorting Column of Floats
- Posted by irv Sep 01, 2019
- 1362 views
Well, here are some of the things to be aware of:
If you use the GtkTreeModel sort, it sorts prices within each category:
For example, if your data looks like that shown below, then when you click sort, low-to-high, it sorts them as:
- Saws
- 8 inch blade 59.95
- Sawzall 139.95
- Drill Press
- Bench Mounted
- 6 speeds 128.50
- 8 speeds 150.00
- Bench Mounted
IOW, sort is restrained within a category/subcategory. Hopefully, that's what you want.
If instead you wanted something different, ignoring categories, say:
- 8 inch blade 59.95
- 6 speeds 128.50
- Sawzall 139.95
- 8 speeds 150.00
That would need to be done in a different way. Probably involving either a GtkTreeViewFilter or by letting Euphoria do the dirty work and loading the results.
In addition, once you sort on a column other than the Price column, the data order is lost and the price sort can't be done (on that tree model).
As a suggestion, read the GTK docs about the GtkTreeModel and GtkTreeModelSort. It indicates that you can sort and display the same data in a second TreeView without losing the original sorting ability in the first.
I really can't tell you much more unless I have a better idea of what you're wanting to do and how you're planning to do that.
I've posted a copy of GtkEngine.e and a short test program: [https://sites.google.com/site/euphoriagtk/GtkEngine.e.zip]
{"Saws", {"Reciprocal","Sawzall",139.95}, {"Circular","8 inch blade",59.95}, $}, {"Drill Press", {"Bench mounted", {"1/4 hp. 6 speeds",128.50}, {"1/2 hp. 8 speeds",150.00}, $}, $},..