Original date:2019-09-01 11:36:48 Edited by: irv Subject: Re: EuGTK:Sorting Column of Floats

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

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: []

      {"Circular","8 inch blade",59.95}, 
{"Drill Press", 
      {"Bench mounted", 
            {"1/4 hp. 6 speeds",128.50}, 
            {"1/2 hp. 8 speeds",150.00}, 
Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu